PMC-400
This commit is contained in:
@@ -3536,25 +3536,29 @@ class Cases
|
|||||||
$executedOn = $oPMScript->getExecutionOriginForAStep($stepType, $stepUidObj, $triggerType);
|
$executedOn = $oPMScript->getExecutionOriginForAStep($stepType, $stepUidObj, $triggerType);
|
||||||
$oPMScript->setExecutedOn($executedOn);
|
$oPMScript->setExecutedOn($executedOn);
|
||||||
$oPMScript->execute();
|
$oPMScript->execute();
|
||||||
$varsChanged = $oPMScript->getVarsChanged();
|
|
||||||
$appDataAfterTrigger = $oPMScript->aFields;
|
$appDataAfterTrigger = $oPMScript->aFields;
|
||||||
|
|
||||||
//Get the key and values changed only if the variable has the prefix
|
/**
|
||||||
//@see https://wiki.processmaker.com/3.2/Triggers#Typing_rules_for_Case_Variables
|
* This section of code its related to the route the case with parallel task in the same time
|
||||||
$fieldsTrigger = $this->findKeysAndValues($appDataAfterTrigger, $varsChanged);
|
* @link https://processmaker.atlassian.net/browse/PMC-2
|
||||||
|
*/
|
||||||
|
if ($oPMScript->executedOn() === $oPMScript::AFTER_ROUTING) {
|
||||||
|
//Get the variables changed with the trigger
|
||||||
|
$fieldsTrigger = arrayDiffRecursive($appDataAfterTrigger, $fieldsCase);
|
||||||
|
|
||||||
|
//We will be load the last appData because:
|
||||||
//We will be load the last appData because:
|
//Other thread execution can be changed the variables
|
||||||
//Other execution can be changed the variables or Plugin or PMFunction
|
$appUid = !empty($fieldsCase['APPLICATION']) ? $fieldsCase['APPLICATION'] : '';
|
||||||
$appUid = !empty($fieldsCase['APPLICATION']) ? $fieldsCase['APPLICATION'] : '';
|
if (!empty($appUid)) {
|
||||||
if (!empty($appUid)) {
|
//Update $fieldsCase with the last appData
|
||||||
//Update $fieldsCase with the last appData
|
$fieldsCase = $this->loadCase($appUid)['APP_DATA'];
|
||||||
$fieldsCase = $this->loadCase($appUid)['APP_DATA'];
|
}
|
||||||
|
//Merge the appData with variables changed
|
||||||
|
$fieldsCase = array_merge($fieldsCase, $fieldsTrigger);
|
||||||
|
} else {
|
||||||
|
$fieldsCase = $appDataAfterTrigger;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Merge the current appData with variables changed
|
|
||||||
$fieldsCase = array_merge($fieldsCase, $fieldsTrigger);
|
|
||||||
|
|
||||||
//Register the time execution
|
//Register the time execution
|
||||||
$this->arrayTriggerExecutionTime[$trigger['TRI_UID']] = $oPMScript->scriptExecutionTime;
|
$this->arrayTriggerExecutionTime[$trigger['TRI_UID']] = $oPMScript->scriptExecutionTime;
|
||||||
//Register the message of execution
|
//Register the message of execution
|
||||||
|
|||||||
@@ -400,6 +400,37 @@ function verifyCsrfToken($request)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the difference between to multidimensional array
|
||||||
|
*
|
||||||
|
* @param array $array1
|
||||||
|
* @param array $array2
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function arrayDiffRecursive(array $array1, array $array2)
|
||||||
|
{
|
||||||
|
$difference = [];
|
||||||
|
foreach ($array1 as $key => $value) {
|
||||||
|
if (is_array($value)) {
|
||||||
|
if (!isset($array2[$key])) {
|
||||||
|
$difference[$key] = $value;
|
||||||
|
} elseif (!is_array($array2[$key])) {
|
||||||
|
$difference[$key] = $value;
|
||||||
|
} else {
|
||||||
|
$new_diff = arrayDiffRecursive($value, $array2[$key]);
|
||||||
|
if (!empty($new_diff)) {
|
||||||
|
$difference[$key] = $new_diff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif (!isset($array2[$key]) || $array2[$key] != $value) {
|
||||||
|
$difference[$key] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $difference;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current user CSRF token.
|
* Get the current user CSRF token.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user