PM-1165 "Se modifica funcion doPutCaseVariables para el envio opcional de id del dynaform para validar datos. Se agrega funcion doPutExecuteTriggers, para ejecucion de triggers"
This commit is contained in:
@@ -1439,7 +1439,7 @@ class Cases
|
||||
$fields = $case->loadCase($app_uid);
|
||||
$_POST['form'] = $app_data;
|
||||
|
||||
if ($dyn_uid) {
|
||||
if (!is_null($dyn_uid)) {
|
||||
$oDynaform = \DynaformPeer::retrieveByPK($dyn_uid);
|
||||
|
||||
if ($oDynaform->getDynVersion() < 2) {
|
||||
@@ -1917,4 +1917,36 @@ class Cases
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Put execute triggers
|
||||
*
|
||||
* @access public
|
||||
* @param string $app_uid , Uid for case
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function putExecuteTriggers($app_uid, $del_index = false)
|
||||
{
|
||||
Validator::isString($app_uid, '$app_uid');
|
||||
Validator::appUid($app_uid, '$app_uid');
|
||||
|
||||
if ($del_index === false) {
|
||||
$del_index = \AppDelegation::getCurrentIndex($app_uid);
|
||||
}
|
||||
Validator::isInteger($del_index, '$del_index');
|
||||
|
||||
$oCase = new \Cases();
|
||||
$aField = $oCase->loadCase($app_uid, $del_index);
|
||||
$tas_uid = $aField["TAS_UID"];
|
||||
|
||||
$task = new \Tasks();
|
||||
$arrayStep = $task->getStepsOfTask($tas_uid);
|
||||
|
||||
foreach ($arrayStep as $step) {
|
||||
$arrayField = $oCase->loadCase($app_uid);
|
||||
$arrayField["APP_DATA"] = $oCase->executeTriggers($tas_uid, $step["STEP_TYPE_OBJ"], $step["STEP_UID_OBJ"], "AFTER", $arrayField["APP_DATA"]);
|
||||
$arrayField = $oCase->updateCase($app_uid, $arrayField);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -995,5 +995,25 @@ class Cases extends Api
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute triggers
|
||||
*
|
||||
* @param string $app_uid {@min 1}{@max 32}
|
||||
* @param string $del_index {@from body}
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url PUT /:app_uid/execute-triggers
|
||||
*/
|
||||
public function doPutExecuteTriggers($app_uid, $del_index = false)
|
||||
{
|
||||
try {
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases->putExecuteTriggers($app_uid, $del_index);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user