HOR-1617 "ActionsByEmail problemas con el "previous user" con tareas paralelas" SOLVED
Issue:
ActionsByEmail problemas con el "previous user" con tareas paralelas
Cause:
Para determinar el "previous user" se esta considerando/utilizando el campo "APP_DELEGATION.DEL_LAST_INDEX"
Solution:
Se refactoriza y se contruye el metodo "AppDelegation::getPreviousDelegationValidTask()" para
determinar el "previous delegation"
This commit is contained in:
@@ -805,47 +805,6 @@ class Derivation
|
|||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get valid origin Task
|
|
||||||
*
|
|
||||||
* @param string $applicationUid Unique id of Case
|
|
||||||
* @param int $delIndex Delegation index
|
|
||||||
*
|
|
||||||
* @return string Returns valid origin Task
|
|
||||||
*/
|
|
||||||
private function __getTaskUidOrigin($applicationUid, $delIndex)
|
|
||||||
{
|
|
||||||
$taskUidOrigin = '';
|
|
||||||
|
|
||||||
do {
|
|
||||||
$criteria = new Criteria('workflow');
|
|
||||||
|
|
||||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_PREVIOUS);
|
|
||||||
$criteria->addSelectColumn(TaskPeer::TAS_UID);
|
|
||||||
$criteria->addSelectColumn(TaskPeer::TAS_TYPE);
|
|
||||||
|
|
||||||
$criteria->addJoin(AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::INNER_JOIN);
|
|
||||||
$criteria->add(AppDelegationPeer::APP_UID, $applicationUid, Criteria::EQUAL);
|
|
||||||
$criteria->add(AppDelegationPeer::DEL_INDEX, $delIndex, Criteria::EQUAL);
|
|
||||||
|
|
||||||
$rsCriteria = AppDelegationPeer::doSelectRS($criteria);
|
|
||||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
|
|
||||||
if ($rsCriteria->next()) {
|
|
||||||
$record = $rsCriteria->getRow();
|
|
||||||
|
|
||||||
if (preg_match('/^(?:' . 'NORMAL|SCRIPT\-TASK|WEBENTRYEVENT|START\-MESSAGE\-EVENT|START\-TIMER\-EVENT' . ')$/', $record['TAS_TYPE'])) {
|
|
||||||
$taskUidOrigin = $record['TAS_UID'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$delIndex = $record['DEL_PREVIOUS'];
|
|
||||||
}
|
|
||||||
} while ($taskUidOrigin == '');
|
|
||||||
|
|
||||||
//Return
|
|
||||||
return $taskUidOrigin;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Derivate
|
/** Derivate
|
||||||
*
|
*
|
||||||
* @param array $currentDelegation
|
* @param array $currentDelegation
|
||||||
@@ -1274,15 +1233,18 @@ class Derivation
|
|||||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||||
$arrayApplicationData = $case->getApplicationRecordByPk($currentDelegation['APP_UID'], [], false);
|
$arrayApplicationData = $case->getApplicationRecordByPk($currentDelegation['APP_UID'], [], false);
|
||||||
|
|
||||||
$arrayRoutingData = (!is_null($arrayApplicationData['APP_ROUTING_DATA']) && $arrayApplicationData['APP_ROUTING_DATA'] != '')? unserialize($arrayApplicationData['APP_ROUTING_DATA']) : [];
|
$arrayRoutingData = (!is_null($arrayApplicationData['APP_ROUTING_DATA']) && (string)($arrayApplicationData['APP_ROUTING_DATA']) != '')? unserialize($arrayApplicationData['APP_ROUTING_DATA']) : [];
|
||||||
|
|
||||||
$iAppThreadIndex = $appFields['DEL_THREAD'];
|
$iAppThreadIndex = $appFields['DEL_THREAD'];
|
||||||
$delType = 'NORMAL';
|
$delType = 'NORMAL';
|
||||||
$sendNotificationsMobile = false;
|
$sendNotificationsMobile = false;
|
||||||
|
|
||||||
|
$appDelegation = new AppDelegation();
|
||||||
$taskNextDel = TaskPeer::retrieveByPK($nextDel["TAS_UID"]);
|
$taskNextDel = TaskPeer::retrieveByPK($nextDel["TAS_UID"]);
|
||||||
|
|
||||||
$taskUidOrigin = $this->__getTaskUidOrigin($currentDelegation['APP_UID'], $currentDelegation['DEL_INDEX']);
|
$arrayAppDelegationPrevious = $appDelegation->getPreviousDelegationValidTask($currentDelegation['APP_UID'], $currentDelegation['DEL_INDEX'], true);
|
||||||
|
|
||||||
|
$taskUidOrigin = $arrayAppDelegationPrevious['TAS_UID'];
|
||||||
$taskUidDest = $taskNextDel->getTasUid();
|
$taskUidDest = $taskNextDel->getTasUid();
|
||||||
|
|
||||||
if (array_key_exists($taskUidOrigin . '/' . $taskUidDest, $arrayRoutingData)) {
|
if (array_key_exists($taskUidOrigin . '/' . $taskUidDest, $arrayRoutingData)) {
|
||||||
|
|||||||
@@ -44,6 +44,54 @@
|
|||||||
*/
|
*/
|
||||||
class AppDelegation extends BaseAppDelegation
|
class AppDelegation extends BaseAppDelegation
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Get previous delegation (Valid Task)
|
||||||
|
*
|
||||||
|
* @param string $applicationUid Unique id of Case
|
||||||
|
* @param int $delIndex Delegation index
|
||||||
|
* @param bool $flagIncludeCurrentDel Include current delegation
|
||||||
|
*
|
||||||
|
* @return array Returns previous delegation, FALSE otherwise
|
||||||
|
*/
|
||||||
|
public function getPreviousDelegationValidTask($applicationUid, $delIndex, $flagIncludeCurrentDel = false)
|
||||||
|
{
|
||||||
|
$arrayAppDelegationPrevious = false;
|
||||||
|
$flagPrevious = true;
|
||||||
|
|
||||||
|
do {
|
||||||
|
$criteria = new Criteria('workflow');
|
||||||
|
|
||||||
|
$criteria->addSelectColumn(AppDelegationPeer::TABLE_NAME . '.*');
|
||||||
|
$criteria->addSelectColumn(TaskPeer::TAS_TYPE);
|
||||||
|
|
||||||
|
$criteria->addJoin(AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::INNER_JOIN);
|
||||||
|
$criteria->add(AppDelegationPeer::APP_UID, $applicationUid, Criteria::EQUAL);
|
||||||
|
$criteria->add(AppDelegationPeer::DEL_INDEX, $delIndex, Criteria::EQUAL);
|
||||||
|
|
||||||
|
$rsCriteria = AppDelegationPeer::doSelectRS($criteria);
|
||||||
|
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
|
if ($rsCriteria->next()) {
|
||||||
|
$record = $rsCriteria->getRow();
|
||||||
|
|
||||||
|
if ($flagIncludeCurrentDel) {
|
||||||
|
if (preg_match('/^(?:' . 'NORMAL|SCRIPT\-TASK|WEBENTRYEVENT|START\-MESSAGE\-EVENT|START\-TIMER\-EVENT' . ')$/', $record['TAS_TYPE'])) {
|
||||||
|
$arrayAppDelegationPrevious = $record;
|
||||||
|
$flagPrevious = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$delIndex = $record['DEL_PREVIOUS'];
|
||||||
|
} else {
|
||||||
|
$flagPrevious = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$flagIncludeCurrentDel = true;
|
||||||
|
} while ($flagPrevious);
|
||||||
|
|
||||||
|
//Return
|
||||||
|
return $arrayAppDelegationPrevious;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create an application delegation
|
* create an application delegation
|
||||||
@@ -130,7 +178,6 @@ class AppDelegation extends BaseAppDelegation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Update set
|
//Update set
|
||||||
$criteriaUpdate = new Criteria('workflow');
|
$criteriaUpdate = new Criteria('workflow');
|
||||||
$criteriaUpdate->add(AppDelegationPeer::DEL_LAST_INDEX, 0);
|
$criteriaUpdate->add(AppDelegationPeer::DEL_LAST_INDEX, 0);
|
||||||
@@ -194,12 +241,14 @@ class AppDelegation extends BaseAppDelegation
|
|||||||
$bpmn = new \ProcessMaker\Project\Bpmn();
|
$bpmn = new \ProcessMaker\Project\Bpmn();
|
||||||
$flagActionsByEmail = true;
|
$flagActionsByEmail = true;
|
||||||
|
|
||||||
|
$arrayAppDelegationPrevious = $this->getPreviousDelegationValidTask($sAppUid, $delIndex);
|
||||||
|
|
||||||
$data = new stdclass();
|
$data = new stdclass();
|
||||||
$data->TAS_UID = $sTasUid;
|
$data->TAS_UID = $sTasUid;
|
||||||
$data->APP_UID = $sAppUid;
|
$data->APP_UID = $sAppUid;
|
||||||
$data->DEL_INDEX = $delIndex;
|
$data->DEL_INDEX = $delIndex;
|
||||||
$data->USR_UID = $sUsrUid;
|
$data->USR_UID = $sUsrUid;
|
||||||
$data->PREVIOUS_USR_UID = $delPreviusUsrUid;
|
$data->PREVIOUS_USR_UID = ($arrayAppDelegationPrevious !== false)? $arrayAppDelegationPrevious['USR_UID'] : $delPreviusUsrUid;
|
||||||
|
|
||||||
if ($bpmn->exists($sProUid)) {
|
if ($bpmn->exists($sProUid)) {
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
@@ -858,4 +907,3 @@ class AppDelegation extends BaseAppDelegation
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2106,7 +2106,7 @@ class BpmnWorkflow extends Project\Bpmn
|
|||||||
//Update Process
|
//Update Process
|
||||||
$process = \ProcessPeer::retrieveByPk($this->wp->getUid());
|
$process = \ProcessPeer::retrieveByPk($this->wp->getUid());
|
||||||
|
|
||||||
$arrayActionDone = (!is_null($process->getProActionDone()) && $process->getProActionDone() != '')? unserialize($process->getProActionDone()) : [];
|
$arrayActionDone = (!is_null($process->getProActionDone()) && (string)($process->getProActionDone()) != '')? unserialize($process->getProActionDone()) : [];
|
||||||
$arrayActionDone[] = $actionDone;
|
$arrayActionDone[] = $actionDone;
|
||||||
|
|
||||||
$this->wp->update(['PRO_ACTION_DONE' => serialize($arrayActionDone)]);
|
$this->wp->update(['PRO_ACTION_DONE' => serialize($arrayActionDone)]);
|
||||||
|
|||||||
Reference in New Issue
Block a user