diff --git a/workflow/engine/src/BusinessModel/Cases.php b/workflow/engine/src/BusinessModel/Cases.php index 1a006d0ee..be7b66bf6 100644 --- a/workflow/engine/src/BusinessModel/Cases.php +++ b/workflow/engine/src/BusinessModel/Cases.php @@ -328,8 +328,8 @@ class Cases $oDataset->next(); while ($aRow = $oDataset->getRow()) { $result = array ('guid' => $aRow['TAS_UID'], - 'name' => $aRow['TAS_TITLE'], - 'delegate' => $aRow['DEL_INDEX'] + 'name' => $aRow['TAS_TITLE'], + 'delegate' => $aRow['DEL_INDEX'] ); $oDataset->next(); } @@ -418,7 +418,6 @@ class Cases } /** -<<<<<<< HEAD * Put cancel case * * @access public @@ -469,7 +468,71 @@ class Cases $case = new \Cases(); $case->pauseCase( $app_uid, $del_index, $usr_uid, $unpaused_date ); } -======= + + /** + * Put unpause case + * + * @access public + * @param string $app_uid , Uid for case + * @param string $usr_uid , Uid for user + * @param bool|string $del_index , Index for case + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + */ + public function putUnpauseCase($app_uid, $usr_uid, $del_index = false) { + Validator::appUid($app_uid, '$cas_uid'); + Validator::usrUid($usr_uid, '$usr_uid'); + + if ($del_index === false) { + $del_index = \AppDelegation::getCurrentIndex($app_uid); + } + + $case = new \Cases(); + $case->unpauseCase( $app_uid, $del_index, $usr_uid ); + } + + /** + * Put execute trigger case + * + * @access public + * @param string $app_uid , Uid for case + * @param string $usr_uid , Uid for user + * @param bool|string $del_index , Index for case + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + */ + public function putExecuteTriggerCase($app_uid, $tri_uid, $usr_uid, $del_index = false) { + Validator::appUid($app_uid, '$cas_uid'); + Validator::triUid($tri_uid, '$tri_uid'); + Validator::usrUid($usr_uid, '$usr_uid'); + + if ($del_index === false) { + $del_index = \AppDelegation::getCurrentIndex($app_uid); + } + + $case = new \wsBase(); + $case->executeTrigger( $usr_uid, $app_uid, $tri_uid, $del_index ); + } + + /** + * Delete case + * + * @access public + * @param string $app_uid, Uid for case + * @return array + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + */ + public function deleteCase($app_uid) { + Validator::appUid($app_uid, '$cas_uid'); + $case = new \Cases(); + $case->removeCase( $app_uid ); + } + + /** * Reassign Case * * @param string $caseUid Unique id of Case @@ -784,69 +847,4 @@ class Cases $oCriteria->addDescendingOrderByColumn('CREATE_DATE'); return $oCriteria; } -} ->>>>>>> 9eaec8c26aa7492684f15ad1df02c3500a3b6c13 - - /** - * Put unpause case - * - * @access public - * @param string $app_uid , Uid for case - * @param string $usr_uid , Uid for user - * @param bool|string $del_index , Index for case - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia - */ - public function putUnpauseCase($app_uid, $usr_uid, $del_index = false) { - Validator::appUid($app_uid, '$cas_uid'); - Validator::usrUid($usr_uid, '$usr_uid'); - - if ($del_index === false) { - $del_index = \AppDelegation::getCurrentIndex($app_uid); - } - - $case = new \Cases(); - $case->unpauseCase( $app_uid, $del_index, $usr_uid ); - } - - /** - * Put unpause case - * - * @access public - * @param string $app_uid , Uid for case - * @param string $usr_uid , Uid for user - * @param bool|string $del_index , Index for case - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia - */ - public function putExecuteTriggerCase($app_uid, $tri_uid, $usr_uid, $del_index = false) { - Validator::appUid($app_uid, '$cas_uid'); - Validator::triUid($tri_uid, '$tri_uid'); - Validator::usrUid($usr_uid, '$usr_uid'); - - if ($del_index === false) { - $del_index = \AppDelegation::getCurrentIndex($app_uid); - } - - $case = new \wsBase(); - $case->executeTrigger( $usr_uid, $app_uid, $tri_uid, $del_index ); - } - - /** - * Delete case - * - * @access public - * @param string $app_uid, Uid for case - * @return array - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia - */ - public function deleteCase($app_uid) { - Validator::appUid($app_uid, '$cas_uid'); - $case = new \Cases(); - $case->removeCase( $app_uid ); - } -} +} \ No newline at end of file diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Cases.php b/workflow/engine/src/Services/Api/ProcessMaker/Cases.php index 035072984..75ad956aa 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Cases.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Cases.php @@ -263,6 +263,7 @@ class Cases extends Api * @param string $usr_uid_source {@from body} {@min 32}{@max 32} * @param string $usr_uid_target {@from body} {@min 32}{@max 32} */ + public function doPutRouteCase($cas_uid, $del_index) { try { @@ -274,5 +275,115 @@ class Cases extends Api throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } + + /** + * Cancel Case + * + * @param string $cas_uid {@min 1}{@max 32} + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @url PUT /:cas_uid/cancel-case + */ + public function doPutCancelCase($cas_uid) + { + try { + $userUid = $this->getUserId(); + $cases = new \BusinessModel\Cases(); + $cases->putCancelCase($cas_uid, $userUid); + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * Pause Case + * + * @param string $cas_uid {@min 1}{@max 32} + * @param string $unpaused_date {@from body} + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @url PUT /:cas_uid/pause-case + */ + public function doPutPauseCase($cas_uid, $unpaused_date = null) + { + try { + $userUid = $this->getUserId(); + $cases = new \BusinessModel\Cases(); + if ($unpaused_date == null) { + $cases->putPauseCase($cas_uid, $userUid); + } else { + $cases->putPauseCase($cas_uid, $userUid, false, $unpaused_date); + } + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * Unpause Case + * + * @param string $cas_uid {@min 1}{@max 32} + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @url PUT /:cas_uid/unpause-case + */ + public function doPutUnpauseCase($cas_uid) + { + try { + $userUid = $this->getUserId(); + $cases = new \BusinessModel\Cases(); + $cases->putUnpauseCase($cas_uid, $userUid); + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * Unpause Case + * + * @param string $cas_uid {@min 1}{@max 32} + * @param string $tri_uid {@min 1}{@max 32} + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @url PUT /:cas_uid/execute-trigger/:tri_uid + */ + public function doPutExecuteTriggerCase($cas_uid, $tri_uid) + { + try { + $userUid = $this->getUserId(); + $cases = new \BusinessModel\Cases(); + $cases->putExecuteTriggerCase($cas_uid, $tri_uid, $userUid); + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * Delete Case + * + * @param string $cas_uid {@min 1}{@max 32} + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @url DELETE /:cas_uid + */ + public function doDeleteCase($cas_uid) + { + try { + $cases = new \BusinessModel\Cases(); + $cases->deleteCase($cas_uid); + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } }