Merged in develop (pull request #6849)
Updating feature branch with last changes in develop Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
@@ -318,6 +318,7 @@ function processWorkspace()
|
||||
executeScheduledCases();
|
||||
executeUpdateAppTitle();
|
||||
executeCaseSelfService();
|
||||
cleanSelfServiceTables();
|
||||
executePlugins();
|
||||
/*----------------------------------********---------------------------------*/
|
||||
fillReportByUser();
|
||||
@@ -1047,3 +1048,46 @@ function sendNotifications()
|
||||
saveLog("ExecuteSendNotifications", "error", "Error when sending notifications " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean unused records in tables related to the Self-Service Value Based feature
|
||||
*
|
||||
* @see processWorkspace()
|
||||
*
|
||||
* @link https://wiki.processmaker.com/3.2/Executing_cron.php#Syntax_of_cron.php_Options
|
||||
*/
|
||||
function cleanSelfServiceTables()
|
||||
{
|
||||
try {
|
||||
global $argvx;
|
||||
|
||||
// Check if the action can be executed
|
||||
if ($argvx !== "" && strpos($argvx, "clean-self-service-tables") === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Start message
|
||||
setExecutionMessage("Clean unused records for Self-Service Value Based feature");
|
||||
|
||||
// Get Propel connection
|
||||
$cnn = Propel::getConnection(AppAssignSelfServiceValueGroupPeer::DATABASE_NAME);
|
||||
|
||||
// Delete related rows and missing relations, criteria don't execute delete with joins
|
||||
$cnn->begin();
|
||||
$stmt = $cnn->createStatement();
|
||||
$stmt->executeQuery("DELETE " . AppAssignSelfServiceValueGroupPeer::TABLE_NAME . "
|
||||
FROM " . AppAssignSelfServiceValueGroupPeer::TABLE_NAME . "
|
||||
LEFT JOIN " . AppAssignSelfServiceValuePeer::TABLE_NAME . "
|
||||
ON (" . AppAssignSelfServiceValueGroupPeer::ID . " = " . AppAssignSelfServiceValuePeer::ID . ")
|
||||
WHERE " . AppAssignSelfServiceValuePeer::ID . " IS NULL");
|
||||
$cnn->commit();
|
||||
|
||||
// Success message
|
||||
setExecutionResultMessage("DONE");
|
||||
} catch (Exception $e) {
|
||||
$cnn->rollback();
|
||||
setExecutionResultMessage("WITH ERRORS", "error");
|
||||
eprintln(" '-" . $e->getMessage(), "red");
|
||||
saveLog("ExecuteCleanSelfServiceTables", "error", "Error when try to clean self-service tables " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -963,10 +963,9 @@ class Cases
|
||||
if (isset($Fields['CURRENT_USER_UID'])) {
|
||||
$Fields['USR_UID'] = $Fields['CURRENT_USER_UID'];
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$completed = new ListCompleted();
|
||||
$completed->create(array_merge($Fields, $newTitleOrDescription));
|
||||
/*----------------------------------********---------------------------------*/
|
||||
//Will be update the status in the list Participated
|
||||
$listParticipatedLast = new ListParticipatedLast();
|
||||
$listParticipatedLast->refreshStatus($Fields['APP_UID'], 'COMPLETED');
|
||||
}
|
||||
|
||||
/** Update case*/
|
||||
@@ -1138,9 +1137,6 @@ class Cases
|
||||
$oCriteria->add(ListParticipatedHistoryPeer::APP_UID, $sAppUid);
|
||||
ListParticipatedHistoryPeer::doDelete($oCriteria);
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(ListCompletedPeer::APP_UID, $sAppUid);
|
||||
ListCompletedPeer::doDelete($oCriteria);
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(ListUnassignedPeer::APP_UID, $sAppUid);
|
||||
ListUnassignedPeer::doDelete($oCriteria);
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
@@ -74,6 +74,44 @@ class Groups
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the IDs of the active groups for an user
|
||||
*
|
||||
* @param string $usrUid
|
||||
*
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getActiveGroupsForAnUserById($usrUid)
|
||||
{
|
||||
try {
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn(GroupUserPeer::GRP_ID);
|
||||
$criteria->addJoin(GroupUserPeer::GRP_ID, GroupwfPeer::GRP_ID, Criteria::LEFT_JOIN);
|
||||
//@todo: we need to add a new column GROUP_USER.USR_ID
|
||||
$criteria->add(GroupUserPeer::USR_UID, $usrUid);
|
||||
//@todo: we need to add a new column GROUPWF.GRP_STATUS_ID
|
||||
$criteria->add(GroupwfPeer::GRP_STATUS, 'ACTIVE');
|
||||
$dataset = GroupUserPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset->next();
|
||||
|
||||
//If the user does not relate with any group we will to return a default value for avoiding problems with the IN
|
||||
$groups = [-1];
|
||||
$row = $dataset->getRow();
|
||||
while (is_array($row)) {
|
||||
$groups[] = $row['GRP_ID'];
|
||||
$dataset->next();
|
||||
$row = $dataset->getRow();
|
||||
}
|
||||
|
||||
return $groups;
|
||||
} catch (Exception $error) {
|
||||
throw ($error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a user to group
|
||||
*
|
||||
|
||||
@@ -2400,7 +2400,7 @@ class WorkspaceTools
|
||||
return;
|
||||
}
|
||||
|
||||
$arrayTable1 = ['ListInbox', 'ListMyInbox', 'ListCanceled', 'ListParticipatedLast', 'ListParticipatedHistory', 'ListPaused', 'ListCompleted'];
|
||||
$arrayTable1 = ['ListInbox', 'ListMyInbox', 'ListCanceled', 'ListParticipatedLast', 'ListParticipatedHistory', 'ListPaused'];
|
||||
$arrayTable2 = ['ListUnassigned', 'ListUnassignedGroup'];
|
||||
$arrayTable = array_merge($arrayTable1, $arrayTable2);
|
||||
|
||||
@@ -2426,7 +2426,6 @@ class WorkspaceTools
|
||||
}
|
||||
|
||||
if ($flagReinsert || !$flagListAll) {
|
||||
$this->regenerateListCompleted($lang);
|
||||
$this->regenerateListCanceled($lang);
|
||||
$this->regenerateListMyInbox(); //This list require no translation
|
||||
$this->regenerateListInbox(); //This list require no translation
|
||||
@@ -2511,69 +2510,6 @@ class WorkspaceTools
|
||||
CLI::logging("> Completed table LIST_CANCELED\n");
|
||||
}
|
||||
|
||||
public function regenerateListCompleted($lang = 'en')
|
||||
{
|
||||
$this->initPropel(true);
|
||||
$query = 'INSERT INTO ' . $this->dbName . '.LIST_COMPLETED
|
||||
(APP_UID,
|
||||
USR_UID,
|
||||
TAS_UID,
|
||||
PRO_UID,
|
||||
APP_NUMBER,
|
||||
APP_TITLE,
|
||||
APP_PRO_TITLE,
|
||||
APP_TAS_TITLE,
|
||||
APP_CREATE_DATE,
|
||||
APP_FINISH_DATE,
|
||||
DEL_INDEX,
|
||||
DEL_PREVIOUS_USR_UID,
|
||||
DEL_CURRENT_USR_USERNAME,
|
||||
DEL_CURRENT_USR_FIRSTNAME,
|
||||
DEL_CURRENT_USR_LASTNAME)
|
||||
|
||||
SELECT
|
||||
ACV.APP_UID,
|
||||
ACV.USR_UID,
|
||||
ACV.TAS_UID,
|
||||
ACV.PRO_UID,
|
||||
ACV.APP_NUMBER,
|
||||
C_APP.CON_VALUE AS APP_TITLE,
|
||||
C_PRO.CON_VALUE AS APP_PRO_TITLE,
|
||||
C_TAS.CON_VALUE AS APP_TAS_TITLE,
|
||||
ACV.APP_CREATE_DATE,
|
||||
ACV.APP_FINISH_DATE,
|
||||
ACV.DEL_INDEX,
|
||||
PREV_AD.USR_UID AS DEL_PREVIOUS_USR_UID,
|
||||
USR.USR_USERNAME AS DEL_CURRENT_USR_USERNAME,
|
||||
USR.USR_FIRSTNAME AS DEL_CURRENT_USR_FIRSTNAME,
|
||||
USR.USR_LASTNAME AS DEL_CURRENT_USR_LASTNAME
|
||||
FROM
|
||||
(' . $this->dbName . '.APP_CACHE_VIEW ACV
|
||||
LEFT JOIN ' . $this->dbName . '.CONTENT C_APP ON ACV.APP_UID = C_APP.CON_ID
|
||||
AND C_APP.CON_CATEGORY = \'APP_TITLE\'
|
||||
AND C_APP.CON_LANG = \'' . $lang . '\'
|
||||
LEFT JOIN ' . $this->dbName . '.CONTENT C_PRO ON ACV.PRO_UID = C_PRO.CON_ID
|
||||
AND C_PRO.CON_CATEGORY = \'PRO_TITLE\'
|
||||
AND C_PRO.CON_LANG = \'' . $lang . '\'
|
||||
LEFT JOIN ' . $this->dbName . '.CONTENT C_TAS ON ACV.TAS_UID = C_TAS.CON_ID
|
||||
AND C_TAS.CON_CATEGORY = \'TAS_TITLE\'
|
||||
AND C_TAS.CON_LANG = \'' . $lang . '\')
|
||||
LEFT JOIN
|
||||
(' . $this->dbName . '.APP_DELEGATION AD
|
||||
INNER JOIN ' . $this->dbName . '.APP_DELEGATION PREV_AD ON AD.APP_UID = PREV_AD.APP_UID
|
||||
AND AD.DEL_PREVIOUS = PREV_AD.DEL_INDEX) ON ACV.APP_UID = AD.APP_UID
|
||||
AND ACV.DEL_INDEX = AD.DEL_INDEX
|
||||
LEFT JOIN
|
||||
' . $this->dbName . '.USERS USR ON ACV.USR_UID = USR.USR_UID
|
||||
WHERE
|
||||
ACV.APP_STATUS = \'COMPLETED\'
|
||||
AND ACV.DEL_LAST_INDEX = 1';
|
||||
$con = Propel::getConnection("workflow");
|
||||
$stmt = $con->createStatement();
|
||||
$stmt->executeQuery($query);
|
||||
CLI::logging("> Completed table LIST_COMPLETED\n");
|
||||
}
|
||||
|
||||
public function regenerateListMyInbox()
|
||||
{
|
||||
$this->initPropel(true);
|
||||
|
||||
@@ -64,6 +64,12 @@ class AppAssignSelfServiceValue extends BaseAppAssignSelfServiceValue
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @see \Cases->removeCase()
|
||||
* @see \Cases->setCatchUser()
|
||||
* @see \Cases->updateCase()
|
||||
*
|
||||
* @link https://wiki.processmaker.com/3.2/Tasks#Self_Service_Value_Based_Assignment
|
||||
*/
|
||||
public function remove($applicationUid, $delIndex = 0)
|
||||
{
|
||||
@@ -76,18 +82,7 @@ class AppAssignSelfServiceValue extends BaseAppAssignSelfServiceValue
|
||||
$criteria->add(AppAssignSelfServiceValuePeer::DEL_INDEX, $delIndex, Criteria::EQUAL);
|
||||
}
|
||||
|
||||
$result = AppAssignSelfServiceValuePeer::doDelete($criteria);
|
||||
|
||||
// Delete related rows and missing relations, criteria don't execute delete with joins
|
||||
$cnn = Propel::getConnection(AppAssignSelfServiceValueGroupPeer::DATABASE_NAME);
|
||||
$cnn->begin();
|
||||
$stmt = $cnn->createStatement();
|
||||
$rs = $stmt->executeQuery("DELETE " . AppAssignSelfServiceValueGroupPeer::TABLE_NAME . "
|
||||
FROM " . AppAssignSelfServiceValueGroupPeer::TABLE_NAME . "
|
||||
LEFT JOIN " . AppAssignSelfServiceValuePeer::TABLE_NAME . "
|
||||
ON (" . AppAssignSelfServiceValueGroupPeer::ID . " = " . AppAssignSelfServiceValuePeer::ID . ")
|
||||
WHERE " . AppAssignSelfServiceValuePeer::ID . " IS NULL");
|
||||
$cnn->commit();
|
||||
AppAssignSelfServiceValuePeer::doDelete($criteria);
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ require_once 'classes/model/om/BaseListCompleted.php';
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Method deprecated in Release 3.3.9
|
||||
*/
|
||||
// @codingStandardsIgnoreStart
|
||||
class ListCompleted extends BaseListCompleted implements ListInterface
|
||||
{
|
||||
use ListBaseTrait;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
require_once 'classes/model/om/BaseListParticipatedLast.php';
|
||||
|
||||
use ProcessMaker\BusinessModel\Cases as BmCases;
|
||||
|
||||
/**
|
||||
@@ -536,4 +537,25 @@ class ListParticipatedLast extends BaseListParticipatedLast implements ListInter
|
||||
}
|
||||
BasePeer::doUpdate($criteriaWhere, $criteriaSet, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the column APP_STATUS
|
||||
*
|
||||
* @param string $appUid
|
||||
* @param string $status, can be [TO_DO, COMPLETED, etc]
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @see Cases::updateCase()
|
||||
*/
|
||||
public function refreshStatus($appUid, $status = 'TO_DO')
|
||||
{
|
||||
//Update - WHERE
|
||||
$criteriaWhere = new Criteria("workflow");
|
||||
$criteriaWhere->add(ListParticipatedLastPeer::APP_UID, $appUid, Criteria::EQUAL);
|
||||
//Update - SET
|
||||
$criteriaSet = new Criteria("workflow");
|
||||
$criteriaSet->add(ListParticipatedLastPeer::APP_STATUS, $status);
|
||||
BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,18 +333,16 @@ class ListUnassigned extends BaseListUnassigned implements ListInterface
|
||||
{
|
||||
try {
|
||||
$arrayAppAssignSelfServiceValueData = [];
|
||||
|
||||
$criteria = new Criteria("workflow");
|
||||
|
||||
$group = new Groups();
|
||||
//Get the GRP_ID related to the $userUid
|
||||
$arrayId = $group->getActiveGroupsForAnUserById($userUid);
|
||||
|
||||
$sql = "("
|
||||
. AppAssignSelfServiceValueGroupPeer::ASSIGNEE_ID . " IN ("
|
||||
. " SELECT " . GroupUserPeer::GRP_ID . " "
|
||||
. " FROM " . GroupUserPeer::TABLE_NAME . " "
|
||||
. " LEFT JOIN " . GroupwfPeer::TABLE_NAME . " ON (" . GroupUserPeer::GRP_ID . "=" . GroupwfPeer::GRP_ID . ") "
|
||||
. " WHERE " . GroupUserPeer::USR_UID . "='" . $userUid . "' AND " . GroupwfPeer::GRP_STATUS . "='ACTIVE'"
|
||||
. " ) AND "
|
||||
. " " . AppAssignSelfServiceValueGroupPeer::ASSIGNEE_TYPE . "=2 "
|
||||
. ")";
|
||||
. AppAssignSelfServiceValueGroupPeer::ASSIGNEE_ID . " IN (" . implode(",", $arrayId) . ") AND "
|
||||
. " " . AppAssignSelfServiceValueGroupPeer::ASSIGNEE_TYPE . " = 2 "
|
||||
. ")";
|
||||
|
||||
$criteria->setDistinct();
|
||||
$criteria->addSelectColumn(AppAssignSelfServiceValuePeer::APP_UID);
|
||||
|
||||
@@ -373,7 +373,7 @@ ViewDashboardPresenter.prototype.statusViewModel = function(indicatorId, data) {
|
||||
};
|
||||
var newObject3 = {
|
||||
datalabel : originalObject.taskTitle,
|
||||
value : 100 - (originalObject.percentageTotalOverdue + originalObject.percentageTotalAtRisk)
|
||||
value : originalObject.percentageTotalOnTime
|
||||
};
|
||||
|
||||
if (newObject1.value > 0) {
|
||||
|
||||
@@ -3,7 +3,7 @@ CREATE TRIGGER CONTENT_UPDATE BEFORE UPDATE ON CONTENT
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
|
||||
DECLARE str TEXT;
|
||||
DECLARE str MEDIUMTEXT;
|
||||
|
||||
IF (NEW.CON_VALUE IS NULL) THEN
|
||||
SET str = '';
|
||||
|
||||
Reference in New Issue
Block a user