HOR-1466
This commit is contained in:
@@ -2914,5 +2914,25 @@ class Cases
|
||||
|
||||
return G::json_encode($dataResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
* if case already routed
|
||||
*
|
||||
* @param type $app_uid
|
||||
* @param type $del_index
|
||||
* @param type $usr_uid
|
||||
* @throws type
|
||||
*/
|
||||
public function caseAlreadyRouted($app_uid, $del_index, $usr_uid = '')
|
||||
{
|
||||
$c = new \Criteria('workflow');
|
||||
$c->add(\AppDelegationPeer::APP_UID, $app_uid);
|
||||
$c->add(\AppDelegationPeer::DEL_INDEX, $del_index);
|
||||
if (!empty($usr_uid)) {
|
||||
$c->add(\AppDelegationPeer::USR_UID, $usr_uid);
|
||||
}
|
||||
$c->add(\AppDelegationPeer::DEL_FINISH_DATE, null, \Criteria::ISNULL);
|
||||
return !(boolean) \AppDelegationPeer::doCount($c);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1542,8 +1542,16 @@ class Light extends Api
|
||||
public function doPutCaseVariables($app_uid, $request_data, $dyn_uid = '', $del_index = 0)
|
||||
{
|
||||
try {
|
||||
if ($del_index === null) {
|
||||
throw (new \Exception(G::LoadTranslation('ID_CAN_NOT_BE_NULL', array('del_index')), Api::STAT_APP_EXCEPTION));
|
||||
}
|
||||
$usr_uid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
if ($del_index > 0) {
|
||||
if ($cases->caseAlreadyRouted($app_uid, $del_index, $usr_uid)) {
|
||||
throw (new \Exception(G::LoadTranslation('ID_CASE_ALREADY_DERIVATED'), Api::STAT_APP_EXCEPTION));
|
||||
}
|
||||
}
|
||||
$request_data = \ProcessMaker\Util\DateTime::convertDataToUtc($request_data);
|
||||
$cases->setCaseVariables($app_uid, $request_data, $dyn_uid, $usr_uid, $del_index);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
Reference in New Issue
Block a user