From 9f94f528cffc5a8dcab6d1c93f139f27d9bf5f4e Mon Sep 17 00:00:00 2001 From: Brayan Osmar Pereyra Suxo Date: Tue, 18 Mar 2014 12:31:36 -0400 Subject: [PATCH 1/3] Adicion de CASES ACTIONS 13-17 --- workflow/engine/classes/class.wsBase.php | 1 + .../engine/classes/model/AdditionalTables.php | 3 + .../engine/classes/model/AppDelegation.php | 15 ++- workflow/engine/src/BusinessModel/Cases.php | 114 +++++++++++++++++ .../engine/src/BusinessModel/Validator.php | 80 +++++++++++- .../src/Services/Api/ProcessMaker/Cases.php | 121 ++++++++++++++++-- 6 files changed, 323 insertions(+), 11 deletions(-) diff --git a/workflow/engine/classes/class.wsBase.php b/workflow/engine/classes/class.wsBase.php index 806dbff6e..031a2f05e 100755 --- a/workflow/engine/classes/class.wsBase.php +++ b/workflow/engine/classes/class.wsBase.php @@ -2585,6 +2585,7 @@ class wsBase $oCriteria = new Criteria( 'workflow' ); $oCriteria->addSelectColumn( AppDelayPeer::APP_UID ); $oCriteria->addSelectColumn( AppDelayPeer::APP_DEL_INDEX ); + $oCriteria->addSelectColumn( AppDelayPeer::APP_DISABLE_ACTION_USER ); $oCriteria->add( AppDelayPeer::APP_TYPE, '' ); $oCriteria->add( $oCriteria->getNewCriterion( AppDelayPeer::APP_TYPE, 'PAUSE' )->addOr( $oCriteria->getNewCriterion( AppDelayPeer::APP_TYPE, 'CANCEL' ) ) ); $oCriteria->addAscendingOrderByColumn( AppDelayPeer::APP_ENABLE_ACTION_DATE ); diff --git a/workflow/engine/classes/model/AdditionalTables.php b/workflow/engine/classes/model/AdditionalTables.php index a51ee0338..7448f60d3 100755 --- a/workflow/engine/classes/model/AdditionalTables.php +++ b/workflow/engine/classes/model/AdditionalTables.php @@ -831,6 +831,9 @@ class AdditionalTables extends BaseAdditionalTables //switching by report table type case 'NORMAL': // parsing empty values to null + if (!is_array($caseData)) { + $caseData = unserialize($caseData); + } foreach ($caseData as $i => $v) { foreach ($fieldTypes as $key => $fieldType) { foreach ($fieldType as $name => $type) { diff --git a/workflow/engine/classes/model/AppDelegation.php b/workflow/engine/classes/model/AppDelegation.php index 6cd2af457..5141aa304 100755 --- a/workflow/engine/classes/model/AppDelegation.php +++ b/workflow/engine/classes/model/AppDelegation.php @@ -290,7 +290,7 @@ class AppDelegation extends BaseAppDelegation $aCalendarUID = ''; } - //use the dates class to calculate dates + //use the dates class to calculate dates $calendar = new calendar(); if ($calendar->pmCalendarUid == '') { @@ -509,5 +509,18 @@ class AppDelegation extends BaseAppDelegation $rs->next(); return $rs->getRow(); } + + public function getCurrentIndex ($appUid) + { + $oCriteria = new Criteria(); + $oCriteria->addSelectColumn( AppDelegationPeer::DEL_INDEX ); + $oCriteria->add( AppDelegationPeer::APP_UID, $appUid ); + $oCriteria->addDescendingOrderByColumn( AppDelegationPeer::DEL_INDEX ); + $oRuleSet = AppDelegationPeer::doSelectRS( $oCriteria ); + $oRuleSet->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oRuleSet->next(); + $data = $oRuleSet->getRow(); + return (int)$data['DEL_INDEX']; + } } diff --git a/workflow/engine/src/BusinessModel/Cases.php b/workflow/engine/src/BusinessModel/Cases.php index 86c6f0698..9090bfc63 100644 --- a/workflow/engine/src/BusinessModel/Cases.php +++ b/workflow/engine/src/BusinessModel/Cases.php @@ -404,4 +404,118 @@ class Cases } } + /** + * Put cancel case + * + * @access public + * @param string $app_uid, Uid for case + * @param string $usr_uid, Uid for user + * @param string $del_index, Index for case + * @return array + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + */ + public function putCancelCase($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->cancelCase( $app_uid, $del_index, $usr_uid ); + } + + /** + * Put pause 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 + * @param null|string $unpaused_date, Date for unpaused + * @return array + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + */ + public function putPauseCase($app_uid, $usr_uid, $del_index = false, $unpaused_date = null) { + Validator::appUid($app_uid, '$cas_uid'); + Validator::usrUid($usr_uid, '$usr_uid'); + if ($unpaused_date != null) { + Validator::isDate($unpaused_date, 'Y-m-d', '$unpaused_date'); + } + + if ($del_index === false) { + $del_index = \AppDelegation::getCurrentIndex($app_uid); + } + + $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 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 ); + } } diff --git a/workflow/engine/src/BusinessModel/Validator.php b/workflow/engine/src/BusinessModel/Validator.php index 0e81a0c68..85324878e 100644 --- a/workflow/engine/src/BusinessModel/Validator.php +++ b/workflow/engine/src/BusinessModel/Validator.php @@ -98,8 +98,9 @@ class Validator{ /** * Validate usr_uid - * @var string $dep_uid. Uid for Departament - * @var string $nameField. Name of field for message + * + * @param string $usr_uid, Uid for user + * @param string $nameField . Name of field for message * * @access public * @author Brayan Pereyra (Cochalo) @@ -120,6 +121,81 @@ class Validator{ return $usr_uid; } + /** + * Validate app_uid + * + * @param string $app_uid, Uid for application + * @param string $nameField . Name of field for message + * + * @access public + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @return string + */ + static public function appUid($app_uid, $nameField = 'app_uid') + { + $app_uid = trim($app_uid); + if ($app_uid == '') { + throw (new \Exception("The application with $nameField: '' does not exist.")); + } + $oApplication = new \Application(); + if (!($oApplication->exists($app_uid))) { + throw (new \Exception("The application with $nameField: '$app_uid' does not exist.")); + } + return $app_uid; + } + + /** + * Validate app_uid + * + * @param string $tri_uid, Uid for trigger + * @param string $nameField . Name of field for message + * + * @access public + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @return string + */ + static public function triUid($tri_uid, $nameField = 'tri_uid') + { + $tri_uid = trim($tri_uid); + if ($tri_uid == '') { + throw (new \Exception("The trigger with $nameField: '' does not exist.")); + } + $oTriggers = new \Triggers(); + if (!($oTriggers->TriggerExists($tri_uid))) { + throw (new \Exception("The trigger with $nameField: '$tri_uid' does not exist.")); + } + return $tri_uid; + } + + /** + * Validate date + * + * @param string $date, Date for validate + * @param string $nameField . Name of field for message + * + * @access public + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @return string + */ + static public function isDate($date, $format = 'Y-m-d H:i:s', $nameField = 'app_uid') + { + $date = trim($date); + if ($date == '') { + throw (new \Exception("The value '' is not valid fot the format '$format'.")); + } + $d = \DateTime::createFromFormat($format, $date); + if (!($d && $d->format($format) == $date)) { + throw (new \Exception("The value '$date' is not valid fot the format '$format'.")); + } + return $date; + } + /** * Validate is array * @var array $field. Field type array diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Cases.php b/workflow/engine/src/Services/Api/ProcessMaker/Cases.php index 34f0e83a5..845bac5a7 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Cases.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Cases.php @@ -18,7 +18,6 @@ class Cases extends Api /** * Get list Cases To Do * - * @access public * @param array $request_data , Data for list * @return array * @@ -30,6 +29,8 @@ class Cases extends Api public function doGetCasesListToDo($request_data = array()) { try { + \G::pr($this->getUserId()); + die('fin'); $request_data['action'] = 'todo'; $request_data['userId'] = $this->getUserId(); $oCases = new \BusinessModel\Cases(); @@ -43,7 +44,6 @@ class Cases extends Api /** * Get list Cases Draft * - * @access public * @param array $request_data , Data for list * @return array * @@ -68,7 +68,6 @@ class Cases extends Api /** * Get list Cases Participated * - * @access public * @param array $request_data , Data for list * @return array * @@ -93,7 +92,6 @@ class Cases extends Api /** * Get list Cases Unassigned * - * @access public * @param array $request_data , Data for list * @return array * @@ -118,7 +116,6 @@ class Cases extends Api /** * Get list Cases Paused * - * @access public * @param array $request_data , Data for list * @return array * @@ -143,7 +140,6 @@ class Cases extends Api /** * Get list Cases Advanced Search * - * @access public * @param array $request_data , Data for list * @return array * @@ -256,8 +252,7 @@ class Cases extends Api $arrayData = $cases->updateReassignCase($cas_uid, $userUid, $del_index, $usr_uid_source, $usr_uid_target); $response = $arrayData; return $response; - } catch (\Exception $e) { - throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -280,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())); + } + } } From f47a74098c19fd23e23f0e3d9a5ab2a745b307e4 Mon Sep 17 00:00:00 2001 From: Brayan Osmar Pereyra Suxo Date: Tue, 18 Mar 2014 14:37:47 -0400 Subject: [PATCH 2/3] Correccion de conflictos --- workflow/engine/src/BusinessModel/Cases.php | 138 +++++++++--------- .../src/Services/Api/ProcessMaker/Cases.php | 111 ++++++++++++++ 2 files changed, 179 insertions(+), 70 deletions(-) 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())); + } + } } From 81613f100968cf547be2ba20405a1b2bcb33cede Mon Sep 17 00:00:00 2001 From: Daniel Rojas Date: Tue, 18 Mar 2014 17:05:30 -0400 Subject: [PATCH 3/3] Se modifica CASES, para reassignCase y routeCase --- workflow/engine/src/BusinessModel/Cases.php | 11 ++++++++--- .../engine/src/Services/Api/ProcessMaker/Cases.php | 11 +++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/workflow/engine/src/BusinessModel/Cases.php b/workflow/engine/src/BusinessModel/Cases.php index be7b66bf6..afceb779b 100644 --- a/workflow/engine/src/BusinessModel/Cases.php +++ b/workflow/engine/src/BusinessModel/Cases.php @@ -403,10 +403,12 @@ class Cases * * return array Return an array with Task Case */ - public function updateReassignCase($caseUid, $userUid, $delIndex, $userUidSource, $userUidTarget) { try { + if (!$delIndex) { + $delIndex = \AppDelegation::getCurrentIndex($caseUid); + } \G::LoadClass('wsBase'); $ws = new \wsBase(); $fields = $ws->reassignCase($userUid, $caseUid, $delIndex, $userUidSource, $userUidTarget); @@ -533,7 +535,7 @@ class Cases } /** - * Reassign Case + * Route Case * * @param string $caseUid Unique id of Case * @param string $userUid Unique id of User @@ -542,10 +544,12 @@ class Cases * * return array Return an array with Task Case */ - public function updateRouteCase($caseUid, $userUid, $delIndex) { try { + if (!$delIndex) { + $delIndex = \AppDelegation::getCurrentIndex($caseUid); + } \G::LoadClass('wsBase'); $ws = new \wsBase(); $fields = $ws->derivateCase($userUid, $caseUid, $delIndex, $bExecuteTriggersBeforeAssignment = false); @@ -556,6 +560,7 @@ class Cases } } + /** * get all upload document that they have send it * diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Cases.php b/workflow/engine/src/Services/Api/ProcessMaker/Cases.php index 75ad956aa..7bcac29ad 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Cases.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Cases.php @@ -240,11 +240,12 @@ class Cases extends Api /** * @url PUT /:cas_uid/reassign-case * - * @param string $del_index {@from body} + * @param string $cas_uid {@from body} {@min 32}{@max 32} * @param string $usr_uid_source {@from body} {@min 32}{@max 32} * @param string $usr_uid_target {@from body} {@min 32}{@max 32} + * @param string $del_index {@from body} */ - public function doPutReassignCase($cas_uid, $del_index, $usr_uid_source, $usr_uid_target) + public function doPutReassignCase($cas_uid, $usr_uid_source, $usr_uid_target, $del_index = null) { try { $userUid = $this->getUserId(); @@ -259,12 +260,10 @@ class Cases extends Api /** * @url PUT /:cas_uid/route-case * + * @param string $cas_uid {@from body} {@min 32}{@max 32} * @param string $del_index {@from body} - * @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) + public function doPutRouteCase($cas_uid, $del_index = null) { try { $userUid = $this->getUserId();