diff --git a/resources/assets/js/components/home/debugger/Debugger.vue b/resources/assets/js/components/home/debugger/Debugger.vue index 4a641892a..747c1d51c 100644 --- a/resources/assets/js/components/home/debugger/Debugger.vue +++ b/resources/assets/js/components/home/debugger/Debugger.vue @@ -142,7 +142,8 @@ export default { \ No newline at end of file diff --git a/resources/assets/js/components/search/AdvancedFilter.vue b/resources/assets/js/components/search/AdvancedFilter.vue index 5dcb415be..69521ec66 100644 --- a/resources/assets/js/components/search/AdvancedFilter.vue +++ b/resources/assets/js/components/search/AdvancedFilter.vue @@ -339,7 +339,7 @@ export default { tagPrefix: this.$i18n.t('ID_USER'), items:[ { - id: "userId", + id: "user", value: "", options: [], placeholder: this.$i18n.t('ID_USER_NAME') diff --git a/resources/assets/js/components/search/popovers/CurrentUser.vue b/resources/assets/js/components/search/popovers/CurrentUser.vue index f8d29ea2e..a0ee33dab 100644 --- a/resources/assets/js/components/search/popovers/CurrentUser.vue +++ b/resources/assets/js/components/search/popovers/CurrentUser.vue @@ -11,7 +11,7 @@ diff --git a/resources/assets/js/home/AdvancedSearch.vue b/resources/assets/js/home/AdvancedSearch.vue index 588f25c4d..9811275bd 100644 --- a/resources/assets/js/home/AdvancedSearch.vue +++ b/resources/assets/js/home/AdvancedSearch.vue @@ -270,20 +270,23 @@ export default { }, formatUser(data) { var i, - dataFormat = []; + dataFormat = [], + userDataFormat; for (i = 0; i < data.length; i += 1) { - dataFormat.push({ - USERNAME_DISPLAY_FORMAT: utils.userNameDisplayFormat({ + userDataFormat = utils.userNameDisplayFormat({ userName: data[i].usr_firstname, firstName: data[i].usr_lastname, lastName: data[i].usr_username, format: window.config.FORMATS.format || null - }), + }); + dataFormat.push({ + USERNAME_DISPLAY_FORMAT: userDataFormat !== "" ? userDataFormat : this.$i18n.t("ID_UNASSIGNED"), EMAIL: data[i].user_tooltip.usr_email, POSITION: data[i].user_tooltip.usr_position, - AVATAR: window.config.SYS_SERVER + + AVATAR: userDataFormat !== "" ? window.config.SYS_SERVER + window.config.SYS_URI + - `users/users_ViewPhotoGrid?pUID=${data[i].user_id}` + `users/users_ViewPhotoGrid?pUID=${data[i].user_id}` : "", + UNASSIGNED: userDataFormat !== "" ? true : false }); } return dataFormat; diff --git a/resources/assets/js/home/CaseDetail.vue b/resources/assets/js/home/CaseDetail.vue index 55c709a00..fb218fd16 100644 --- a/resources/assets/js/home/CaseDetail.vue +++ b/resources/assets/js/home/CaseDetail.vue @@ -509,7 +509,7 @@ export default { DEL_INDEX: data.row.DEL_INDEX, PRO_UID: data.row.PRO_UID, TAS_UID: data.row.TAS_UID, - ACTION: "todo", + ACTION: this.dataCase.ACTION || "todo" }); this.$emit("onUpdatePage", "XCase"); }, diff --git a/resources/assets/js/home/Draft.vue b/resources/assets/js/home/Draft.vue index 99bd65bdd..cf32f72d4 100644 --- a/resources/assets/js/home/Draft.vue +++ b/resources/assets/js/home/Draft.vue @@ -252,6 +252,7 @@ export default { PRO_UID: item.PRO_UID, TAS_UID: item.TAS_UID, APP_NUMBER: item.CASE_NUMBER, + ACTION: "draft" }); that.$emit("onUpdatePage", "case-detail"); }); diff --git a/resources/assets/js/home/MyCases.vue b/resources/assets/js/home/MyCases.vue index 823f8bd2e..12a55bffa 100644 --- a/resources/assets/js/home/MyCases.vue +++ b/resources/assets/js/home/MyCases.vue @@ -207,6 +207,7 @@ export default { PRO_UID: item.PRO_UID, TAS_UID: item.TAS_UID, APP_NUMBER: item.CASE_NUMBER, + ACTION: that.filterHeader === "SUPERVISING" ? "to_revise": "todo" }); that.$emit("onUpdatePage", "case-detail"); }); diff --git a/resources/assets/js/home/Todo.vue b/resources/assets/js/home/Todo.vue index 3f41dd609..e025695f1 100644 --- a/resources/assets/js/home/Todo.vue +++ b/resources/assets/js/home/Todo.vue @@ -274,6 +274,7 @@ export default { PRO_UID: item.PRO_UID, TAS_UID: item.TAS_UID, APP_NUMBER: item.CASE_NUMBER, + ACTION: "todo" }); that.$emit("onUpdatePage", "case-detail"); }); diff --git a/resources/assets/js/home/XCase.vue b/resources/assets/js/home/XCase.vue index 5bdc05094..85a2e3afb 100644 --- a/resources/assets/js/home/XCase.vue +++ b/resources/assets/js/home/XCase.vue @@ -37,7 +37,7 @@ export default { this.path = window.config.SYS_SERVER + window.config.SYS_URI + - `cases/open?APP_UID=${this.dataCase.APP_UID}&DEL_INDEX=${this.dataCase.DEL_INDEX}&action=${this.dataCase.ACTION}`; + `cases/open?APP_UID=${this.dataCase.APP_UID}&DEL_INDEX=${this.dataCase.DEL_INDEX}&TAS_UID=${this.dataCase.TAS_UID}&action=${this.dataCase.ACTION}`; } setTimeout(() => { diff --git a/resources/assets/js/utils/utils.js b/resources/assets/js/utils/utils.js index 3b42aad92..0651f365f 100644 --- a/resources/assets/js/utils/utils.js +++ b/resources/assets/js/utils/utils.js @@ -17,7 +17,7 @@ export default { aux = aux.replace('@userName',defaultValues.userName); aux = aux.replace('@firstName',defaultValues.firstName); aux = aux.replace('@lastName',defaultValues.lastName); - return aux; + return aux.trim(); }, /** * Parse an url string and prepare an object of the parameters diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po index 10defcc9c..a681dffc1 100755 --- a/workflow/engine/content/translations/english/processmaker.en.po +++ b/workflow/engine/content/translations/english/processmaker.en.po @@ -2353,6 +2353,12 @@ msgstr "Body" msgid "App Uid" msgstr "App Uid" +# TRANSLATION +# LABEL/ID_ARE_YOU_SURE_CLAIM_TASK +#: LABEL/ID_ARE_YOU_SURE_CLAIM_TASK +msgid "Are you sure want to claim the task?" +msgstr "Are you sure want to claim the task?" + # TRANSLATION # LABEL/ID_ARE_YOU_SURE_RESEND #: LABEL/ID_ARE_YOU_SURE_RESEND @@ -2371,6 +2377,12 @@ msgstr "Are you sure to delete the matched attribute \"{0}\", please confirm?" msgid "Are you sure to delete the connection \"{0}\", please confirm?" msgstr "Are you sure to delete the connection \"{0}\", please confirm?" +# TRANSLATION +# LABEL/ID_ARE_YOU_SURE_UNPAUSE_TASK +#: LABEL/ID_ARE_YOU_SURE_UNPAUSE_TASK +msgid "Are you sure want to unpause the task?" +msgstr "Are you sure want to unpause the task?" + # TRANSLATION # LABEL/ID_ARRAY_VARIABLES_EMPTY #: LABEL/ID_ARRAY_VARIABLES_EMPTY @@ -19406,8 +19418,8 @@ msgstr "More Info" # TRANSLATION # LABEL/ID_MORE_INFORMATION #: LABEL/ID_MORE_INFORMATION -msgid "more information" -msgstr "more information" +msgid "More Information" +msgstr "More Information" # TRANSLATION # LABEL/ID_MORE_THAN @@ -52713,21 +52725,8 @@ msgstr "Pending Tasks" msgid "Send email to participants" msgstr "Send email to participants" - # TRANSLATION # LABEL/ID_TRYING_CANCEL #: LABEL/ID_TRYING_CANCEL msgid "You are tying to cancel the current case. Please be aware this action cannot be undone" -msgstr "You are tying to cancel the current case. Please be aware this action cannot be undone" - -# TRANSLATION -# LABEL/ID_ARE_YOU_SURE_UNPAUSE_TASK -#: LABEL/ID_ARE_YOU_SURE_UNPAUSE_TASK -msgid "Are you sure want to unpause the task?" -msgstr "Are you sure want to unpause the task?" - -# TRANSLATION -# LABEL/ID_ARE_YOU_SURE_CLAIM_TASK -#: LABEL/ID_ARE_YOU_SURE_CLAIM_TASK -msgid "Are you sure want to claim the task?" -msgstr "Are you sure want to claim the task?" \ No newline at end of file +msgstr "You are tying to cancel the current case. Please be aware this action cannot be undone" \ No newline at end of file diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index 84eed35dc..bc971bac1 100755 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -57195,11 +57195,11 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_APPLY_CHANGES','en','Apply changes','2014-01-15') , ( 'LABEL','ID_APP_MSG_BODY','en','Body','2014-01-15') , ( 'LABEL','ID_APP_UID','en','App Uid','2015-09-15') , +( 'LABEL','ID_ARE_YOU_SURE_CLAIM_TASK','en','Are you sure want to claim the task?','2021-01-26') , ( 'LABEL','ID_ARE_YOU_SURE_RESEND','en','Are you sure that you want to resend this message','2014-01-15') , -( 'LABEL','ID_ARE_YOU_SURE_UNPAUSE_TASK','en','Are you sure want to unpause the task?','2020-12-01') , -( 'LABEL','ID_ARE_YOU_SURE_CLAIM_TASK','en','Are you sure want to claim the task?','2020-12-01') , ( 'LABEL','ID_ARE_YOU_SURE_TO_DELETE_ATTRIBUTE_PLEASE_CONFIRM','en','Are you sure to delete the matched attribute "{0}", please confirm?','2020-12-10') , ( 'LABEL','ID_ARE_YOU_SURE_TO_DELETE_CONNECTION_PLEASE_CONFIRM','en','Are you sure to delete the connection "{0}", please confirm?','2020-12-10') , +( 'LABEL','ID_ARE_YOU_SURE_UNPAUSE_TASK','en','Are you sure want to unpause the task?','2021-01-26') , ( 'LABEL','ID_ARRAY_VARIABLES_EMPTY','en','Array of variables is empty','2014-01-15') , ( 'LABEL','ID_ASSIGN','en','Assign','2014-01-15') , ( 'LABEL','ID_ASSIGNED_FIEDS','en','ASSIGNED FIELDS','2014-01-15') , @@ -60122,7 +60122,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MONTH_ABB_8','en','Aug','2014-01-15') , ( 'LABEL','ID_MONTH_ABB_9','en','Sep','2014-01-15') , ( 'LABEL','ID_MORE_INFO','en','More Info','2014-01-15') , -( 'LABEL','ID_MORE_INFORMATION','en','more information','2014-01-15') , +( 'LABEL','ID_MORE_INFORMATION','en','More Information','2021-01-26') , ( 'LABEL','ID_MORE_THAN','en','more than','2015-03-23') , ( 'LABEL','ID_MOST_AT_LEAST_3_DAY','en','You must define at least 3 Working Days!','2014-01-15') , ( 'LABEL','ID_MOVE','en','Move','2015-09-17') , diff --git a/workflow/engine/methods/authSources/ldapAdvancedProxy.php b/workflow/engine/methods/authSources/ldapAdvancedProxy.php index e2a7b13a7..7be576491 100644 --- a/workflow/engine/methods/authSources/ldapAdvancedProxy.php +++ b/workflow/engine/methods/authSources/ldapAdvancedProxy.php @@ -326,9 +326,14 @@ switch ($function) { $aUser['sDN'] = str_replace($match, $newMatch, $aUser['sDN']); } $aData['USR_AUTH_USER_DN'] = $aUser['sDN']; + + $usrRole = 'PROCESSMAKER_OPERATOR'; + if (!empty($aFields['AUTH_SOURCE_DATA']['USR_ROLE'])) { + $usrRole = $aFields['AUTH_SOURCE_DATA']['USR_ROLE']; + } try { - $sUserUID = $RBAC->createUser($aData, 'PROCESSMAKER_OPERATOR', $aFields['AUTH_SOURCE_NAME']); + $sUserUID = $RBAC->createUser($aData, $usrRole, $aFields['AUTH_SOURCE_NAME']); $usersCreated .= $aData['USR_USERNAME'] . ' '; $countUsers++; } catch (Exception $oError) { @@ -340,10 +345,7 @@ switch ($function) { $aData['USR_STATUS'] = (isset($aUser['USR_STATUS'])) ? $aUser['USR_STATUS'] : 'ACTIVE'; $aData['USR_UID'] = $sUserUID; - $aData['USR_ROLE'] = 'PROCESSMAKER_OPERATOR'; - if (isset($aFields['AUTH_SOURCE_DATA']['USR_ROLE'])) { - $aData['USR_ROLE'] = $aFields['AUTH_SOURCE_DATA']['USR_ROLE']; - } + $aData['USR_ROLE'] = $usrRole; $calendarObj = new Calendar(); $calendarObj->assignCalendarTo($sUserUID, '00000000000000000000000000000001', 'USER'); diff --git a/workflow/engine/methods/cases/ajaxListener.php b/workflow/engine/methods/cases/ajaxListener.php index 2eb4e250e..e009e8547 100644 --- a/workflow/engine/methods/cases/ajaxListener.php +++ b/workflow/engine/methods/cases/ajaxListener.php @@ -577,7 +577,7 @@ class Ajax $noteContent = addslashes($_POST['NOTE_REASON']); // Define the Case for register a case note $cases = new BmCases(); - $response = $cases->addNote($appUid, $usrUid, $noteContent); + $response = $cases->addNote($appUid, $usrUid, $noteContent, $_POST['NOTIFY_CANCEL']); } } else { $result->status = false; diff --git a/workflow/engine/methods/cases/cases_Scheduler_Log_Detail.php b/workflow/engine/methods/cases/cases_Scheduler_Log_Detail.php index 1a0015a3c..ec96c16cb 100644 --- a/workflow/engine/methods/cases/cases_Scheduler_Log_Detail.php +++ b/workflow/engine/methods/cases/cases_Scheduler_Log_Detail.php @@ -1,58 +1,8 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - */ + try { global $RBAC; - /* - switch ($RBAC->userCanAccess('PM_FACTORY')) - { - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } - */ - - /* - $aFields['MESSAGE0'] = str_replace("\r\n","
",G::LoadTranslation('ID_USER_REGISTERED')) . '!'; - $aFields['MESSAGE1'] = str_replace("\r\n","
",G::LoadTranslation('ID_MSG_ERROR_USR_USERNAME')); - $aFields['MESSAGE2'] = str_replace("\r\n","
",G::LoadTranslation('ID_MSG_ERROR_DUE_DATE')); - $aFields['MESSAGE3'] = str_replace("\r\n","
",G::LoadTranslation('ID_NEW_PASS_SAME_OLD_PASS')); - $aFields['MESSAGE4'] = str_replace("\r\n","
",G::LoadTranslation('ID_MSG_ERROR_USR_FIRSTNAME')); - $aFields['MESSAGE5'] = str_replace("\r\n","
",G::LoadTranslation('ID_MSG_ERROR_USR_LASTNAME')); - // the default role variable sets the value that will be showed as the default for the role field. - $aFields['DEFAULT_ROLE'] = 'PROCESSMAKER_OPERATOR'; - $aFields['START_DATE'] = date('Y-m-d'); - $aFields['END_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 5)); - $aFields['USR_DUE_DATE']= date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 1)); - */ if (! class_exists( 'LogCasesSchedulerPeer' )) { require_once ('classes/model/LogCasesScheduler.php'); } diff --git a/workflow/engine/methods/cases/cases_Scheduler_New.php b/workflow/engine/methods/cases/cases_Scheduler_New.php index 70059b86a..1d05e373c 100644 --- a/workflow/engine/methods/cases/cases_Scheduler_New.php +++ b/workflow/engine/methods/cases/cases_Scheduler_New.php @@ -1,58 +1,8 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - */ + try { global $RBAC; - /* - switch ($RBAC->userCanAccess('PM_FACTORY')) - { - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - } - */ - /* - $aFields['MESSAGE0'] = str_replace("\r\n","
",G::LoadTranslation('ID_USER_REGISTERED')) . '!'; - $aFields['MESSAGE1'] = str_replace("\r\n","
",G::LoadTranslation('ID_MSG_ERROR_USR_USERNAME')); - $aFields['MESSAGE2'] = str_replace("\r\n","
",G::LoadTranslation('ID_MSG_ERROR_DUE_DATE')); - $aFields['MESSAGE3'] = str_replace("\r\n","
",G::LoadTranslation('ID_NEW_PASS_SAME_OLD_PASS')); - $aFields['MESSAGE4'] = str_replace("\r\n","
",G::LoadTranslation('ID_MSG_ERROR_USR_FIRSTNAME')); - $aFields['MESSAGE5'] = str_replace("\r\n","
",G::LoadTranslation('ID_MSG_ERROR_USR_LASTNAME')); - // the default role variable sets the value that will be showed as the default for the role field. - $aFields['DEFAULT_ROLE'] = 'PROCESSMAKER_OPERATOR'; - $aFields['START_DATE'] = date('Y-m-d'); - $aFields['END_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 5)); - $aFields['USR_DUE_DATE']= date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 1)); - */ - require_once 'classes/model/CaseScheduler.php'; require_once 'classes/model/Process.php'; require_once 'classes/model/Task.php'; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/AbstractCases.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/AbstractCases.php index c0229587f..b1ddc8f05 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/AbstractCases.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/AbstractCases.php @@ -1065,12 +1065,13 @@ class AbstractCases implements CasesInterface * * @param string $dueDate * @param string $statusThread + * @param string $dateToCompare * * @return int */ - public function getTaskColor(string $dueDate, string $statusThread = '') + public function getTaskColor(string $dueDate, string $statusThread = '', $dateToCompare = 'now') { - $currentDate = new DateTime('now'); + $currentDate = new DateTime($dateToCompare); $dueDate = new DateTime($dueDate); if ($currentDate > $dueDate) { // Overdue: When the current date is mayor to the due date of the case @@ -1097,10 +1098,12 @@ class AbstractCases implements CasesInterface * * @param string $pendingJson * @param bool $onlyTask + * @param string $statusThread + * @param string $dateToCompare * * @return int */ - public function prepareTaskPending($pendingJson, $onlyTask = true) + public function prepareTaskPending($pendingJson, $onlyTask = true, $statusThread = '', $dateToCompare = '') { $taskPending = json_decode($pendingJson, true); $result = []; @@ -1117,9 +1120,11 @@ class AbstractCases implements CasesInterface } if ($key === 'due_date') { $threadTasks[$i][$key] = $row; - $threadTasks[$i]['delay'] = getDiffBetweenDates($row, date("Y-m-d H:i:s")); + // Get the end date for calculate the delay + $endDate = ($dateToCompare !== 'now') ? $endDate = $dateToCompare : date("Y-m-d H:i:s"); + $threadTasks[$i]['delay'] = getDiffBetweenDates($row, $endDate); // Get task color label - $threadTasks[$i]['tas_color'] = (!empty($row)) ? $this->getTaskColor($row) : ''; + $threadTasks[$i]['tas_color'] = (!empty($row)) ? $this->getTaskColor($row, $statusThread, $dateToCompare) : ''; $threadTasks[$i]['tas_color_label'] = (!empty($row)) ? self::TASK_COLORS[$threadTasks[$i]['tas_color']] : ''; $threadTasks[$i]['tas_status'] = self::TASK_STATUS[$threadTasks[$i]['tas_color']]; } @@ -1170,6 +1175,8 @@ class AbstractCases implements CasesInterface { $result = []; $status = ''; + $finishDate = 'now'; + $dateToCompare = date("Y-m-d H:i:s"); // Define the task status if ($thread['TAS_ASSIGN_TYPE'] === 'SELF_SERVICE') { $status = 'UNASSIGNED'; @@ -1177,12 +1184,16 @@ class AbstractCases implements CasesInterface if ($thread['APP_STATUS'] === 'DRAFT') { $status = 'DRAFT'; } + if ($thread['APP_STATUS'] === 'COMPLETED') { + $finishDate = $thread['APP_FINISH_DATE']; + $dateToCompare = $finishDate; + } // Define the thread information $result['tas_title'] = $thread['TAS_TITLE']; $result['user_id'] = $thread['USR_ID']; $result['due_date'] = $thread['DEL_TASK_DUE_DATE']; - $result['delay'] = getDiffBetweenDates($thread['DEL_TASK_DUE_DATE'], date("Y-m-d H:i:s")); - $result['tas_color'] = (!empty($thread['DEL_TASK_DUE_DATE'])) ? $this->getTaskColor($thread['DEL_TASK_DUE_DATE'], $status) : ''; + $result['delay'] = getDiffBetweenDates($thread['DEL_TASK_DUE_DATE'], $dateToCompare); + $result['tas_color'] = (!empty($thread['DEL_TASK_DUE_DATE'])) ? $this->getTaskColor($thread['DEL_TASK_DUE_DATE'], $status, $finishDate) : ''; $result['tas_color_label'] = (!empty($result['tas_color'])) ? self::TASK_COLORS[$result['tas_color']] : ''; $result['tas_status'] = self::TASK_STATUS[$result['tas_color']]; $result['unassigned'] = ($status === 'UNASSIGNED' ? true : false); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Participated.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Participated.php index 93c57347e..1445d7716 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Participated.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Participated.php @@ -156,6 +156,7 @@ class Participated extends AbstractCases $thread['TAS_TITLE'] = $item['TAS_TITLE']; $thread['USR_ID'] = $item['USR_ID']; $thread['DEL_TASK_DUE_DATE'] = $item['DEL_TASK_DUE_DATE']; + $thread['APP_FINISH_DATE'] = $item['APP_FINISH_DATE']; $thread['TAS_ASSIGN_TYPE'] = $item['TAS_ASSIGN_TYPE']; $thread['APP_STATUS'] = $item['APP_STATUS']; // Define data according to the filters diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Search.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Search.php index 390e74a13..85abbff0d 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Search.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Search.php @@ -181,12 +181,13 @@ class Search extends AbstractCases // Calculate duration $startDate = (string)$item['APP_CREATE_DATE']; $endDate = !empty($item['APP_FINISH_DATE']) ? $item['APP_FINISH_DATE'] : date("Y-m-d H:i:s"); + $dateToCompare = !empty($item['APP_FINISH_DATE']) ? $item['APP_FINISH_DATE'] : 'now'; $item['DURATION'] = getDiffBetweenDates($startDate, $endDate); // Get total case notes $item['CASE_NOTES_COUNT'] = AppNotes::total($item['APP_NUMBER']); // Get the detail related to the open thread if (!empty($item['THREADS'])) { - $result = $this->prepareTaskPending($item['THREADS'], false); + $result = $this->prepareTaskPending($item['THREADS'], false, $item['APP_STATUS'], $dateToCompare); $item['THREAD_TASKS'] = !empty($result['THREAD_TASKS']) ? $result['THREAD_TASKS'] : []; $item['THREAD_USERS'] = !empty($result['THREAD_USERS']) ? $result['THREAD_USERS'] : []; $item['THREAD_TITLES'] = !empty($result['THREAD_TITLES']) ? $result['THREAD_TITLES'] : []; diff --git a/workflow/engine/src/ProcessMaker/Model/Process.php b/workflow/engine/src/ProcessMaker/Model/Process.php index 03872681c..c3d80d0eb 100644 --- a/workflow/engine/src/ProcessMaker/Model/Process.php +++ b/workflow/engine/src/ProcessMaker/Model/Process.php @@ -375,8 +375,11 @@ class Process extends Model // Apply the date format defined in environment if (!empty($mask)) { - $item['PRO_CREATE_DATE_LABEL'] = $item['PRO_CREATE_DATE']->format($mask); - $item['PRO_UPDATE_DATE_LABEL'] = $item['PRO_UPDATE_DATE']->format($mask); + $item['PRO_CREATE_DATE_LABEL'] = !empty($item['PRO_CREATE_DATE']) ? $item['PRO_CREATE_DATE']->format($mask) : ''; + $item['PRO_UPDATE_DATE_LABEL'] = !empty($item['PRO_UPDATE_DATE']) ? $item['PRO_UPDATE_DATE']->format($mask) : ''; + } else { + $item['PRO_CREATE_DATE_LABEL'] = !empty($item['PRO_CREATE_DATE']) ? $item['PRO_CREATE_DATE']->format('Y-m-d H:i:s') : ''; + $item['PRO_UPDATE_DATE_LABEL'] = !empty($item['PRO_UPDATE_DATE']) ? $item['PRO_UPDATE_DATE']->format('Y-m-d H:i:s') : ''; } return $item; diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Home.php b/workflow/engine/src/ProcessMaker/Services/Api/Home.php index 65922ddaf..54fb5277c 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Home.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Home.php @@ -19,6 +19,7 @@ use ProcessMaker\Model\Process; use ProcessMaker\Model\User; use ProcessMaker\Model\Task; use ProcessMaker\Services\Api; +use ProcessMaker\Util\DateTime; use RBAC; use stdClass; @@ -86,7 +87,7 @@ class Home extends Api $properties['dir'] = $sort[1]; $list->setProperties($properties); $result = []; - $result['data'] = $list->getData(); + $result['data'] = DateTime::convertUtcToTimeZone($list->getData()); $result['total'] = $list->getPagingCounters(); return $result; } catch (Exception $e) { @@ -141,7 +142,7 @@ class Home extends Api $properties['dir'] = $sort[1]; $list->setProperties($properties); $result = []; - $result['data'] = $list->getData(); + $result['data'] = DateTime::convertUtcToTimeZone($list->getData()); $result['total'] = $list->getPagingCounters(); return $result; } catch (Exception $e) { @@ -198,7 +199,7 @@ class Home extends Api $list->setUserUid($usrUid); $list->setProperties($properties); $result = []; - $result['data'] = $list->getData(); + $result['data'] = DateTime::convertUtcToTimeZone($list->getData()); $result['total'] = $list->getPagingCounters(); return $result; } catch (Exception $e) { @@ -253,7 +254,7 @@ class Home extends Api $properties['dir'] = $sort[1]; $list->setProperties($properties); $result = []; - $result['data'] = $list->getData(); + $result['data'] = DateTime::convertUtcToTimeZone($list->getData()); $result['total'] = $list->getPagingCounters(); return $result; } catch (Exception $e) { @@ -334,7 +335,7 @@ class Home extends Api $list->setUserUid($usrUid); $list->setParticipatedStatus($filter); $list->setProperties($properties); - $result['data'] = $list->getData(); + $result['data'] = DateTime::convertUtcToTimeZone($list->getData()); $result['total'] = $list->getPagingCounters(); break; case 'SUPERVISING': @@ -343,7 +344,7 @@ class Home extends Api // todo: some queries related to the PROCESS_USER are using the USR_UID $list->setUserUid($usrUid); $list->setProperties($properties); - $result['data'] = $list->getData(); + $result['data'] = DateTime::convertUtcToTimeZone($list->getData()); $result['total'] = $list->getPagingCounters(); break; } @@ -483,7 +484,7 @@ class Home extends Api $properties['dir'] = $sort[1]; $list->setProperties($properties); $result = []; - $result['data'] = $list->getData(); + $result['data'] = DateTime::convertUtcToTimeZone($list->getData()); // We will to enable always the pagination $result['total'] = $list->getCounter(); return $result;