This commit is contained in:
Paula Quispe
2019-03-20 13:44:38 -04:00
parent bc39876669
commit f9e741604d

View File

@@ -818,7 +818,6 @@ class Cases
*
* @param string $appUid
* @param array $Fields
* @param bool $forceLoadData
*
* @return Fields
* @throws Exception
@@ -870,7 +869,7 @@ class Cases
* @see \ProcessMaker\BusinessModel\Cases\Variable::delete()
* @see \ProcessMaker\BusinessModel\Cases\Variable::update()
*/
public function updateCase($appUid, $Fields = [], $forceLoadData = false)
public function updateCase($appUid, $Fields = [])
{
try {
$application = new Application;
@@ -895,15 +894,10 @@ class Cases
}
//Get the appTitle and appDescription
$fieldsCase = [];
if ($forceLoadData) {
$lastFieldsCase = $this->loadCase($appUid)['APP_DATA'];
$fieldsCase = array_merge($appData, $lastFieldsCase);
}
$newTitleOrDescription = $this->newRefreshCaseTitleAndDescription(
$appUid,
$appFields,
empty($fieldsCase) ? $appData : $fieldsCase
$appData
);
//Start: Save History --By JHL
@@ -3510,6 +3504,7 @@ class Cases
$foundDisabledCode = "";
/*----------------------------------********---------------------------------*/
$varInAfterRouting = false;
$fieldsTrigger = [];
foreach ($triggersList as $trigger) {
/*----------------------------------********---------------------------------*/
@@ -3537,6 +3532,7 @@ class Cases
$executedOn = $oPMScript->getExecutionOriginForAStep($stepType, $stepUidObj, $triggerType);
$oPMScript->setExecutedOn($executedOn);
$oPMScript->execute();
//Return all the appData + variables changed in the execution
$appDataAfterTrigger = $oPMScript->aFields;
/**
@@ -3556,12 +3552,9 @@ class Cases
$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, true);
//Save the fields changed in the trigger
if (!$varInAfterRouting && !empty($fieldsTrigger)) {
$varInAfterRouting = true;
}
//Merge the appData with variables changed
@@ -3578,6 +3571,17 @@ class Cases
}
}
/**
* Get the caseTitle from the nextTask and update the caseTitle
*/
if ($varInAfterRouting) {
$this->newRefreshCaseTitleAndDescription(
$appUid,
['DEL_INDEX' => 0],
$fieldsCase
);
}
/*----------------------------------********---------------------------------*/
if (!empty($foundDisabledCode)) {
G::SendTemporalMessage(