Merge branch 'master' of bitbucket.org:colosa/processmaker into PM-940
This commit is contained in:
@@ -1424,11 +1424,12 @@ class Cases
|
||||
* @access public
|
||||
* @param string $app_uid, Uid for case
|
||||
* @param array $app_data, Data for case variables
|
||||
* @param string $dyn_uid, Uid for dynaform
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function setCaseVariables($app_uid, $app_data)
|
||||
public function setCaseVariables($app_uid, $app_data, $dyn_uid = null)
|
||||
{
|
||||
Validator::isString($app_uid, '$app_uid');
|
||||
Validator::appUid($app_uid, '$app_uid');
|
||||
@@ -1436,7 +1437,18 @@ class Cases
|
||||
|
||||
$case = new \Cases();
|
||||
$fields = $case->loadCase($app_uid);
|
||||
$data['APP_DATA'] = array_merge($fields['APP_DATA'], $app_data);
|
||||
$_POST['form'] = $app_data;
|
||||
|
||||
if (!is_null($dyn_uid)) {
|
||||
$oDynaform = \DynaformPeer::retrieveByPK($dyn_uid);
|
||||
|
||||
if ($oDynaform->getDynVersion() < 2) {
|
||||
$oForm = new \Form ( $fields['PRO_UID'] . "/" . $dyn_uid, PATH_DYNAFORM );
|
||||
$oForm->validatePost();
|
||||
}
|
||||
}
|
||||
|
||||
$data['APP_DATA'] = array_merge($fields['APP_DATA'], $_POST['form']);
|
||||
$case->updateCase($app_uid, $data);
|
||||
}
|
||||
|
||||
@@ -1905,5 +1917,57 @@ class Cases
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Put execute triggers
|
||||
*
|
||||
* @access public
|
||||
* @param string $app_uid , Uid for case
|
||||
* @param int $del_index , Index for case
|
||||
* @param string $obj_type , Index for case
|
||||
* @param string $obj_uid , Index for case
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function putExecuteTriggers($app_uid, $del_index, $obj_type, $obj_uid)
|
||||
{
|
||||
Validator::isString($app_uid, '$app_uid');
|
||||
Validator::appUid($app_uid, '$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();
|
||||
$aField["APP_DATA"] = $oCase->executeTriggers($tas_uid, $obj_type, $obj_uid, "AFTER", $aField["APP_DATA"]);
|
||||
$aField = $oCase->updateCase($app_uid, $aField);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Steps evaluate
|
||||
*
|
||||
* @access public
|
||||
* @param string $app_uid, Uid for case
|
||||
* @param int $del_index , Index for case
|
||||
* @return array
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function getSteps($app_uid, $del_index)
|
||||
{
|
||||
Validator::isString($app_uid, '$app_uid');
|
||||
Validator::appUid($app_uid, '$app_uid');
|
||||
Validator::isInteger($del_index, '$del_index');
|
||||
|
||||
$oCase = new \Cases();
|
||||
$aCaseField = $oCase->loadCase($app_uid, $del_index);
|
||||
$tas_uid = $aCaseField["TAS_UID"];
|
||||
$pro_uid = $aCaseField["PRO_UID"];
|
||||
|
||||
$oApplication = new \Applications();
|
||||
$aField = $oApplication->getSteps($app_uid, $del_index, $tas_uid, $pro_uid);
|
||||
|
||||
return $aField;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -610,6 +610,7 @@ class Variable
|
||||
$variableSql = "";
|
||||
$sqlLimit = "";
|
||||
$variableSqlLimit = "";
|
||||
$sqlConditionLike = "";
|
||||
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
|
||||
@@ -838,17 +838,18 @@ class Cases extends Api
|
||||
*
|
||||
* @param string $app_uid {@min 1}{@max 32}
|
||||
* @param array $request_data
|
||||
* @param string $dyn_uid {@from path}
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url PUT /:app_uid/variable
|
||||
*/
|
||||
public function doPutCaseVariables($app_uid, $request_data)
|
||||
public function doPutCaseVariables($app_uid, $request_data, $dyn_uid = '')
|
||||
{
|
||||
try {
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases->setCaseVariables($app_uid, $request_data);
|
||||
$cases->setCaseVariables($app_uid, $request_data, $dyn_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
@@ -994,5 +995,48 @@ class Cases extends Api
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute triggers
|
||||
*
|
||||
* @param string $app_uid {@min 1}{@max 32}
|
||||
* @param int $del_index {@from body}
|
||||
* @param string $obj_type {@from body}
|
||||
* @param string $obj_uid {@from body}
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url PUT /:app_uid/execute-triggers
|
||||
*/
|
||||
public function doPutExecuteTriggers($app_uid, $del_index, $obj_type, $obj_uid)
|
||||
{
|
||||
try {
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases->putExecuteTriggers($app_uid, $del_index, $obj_type, $obj_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:app_uid/:del_index/steps
|
||||
*
|
||||
* @param string $app_uid {@min 32}{@max 32}
|
||||
* @param int $del_index
|
||||
*
|
||||
*/
|
||||
public function doGetSteps($app_uid, $del_index)
|
||||
{
|
||||
try {
|
||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||
$case->setFormatFieldNameInUppercase(false);
|
||||
|
||||
$response = $case->getSteps($app_uid, $del_index);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user