diff --git a/resources/assets/js/home/CaseDetail.vue b/resources/assets/js/home/CaseDetail.vue index c460a0c20..20701211f 100644 --- a/resources/assets/js/home/CaseDetail.vue +++ b/resources/assets/js/home/CaseDetail.vue @@ -438,7 +438,6 @@ export default { if (err.response.data) { that.showAlert(err.response.data.error.message, "danger"); } - throw new Error(err); }); }, formatResponseCaseNotes(notes) { @@ -592,11 +591,16 @@ export default { * @param {object} data */ onClickUnpause(data) { - Api.cases.unpause(data.row).then((response) => { - if (response.statusText === "OK") { - this.$refs["vueTable"].getData(); - } - }); + let that = this; + Api.cases.unpause(data.row) + .then((response) => { + if (response.statusText === "OK") { + that.$refs["vueTable"].getData(); + } + }) + .catch((error) => { + that.showAlert(error.response.data.error.message, 'danger'); + }); }, /** * Claim case diff --git a/resources/assets/js/home/XCase.vue b/resources/assets/js/home/XCase.vue index 7e3a55360..e2d9ef9fc 100644 --- a/resources/assets/js/home/XCase.vue +++ b/resources/assets/js/home/XCase.vue @@ -24,6 +24,16 @@ export default { props: { data: Object }, + data() { + return { + openDebug: false, + dataCase: null, + height: "100%", + width: "100%", + diffHeight: 10, + path: "", + }; + }, mounted() { let that = this; this.height = window.innerHeight - this.diffHeight; @@ -41,24 +51,21 @@ export default { } setTimeout(() => { - api.cases.debugStatus(this.dataCase).then((response) => { - if (response.data) { - that.openDebug = true; - } - }); + let that = this; + if (this.dataCase.APP_UID) { + api.cases.debugStatus(this.dataCase) + .then((response) => { + if (response.data) { + that.openDebug = true; + } + }) + .catch((error) => { + that.openDebug = false; + }); + } }, 2000); window.addEventListener("resize", this.handleIframeResize); }, - data() { - return { - openDebug: false, - dataCase: null, - height: "100%", - width: "100%", - diffHeight: 10, - path: "", - }; - }, methods: { classBtn(cls) { return "btn v-btn-request " + cls; diff --git a/resources/assets/js/home/modal/ModalCancelCase.vue b/resources/assets/js/home/modal/ModalCancelCase.vue index 08f0b41e8..dd0493f85 100644 --- a/resources/assets/js/home/modal/ModalCancelCase.vue +++ b/resources/assets/js/home/modal/ModalCancelCase.vue @@ -6,6 +6,15 @@ :title="$t('ID_CANCEL_CASE')" size="md" > + + {{ dataAlert.message }} +

You are tying to cancel the current case. Please be aware this action cannot be undone @@ -47,6 +56,7 @@ diff --git a/resources/assets/js/home/modal/ModalPauseCase.vue b/resources/assets/js/home/modal/ModalPauseCase.vue index 0c057fa42..d5216aefc 100644 --- a/resources/assets/js/home/modal/ModalPauseCase.vue +++ b/resources/assets/js/home/modal/ModalPauseCase.vue @@ -10,6 +10,15 @@ + + {{ dataAlert.message }} + @@ -113,6 +122,12 @@ export default { pauseTime: '' }, minDate: '', + dataAlert: { + dismissSecs: 5, + dismissCountDown: 0, + message: "", + variant: "info" + }, }; }, methods: { @@ -147,21 +162,43 @@ export default { this.data.unpausedTime = this.pauseData.unpauseTime; this.data.nofitfyUser = this.pauseData.nofitfyUser; this.data.reasonPause = this.pauseData.reasonPause; - api.cases.pauseCase(this.data).then((response) => { - if (response.statusText == "OK") { - that.$refs["modal-pause-case"].hide(); - that.$parent.$refs['ellipsis-' + that.data.TAS_UID].hideActionButtons() - if (that.$parent.$refs["vueTable"] !== undefined) { - that.$parent.$refs["vueTable"].getData(); + api.cases.pauseCase(this.data) + .then((response) => { + if (response.statusText == "OK") { + that.$refs["modal-pause-case"].hide(); + that.$parent.$refs['ellipsis-' + that.data.TAS_UID].hideActionButtons() + if (that.$parent.$refs["vueTable"] !== undefined) { + that.$parent.$refs["vueTable"].getData(); + } + if (that.$parent.$refs["vueListView"] !== undefined) { + that.$parent.$refs["vueListView"].getData(); + } + if (that.$parent.$refs["vueCardView"] !== undefined) { + that.$parent.$refs["vueCardView"].getData(); + } } - if (that.$parent.$refs["vueListView"] !== undefined) { - that.$parent.$refs["vueListView"].getData(); - } - if (that.$parent.$refs["vueCardView"] !== undefined) { - that.$parent.$refs["vueCardView"].getData(); - } - } - }); + }) + .catch((error) => { + that.showAlert(error.response.data.error.message, "danger"); + }); + }, + /** + * Show the alert message + * @param {string} message - message to be displayen in the body + * @param {string} type - alert type + */ + showAlert(message, type) { + this.dataAlert.message = message; + this.dataAlert.variant = type || "info"; + this.dataAlert.dismissCountDown = this.dataAlert.dismissSecs; + }, + /** + * Updates the alert dismiss value to update + * dismissCountDown and decrease + * @param {mumber} + */ + countDownChanged(dismissCountDown) { + this.dataAlert.dismissCountDown = dismissCountDown; }, }, }; diff --git a/workflow/engine/classes/Cases.php b/workflow/engine/classes/Cases.php index 5191d4d2a..f8a3f646c 100644 --- a/workflow/engine/classes/Cases.php +++ b/workflow/engine/classes/Cases.php @@ -4196,11 +4196,10 @@ class Cases return false; } } - // Get information about current $index row $delegation = new AppDelegation(); $delRow = $delegation->Load($appUid, $index); - //and creates a new AppDelegation row with the same user, task, process, etc. + // Define the values for create a new index $proUid = $delRow['PRO_UID']; $appUid = $delRow['APP_UID']; $tasUid = $delRow['TAS_UID']; @@ -4209,7 +4208,13 @@ class Cases $application = new Application(); $caseFields = $application->Load($appUid); $caseData = unserialize($caseFields['APP_DATA']); - + // Update to PAUSED to CLOSED + $row = []; + $row['APP_UID'] = $appUid; + $row['DEL_INDEX'] = $index; + $row['DEL_THREAD_STATUS'] = 'CLOSED'; + $row['DEL_THREAD_STATUS_ID'] = 0; + $delegation->update($row); // Create a new delegation $newIndex = $this->newAppDelegation( $proUid, @@ -4228,7 +4233,6 @@ class Cases $delRow['TAS_ID'], $caseData ); - // Update other fields in the recent new appDelegation $row = []; $row['APP_UID'] = $delRow['APP_UID']; @@ -4240,7 +4244,6 @@ class Cases $row['DEL_INIT_DATE'] = date('Y-m-d H:i:s'); $row['DEL_FINISH_DATE'] = null; $delegation->update($row); - // Get the APP_DELAY row with app_uid, del_index and app_type=pause $criteria = new Criteria('workflow'); $criteria->clearSelectColumns(); @@ -4258,12 +4261,9 @@ class Cases $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $dataset->next(); $rowPaused = $dataset->getRow(); - - $caseFields['APP_STATUS'] = $rowPaused['APP_STATUS']; $application->update($caseFields); - - // Update the DEL_INDEX ? in APP_THREAD table? + // Update the APP_THREAD table $rowUpdate = [ 'APP_UID' => $appUid, 'APP_THREAD_INDEX' => $rowPaused['APP_THREAD_INDEX'], @@ -4271,14 +4271,13 @@ class Cases ]; $thread = new AppThread(); $thread->update($rowUpdate); - + // Update the APP_DELAY table $row['APP_DELAY_UID'] = $rowPaused['APP_DELAY_UID']; $row['APP_DISABLE_ACTION_USER'] = $usrUid; $row['APP_DISABLE_ACTION_DATE'] = date('Y-m-d H:i:s'); $delay = new AppDelay(); $rowDelay = $delay->update($row); - - // Update searchindex + // Update solr if ($this->appSolr != null) { $this->appSolr->updateApplicationSearchIndex($appUid); } diff --git a/workflow/engine/classes/model/ListPaused.php b/workflow/engine/classes/model/ListPaused.php index 00620cc81..7ad75dba2 100644 --- a/workflow/engine/classes/model/ListPaused.php +++ b/workflow/engine/classes/model/ListPaused.php @@ -77,7 +77,7 @@ class ListPaused extends BaseListPaused implements ListInterface $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $dataset->next(); $aRow = $dataset->getRow(); - $data['DEL_PREVIOUS_USR_UID'] = $aRow['USR_UID']; + $data['DEL_PREVIOUS_USR_UID'] = isset($aRow['USR_UID']) ? $aRow['USR_UID'] : null ; $criteria = new Criteria(); $criteria->addSelectColumn(UsersPeer::USR_USERNAME); @@ -88,9 +88,9 @@ class ListPaused extends BaseListPaused implements ListInterface $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $dataset->next(); $aRow = $dataset->getRow(); - $data['DEL_PREVIOUS_USR_USERNAME'] = $aRow['USR_USERNAME']; - $data['DEL_PREVIOUS_USR_FIRSTNAME'] = $aRow['USR_FIRSTNAME']; - $data['DEL_PREVIOUS_USR_LASTNAME'] = $aRow['USR_LASTNAME']; + $data['DEL_PREVIOUS_USR_USERNAME'] = isset($aRow['USR_USERNAME']) ? $aRow['USR_USERNAME'] : null; + $data['DEL_PREVIOUS_USR_FIRSTNAME'] = isset($aRow['USR_FIRSTNAME']) ? $aRow['USR_FIRSTNAME'] : null; + $data['DEL_PREVIOUS_USR_LASTNAME'] = isset($aRow['USR_LASTNAME']) ? $aRow['USR_LASTNAME'] : null; $criteria = new Criteria(); $criteria->addSelectColumn(TaskPeer::TAS_TITLE); diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index 247338ab1..5fbf9db3f 100755 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -58375,7 +58375,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_FRI','en','Fri','2014-01-15') , ( 'LABEL','ID_FROM','en','From','2014-01-15') , ( 'LABEL','ID_SENDER','en','Sender','2021-08-13') , -( 'LABEL','ID_FROM_DELEGATION_DATE','en','From Delegation Date','2021-08-31') ; +( 'LABEL','ID_FROM_DELEGATION_DATE','en','From Delegation Date','2021-08-31') , ( 'LABEL','ID_FROM_EMAIL','en','Sender Email','2017-02-21') , ( 'LABEL','ID_FROM_FINISH_DATE','en','From Finish Date','2020-12-16') , ( 'LABEL','ID_FROM_NAME','en','Sender Name','2017-02-21') , diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/AbstractCases.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/AbstractCases.php index 9c23d600f..dbe64bf4d 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/AbstractCases.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/AbstractCases.php @@ -113,6 +113,9 @@ class AbstractCases implements CasesInterface // Filter by specific cases, know as "$appUidCheck" in the old lists classes private $casesUids = []; + + // Filter by Send By + private $sendBy = ''; // Filter range related to the start case date private $startCaseFrom = ''; @@ -749,6 +752,26 @@ class AbstractCases implements CasesInterface return $this->casesUids; } + /** + * Set send by. + * + * @param type $sendBy + */ + public function setSendBy(string $sendBy) + { + $this->sendBy = $sendBy; + } + + /** + * Get send by. + * + * @return string + */ + public function getSendBy() + { + return $this->sendBy; + } + /** * Set Cases Numbers * @@ -1381,6 +1404,10 @@ class AbstractCases implements CasesInterface if (get_class($this) === Inbox::class && !empty($properties['delegateTo'])) { $this->setDelegateTo($properties['delegateTo']); } + // Filter by Send By + if (get_class($this) === Inbox::class && !empty($properties['sendBy'])) { + $this->setSendBy($properties['sendBy']); + } /** Apply filters related to PAUSED */ // Filter date related to delegate from if (get_class($this) === Paused::class && !empty($properties['delegateFrom'])) { @@ -1390,6 +1417,10 @@ class AbstractCases implements CasesInterface if (get_class($this) === Paused::class && !empty($properties['delegateTo'])) { $this->setDelegateTo($properties['delegateTo']); } + // Filter by Send By + if (get_class($this) === Paused::class && !empty($properties['sendBy'])) { + $this->setSendBy($properties['sendBy']); + } /** Apply filters related to UNASSIGNED */ // Filter date related to delegate from if (get_class($this) === Unassigned::class && !empty($properties['delegateFrom'])) { @@ -1399,6 +1430,10 @@ class AbstractCases implements CasesInterface if (get_class($this) === Unassigned::class && !empty($properties['delegateTo'])) { $this->setDelegateTo($properties['delegateTo']); } + // Filter by Send By + if (get_class($this) === Unassigned::class && !empty($properties['sendBy'])) { + $this->setSendBy($properties['sendBy']); + } /** Apply filters related to MY CASES */ // My cases filter: started, in-progress, completed, supervising diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Home.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Home.php index 34b786327..85c812eb1 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Home.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Home.php @@ -78,6 +78,7 @@ class Home $sort = explode(',', $sort); $properties['sort'] = $sort[0]; $properties['dir'] = $sort[1]; + $properties['sendBy'] = $sendBy; $list->setProperties($properties); $result = []; $result['data'] = DateTime::convertUtcToTimeZone($list->getData($callback)); @@ -97,6 +98,7 @@ class Home * @param string $delegateTo * @param string $filterCases * @param string $sort + * @param string $sendBy * @param callable $callback * @return array */ @@ -111,6 +113,7 @@ class Home string $delegateTo = '', string $filterCases = '', string $sort = 'APP_NUMBER,DESC', + string $sendBy = '', callable $callback = null ) { @@ -133,6 +136,7 @@ class Home $sort = explode(',', $sort); $properties['sort'] = $sort[0]; $properties['dir'] = $sort[1]; + $properties['sendBy'] = $sendBy; $list->setProperties($properties); $result = []; $result['data'] = DateTime::convertUtcToTimeZone($list->getData($callback)); @@ -152,6 +156,7 @@ class Home * @param string $delegateTo * @param string $filterCases * @param string $sort + * @param string $sendBy * @param callable $callback * @return array */ @@ -166,6 +171,7 @@ class Home string $delegateTo = '', string $filterCases = '', string $sort = 'APP_NUMBER,DESC', + string $sendBy = '', callable $callback = null ) { @@ -188,6 +194,7 @@ class Home $sort = explode(',', $sort); $properties['sort'] = $sort[0]; $properties['dir'] = $sort[1]; + $properties['sendBy'] = $sendBy; // todo: some queries related to the unassigned are using the USR_UID $list->setUserUid($usrUid); $list->setProperties($properties); @@ -209,6 +216,7 @@ class Home * @param string $delegateTo * @param string $filterCases * @param string $sort + * @param string $sendBy * @param callable $callback * @return array */ @@ -223,6 +231,7 @@ class Home string $delegateTo = '', string $filterCases = '', string $sort = 'APP_NUMBER,DESC', + string $sendBy = '', callable $callback = null ) { @@ -245,6 +254,7 @@ class Home $sort = explode(',', $sort); $properties['sort'] = $sort[0]; $properties['dir'] = $sort[1]; + $properties['sendBy'] = $sendBy; $list->setProperties($properties); $result = []; $result['data'] = DateTime::convertUtcToTimeZone($list->getData($callback)); @@ -349,6 +359,7 @@ class Home * @param string $delegateTo * @param string $filterCases * @param string $sort + * @param string $sendBy * @return array */ public function getCustomInbox( @@ -362,7 +373,8 @@ class Home string $delegateFrom = '', string $delegateTo = '', string $filterCases = '', - string $sort = 'APP_NUMBER,DESC' + string $sort = 'APP_NUMBER,DESC', + string $sendBy = '' ) { $arguments = func_get_args(); @@ -390,6 +402,7 @@ class Home * @param string $delegateTo * @param string $filterCases * @param string $sort + * @param string $sendBy * @return array */ public function getCustomUnassigned( @@ -403,7 +416,8 @@ class Home string $delegateFrom = '', string $delegateTo = '', string $filterCases = '', - string $sort = 'APP_NUMBER,DESC' + string $sort = 'APP_NUMBER,DESC', + string $sendBy = '' ) { $arguments = func_get_args(); @@ -431,6 +445,7 @@ class Home * @param string $delegateTo * @param string $filterCases * @param string $sort + * @param string $sendBy * @return array */ public function getCustomPaused( @@ -444,7 +459,8 @@ class Home string $delegateFrom = '', string $delegateTo = '', string $filterCases = '', - string $sort = 'APP_NUMBER,DESC' + string $sort = 'APP_NUMBER,DESC', + string $sendBy = '' ) { $arguments = func_get_args(); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Inbox.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Inbox.php index b1bfb1f05..e35e1c752 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Inbox.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Inbox.php @@ -91,6 +91,11 @@ class Inbox extends AbstractCases $query->delegateDateTo($this->getDelegateTo()); } + // Specific usrId represented by sendBy. + if (!empty($this->getSendBy())) { + $query->sendBy($this->getSendBy()); + } + return $query; } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Paused.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Paused.php index 371ef1997..a9b74b53a 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Paused.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Paused.php @@ -90,6 +90,11 @@ class Paused extends AbstractCases $query->delegateDateTo($this->getDelegateTo()); } + // Specific usrId represented by sendBy. + if (!empty($this->getSendBy())) { + $query->sendBy($this->getSendBy()); + } + return $query; } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Unassigned.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Unassigned.php index 957e22501..cd5e7b525 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Unassigned.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Unassigned.php @@ -91,6 +91,11 @@ class Unassigned extends AbstractCases $query->delegateDateTo($this->getDelegateTo()); } + // Specific usrId represented by sendBy. + if (!empty($this->getSendBy())) { + $query->sendBy($this->getSendBy()); + } + return $query; } diff --git a/workflow/engine/src/ProcessMaker/Model/Delegation.php b/workflow/engine/src/ProcessMaker/Model/Delegation.php index 22427bfef..c34b79e25 100644 --- a/workflow/engine/src/ProcessMaker/Model/Delegation.php +++ b/workflow/engine/src/ProcessMaker/Model/Delegation.php @@ -1032,6 +1032,24 @@ class Delegation extends Model return $query; } + /** + * Scope sendBy. + * @param \Illuminate\Database\Eloquent\Builder $query + * @param int $usrId + * @return \Illuminate\Database\Eloquent\Builder + */ + public function scopeSendBy($query, int $usrId) + { + $query->where(DB::raw($usrId), function ($sql) { + $sql->from('APP_DELEGATION AS B') + ->select('B.USR_ID') + ->where('B.APP_NUMBER', '=', DB::raw('APP_DELEGATION.APP_NUMBER')) + ->where('B.DEL_INDEX', '=', DB::raw('APP_DELEGATION.DEL_PREVIOUS')) + ->limit(1); + }); + return $query; + } + /** * Get specific cases unassigned that the user can view * diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Home.php b/workflow/engine/src/ProcessMaker/Services/Api/Home.php index 43304e301..5286cbbfb 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Home.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Home.php @@ -101,6 +101,7 @@ class Home extends Api * @param string $delegateTo * @param string $filterCases * @param string $sort + * @param string $sendBy * * @return array * @@ -119,7 +120,8 @@ class Home extends Api string $delegateFrom = '', string $delegateTo = '', string $filterCases = '', - string $sort = 'APP_NUMBER,DESC' + string $sort = 'APP_NUMBER,DESC', + string $sendBy = '' ) { try { @@ -145,6 +147,7 @@ class Home extends Api * @param string $delegateTo * @param string $filterCases * @param string $sort + * @param string $sendBy * * @return array * @@ -163,7 +166,8 @@ class Home extends Api string $delegateFrom = '', string $delegateTo = '', string $filterCases = '', - string $sort = 'APP_NUMBER,DESC' + string $sort = 'APP_NUMBER,DESC', + string $sendBy = '' ) { try { @@ -189,6 +193,7 @@ class Home extends Api * @param string $delegateTo * @param string $filterCases * @param string $sort + * @param string $sendBy * * @return array * @@ -207,7 +212,8 @@ class Home extends Api string $delegateFrom = '', string $delegateTo = '', string $filterCases = '', - string $sort = 'APP_NUMBER,DESC' + string $sort = 'APP_NUMBER,DESC', + string $sendBy = '' ) { try { @@ -269,6 +275,7 @@ class Home extends Api * @param string $delegateTo * @param string $filterCases * @param string $sort + * @param string $sendBy * @return array * @throws RestException * @access protected @@ -285,7 +292,8 @@ class Home extends Api string $delegateFrom = '', string $delegateTo = '', string $filterCases = '', - string $sort = 'APP_NUMBER,DESC' + string $sort = 'APP_NUMBER,DESC', + string $sendBy = '' ) { try { @@ -310,6 +318,7 @@ class Home extends Api * @param string $delegateTo * @param string $filterCases * @param string $sort + * @param string $sendBy * @return array * @throws RestException * @access protected @@ -326,7 +335,8 @@ class Home extends Api string $delegateFrom = '', string $delegateTo = '', string $filterCases = '', - string $sort = 'APP_NUMBER,DESC' + string $sort = 'APP_NUMBER,DESC', + string $sendBy = '' ) { try { @@ -351,6 +361,7 @@ class Home extends Api * @param string $delegateTo * @param string $filterCases * @param string $sort + * @param string $sendBy * @return array * @throws RestException * @access protected @@ -367,7 +378,8 @@ class Home extends Api string $delegateFrom = '', string $delegateTo = '', string $filterCases = '', - string $sort = 'APP_NUMBER,DESC' + string $sort = 'APP_NUMBER,DESC', + string $sendBy = '' ) { try {