This commit is contained in:
Paula Quispe
2019-02-04 11:44:48 -04:00
parent e964bbce14
commit 94ab710714
2 changed files with 15 additions and 5 deletions

View File

@@ -3522,8 +3522,6 @@ class Cases
$oPMScript = new PMScript(); $oPMScript = new PMScript();
} }
$oPMScript->setFields($fieldsCase);
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
$cs = new CodeScanner(config("system.workspace")); $cs = new CodeScanner(config("system.workspace"));
$foundDisabledCode = ""; $foundDisabledCode = "";
@@ -3539,6 +3537,7 @@ class Cases
} }
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
$oPMScript->setFields($fieldsCase);
$execute = true; $execute = true;
//Check if the trigger has conditions for the execution //Check if the trigger has conditions for the execution
if (!empty($trigger['ST_CONDITION'])) { if (!empty($trigger['ST_CONDITION'])) {
@@ -3569,9 +3568,19 @@ class Cases
//Other thread execution can be changed the variables //Other thread execution can be changed the variables
$appUid = !empty($fieldsCase['APPLICATION']) ? $fieldsCase['APPLICATION'] : ''; $appUid = !empty($fieldsCase['APPLICATION']) ? $fieldsCase['APPLICATION'] : '';
if (!empty($appUid)) { if (!empty($appUid)) {
$lastFieldsCase = $this->loadCase($appUid)['APP_DATA'];
//Update $fieldsCase with the last appData //Update $fieldsCase with the last appData
$fieldsCase = $this->loadCase($appUid)['APP_DATA']; $fieldsCase = array_merge($fieldsCase, $lastFieldsCase);
} }
//Update the case with the fields changed in the trigger
if (!empty($fieldsTrigger)) {
$appFieldsTrigger = [];
$appFieldsTrigger['APP_DATA'] = $fieldsTrigger;
//Update the case
$this->updateCase($appUid, $appFieldsTrigger);
}
//Merge the appData with variables changed //Merge the appData with variables changed
$fieldsCase = array_merge($fieldsCase, $fieldsTrigger); $fieldsCase = array_merge($fieldsCase, $fieldsTrigger);
} else { } else {

View File

@@ -281,11 +281,12 @@ class PMScript
self::AFTER_EXTERNAL_STEP : self::UNDEFINED_ORIGIN; self::AFTER_EXTERNAL_STEP : self::UNDEFINED_ORIGIN;
break; break;
case 'ASSIGN_TASK': case 'ASSIGN_TASK':
$stepUidObj = (int)$stepUidObj;
if ($stepUidObj === -1) { if ($stepUidObj === -1) {
$executedOn = $triggerType === 'BEFORE' ? self::BEFORE_ASSIGNMENT : self::UNDEFINED_ORIGIN; $executedOn = $triggerType === 'BEFORE' ? self::BEFORE_ASSIGNMENT : self::UNDEFINED_ORIGIN;
} elseif ($stepUidObj === -2) { } elseif ($stepUidObj === -2) {
$executedOn = $triggerType === 'BEFORE' ? self::BEFORE_ROUTING : $triggerType === 'AFTER' ? $executedOn = $triggerType === 'BEFORE' ? self::BEFORE_ROUTING : ($triggerType === 'AFTER' ?
self::AFTER_ROUTING : self::UNDEFINED_ORIGIN; self::AFTER_ROUTING : self::UNDEFINED_ORIGIN);
} else { } else {
$executedOn = self::UNDEFINED_ORIGIN; $executedOn = self::UNDEFINED_ORIGIN;
} }