This commit is contained in:
Israel Bernabe
2019-03-29 10:00:39 -04:00
committed by Paula Quispe
parent bddc2906a6
commit ef84cd1523
15 changed files with 242 additions and 75 deletions

View File

@@ -663,14 +663,19 @@ class Derivation
/**
* Execute Event
*
* @param string $dummyTaskUid Unique id of Element Origin (unique id of Task) This is the nextTask
* @param array $applicationData Case data
* @param bool $flagEventExecuteBeforeGateway Execute event before gateway
* @param bool $flagEventExecuteAfterGateway Execute event after gateway
* @param string $dummyTaskUid Unique id of Element Origin (unique id of Task) This is the nextTask
* @param array $applicationData Case data
* @param bool $flagEventExecuteBeforeGateway Execute event before gateway
* @param bool $flagEventExecuteAfterGateway Execute event after gateway
* @param int $taskId
*
* @return void
* @see Derivation->derivate()
* @see Derivation->doRouteWithoutThread()
* @see Derivation->finishProcess()
* @see Derivation->finishTask()
*/
private function executeEvent($dummyTaskUid, array $applicationData, $flagEventExecuteBeforeGateway = true, $flagEventExecuteAfterGateway = true, $elementOriUid='')
private function executeEvent($dummyTaskUid, array $applicationData, $flagEventExecuteBeforeGateway = true, $flagEventExecuteAfterGateway = true, $elementOriUid='',$tasId = 0)
{
try {
//Verify if the Project is BPMN
@@ -743,7 +748,7 @@ class Derivation
if (preg_match("/^(?:END|INTERMEDIATE)$/", $event->getEvnType()) && $event->getEvnMarker() === 'EMAIL') {
//Email-Event throw
$result = $emailEvent->sendEmail($applicationData["APP_UID"], $applicationData["PRO_UID"], $value['uid'], $applicationData);
$result = $emailEvent->sendEmail($applicationData["APP_UID"], $applicationData["PRO_UID"], $value['uid'], $applicationData, $tasId);
$aContext['envUid'] = $value['uid'];
$aContext['envType'] = $event->getEvnType();
@@ -1031,7 +1036,8 @@ class Derivation
$appFields,
true,
true,
$currentDelegation["TAS_UID"]
$currentDelegation["TAS_UID"],
!empty($nextDel["TAS_ID"]) ? $nextDel["TAS_ID"] : 0
);
//Route the case
@@ -1877,7 +1883,15 @@ class Derivation
if (preg_match("/^(?:END-MESSAGE-EVENT|END-EMAIL-EVENT)$/", $taskDummy->getTasType())
&& $multiInstanceCompleted && $executeEvent
) {
$this->executeEvent($nextDel["TAS_UID_DUMMY"], $appFields, $flagFirstIteration, true);
$nextDel["TAS_ID"] = $taskDummy->getTasId();
$this->executeEvent(
$nextDel["TAS_UID_DUMMY"],
$appFields,
$flagFirstIteration,
true,
'',
!empty($nextDel["TAS_ID"]) ? $nextDel["TAS_ID"] : 0
);
}
}
$aContext['action'] = 'finish-task';
@@ -1904,12 +1918,27 @@ class Derivation
$nextDel['ROU_CONDITION'] = '';
}
//Execute the Intermediate Event After the End of Process
$this->executeEvent($nextDel["TAS_UID"], $appFields, true, true);
$this->executeEvent(
$nextDel["TAS_UID"],
$appFields,
true,
true,
'',
!empty($nextDel["TAS_ID"]) ? $nextDel["TAS_ID"] : 0
);
if (isset($nextDel["TAS_UID_DUMMY"]) ) {
$taskDummy = TaskPeer::retrieveByPK($nextDel["TAS_UID_DUMMY"]);
if (preg_match("/^(?:END-MESSAGE-EVENT|END-EMAIL-EVENT)$/", $taskDummy->getTasType())) {
$nextDel["TAS_ID"] = $taskDummy->getTasId();
//Throw Events
$this->executeEvent($nextDel["TAS_UID_DUMMY"], $appFields, $flagFirstIteration, true);
$this->executeEvent(
$nextDel["TAS_UID_DUMMY"],
$appFields,
$flagFirstIteration,
true,
'',
!empty($nextDel["TAS_ID"]) ? $nextDel["TAS_ID"] : 0
);
}
}
$aContext['action'] = 'end-process';
@@ -2231,7 +2260,14 @@ class Derivation
//If the all Siblings are done execute the events
if (sizeof($arraySiblings) === 0 && !$flagTypeMultipleInstance) {
//Throw Events
$this->executeEvent($nextDel["TAS_UID"], $appFields, $flagFirstIteration, false);
$this->executeEvent(
$nextDel["TAS_UID"],
$appFields,
$flagFirstIteration,
false,
'',
!empty($nextDel["TAS_ID"]) ? $nextDel["TAS_ID"] : 0
);
}
//Close thread
$this->case->closeAppThread( $currentDelegation['APP_UID'], $iAppThreadIndex );