diff --git a/resources/assets/js/admin/settings/customCaseList/CaseListSketch.vue b/resources/assets/js/admin/settings/customCaseList/CaseListSketch.vue index b19aff3ef..cebf88d51 100644 --- a/resources/assets/js/admin/settings/customCaseList/CaseListSketch.vue +++ b/resources/assets/js/admin/settings/customCaseList/CaseListSketch.vue @@ -251,7 +251,7 @@ elem.set === true); this.dataCaseList.forEach(function (value) { //Force to false in process_category & process_name - if (value.enableFilter && (value.field != "process_category" && value.field != "process_name" )) { + if (value.enableFilter && !that.disabledField(value.field)) { that.enabledFilterRows.push(value.field); } }); @@ -741,6 +741,10 @@ export default { columns.push('actions'); columns.unshift('detail'); return columns + }, + disabledField(field){ + const fields = [ "due_date" , "process_category" , "process_name" , "priority" ]; + return !(fields.indexOf(field) == -1); } }, }; diff --git a/resources/assets/js/home/CustomCaseList/CustomCaseList.vue b/resources/assets/js/home/CustomCaseList/CustomCaseList.vue index 190a510e5..0cf0487bf 100644 --- a/resources/assets/js/home/CustomCaseList/CustomCaseList.vue +++ b/resources/assets/js/home/CustomCaseList/CustomCaseList.vue @@ -127,7 +127,7 @@ {{ props["item"]["CASE_NUMBER"] }} - + {{ props["item"]["THREAD_TITLE"] }} @@ -184,7 +184,7 @@ {{ props["item"]["CASE_NUMBER"] }} - + {{ props["item"]["THREAD_TITLE"] }} @@ -398,7 +398,7 @@ export default { }, itemMap: { case_number: "caseNumber", - task_title: "taskTitle", + task: "taskTitle", thread_title: "caseTitle", delegation_date: "delegationDate", send_by: "bySendBy", @@ -849,7 +849,7 @@ export default { product.optionLabel = item.name; product.tagPrefix = item.name; if (product.items && product.items[0]) { - product.items[0].id = item.field; + product.items[0].id = item.idFilter?item.idFilter : item.field; } product.placeholder = ""; return product; diff --git a/resources/assets/js/home/CustomCaseList/defaultMixins.js b/resources/assets/js/home/CustomCaseList/defaultMixins.js index e79dcfb2c..383308894 100644 --- a/resources/assets/js/home/CustomCaseList/defaultMixins.js +++ b/resources/assets/js/home/CustomCaseList/defaultMixins.js @@ -11,7 +11,7 @@ export default { dataCasesList: [], defaultColumns: [ "case_number", - "thread_title", + "case_title", "process_name", "task", "send_by", @@ -69,7 +69,7 @@ export default { }, headings: { case_number: this.$i18n.t("ID_MYCASE_NUMBER"), - thread_title: this.$i18n.t('ID_CASE_THREAD_TITLE'), + case_title: this.$i18n.t('ID_CASE_THREAD_TITLE'), process_name: this.$i18n.t("ID_PROCESS_NAME"), task: this.$i18n.t("ID_TASK"), send_by: this.$i18n.t("ID_SEND_BY"), diff --git a/resources/assets/js/home/Draft/defaultMixins.js b/resources/assets/js/home/Draft/defaultMixins.js index 77160c820..bff9bea95 100644 --- a/resources/assets/js/home/Draft/defaultMixins.js +++ b/resources/assets/js/home/Draft/defaultMixins.js @@ -71,7 +71,7 @@ export default { "task" ], requestFunction(data) { - return that.getCases(data); + return that.getCasesViewMore(data); }, requestFunctionViewMore(data) { return that.getCasesViewMore(data); @@ -83,31 +83,6 @@ export default { }, methods: { - /** - * Get cases for Vue Card View - */ - getCases(data) { - let that = this, - dt, - filters = {}; - _.forIn(this.filters, function (item, key) { - filters[item.filterVar] = item.value; - }); - return new Promise((resolutionFunc, rejectionFunc) => { - api.cases - .draft(filters) - .then((response) => { - dt = that.formatDataResponse(response.data.data); - resolutionFunc({ - data: dt, - count: response.data.total, - }); - }) - .catch((e) => { - rejectionFunc(e); - }); - }); - }, /** * Get cases for Vue Card View */ diff --git a/resources/assets/js/home/Inbox/defaultMixins.js b/resources/assets/js/home/Inbox/defaultMixins.js index 48d73637e..8af1d64c1 100644 --- a/resources/assets/js/home/Inbox/defaultMixins.js +++ b/resources/assets/js/home/Inbox/defaultMixins.js @@ -74,7 +74,7 @@ export default { "send_by", ], requestFunction(data) { - return that.getCases(data); + return that.getCasesViewMore(data); }, requestFunctionViewMore(data) { return that.getCasesViewMore(data); @@ -86,31 +86,6 @@ export default { }, methods: { - /** - * Get cases for Vue Card View - */ - getCases(data) { - let that = this, - dt, - filters = {}; - _.forIn(this.filters, function (item, key) { - filters[item.filterVar] = item.value; - }); - return new Promise((resolutionFunc, rejectionFunc) => { - api.cases - .todo(filters) - .then((response) => { - dt = that.formatDataResponse(response.data.data); - resolutionFunc({ - data: dt, - count: response.data.total, - }); - }) - .catch((e) => { - rejectionFunc(e); - }); - }); - }, /** * Get cases for Vue Card View */ diff --git a/resources/assets/js/home/Paused/defaultMixins.js b/resources/assets/js/home/Paused/defaultMixins.js index c01e6b9a0..d5cdc3afd 100644 --- a/resources/assets/js/home/Paused/defaultMixins.js +++ b/resources/assets/js/home/Paused/defaultMixins.js @@ -73,7 +73,7 @@ export default { "send_by", ], requestFunction(data) { - return that.getCases(data); + return that.getCasesViewMore(data); }, requestFunctionViewMore(data) { return that.getCasesViewMore(data); @@ -85,31 +85,6 @@ export default { }, methods: { - /** - * Get cases for Vue Card View - */ - getCases(data) { - let that = this, - dt, - filters = {}; - _.forIn(this.filters, function (item, key) { - filters[item.filterVar] = item.value; - }); - return new Promise((resolutionFunc, rejectionFunc) => { - api.cases - .paused(filters) - .then((response) => { - dt = that.formatDataResponse(response.data.data); - resolutionFunc({ - data: dt, - count: response.data.total, - }); - }) - .catch((e) => { - rejectionFunc(e); - }); - }); - }, /** * Get cases for Vue Card View */ diff --git a/resources/assets/js/home/Unassigned/defaultMixins.js b/resources/assets/js/home/Unassigned/defaultMixins.js index 40e490cab..7d1a5cb68 100644 --- a/resources/assets/js/home/Unassigned/defaultMixins.js +++ b/resources/assets/js/home/Unassigned/defaultMixins.js @@ -73,7 +73,7 @@ export default { "send_by", ], requestFunction(data) { - return that.getCases(data); + return that.getCasesViewMore(data); }, requestFunctionViewMore(data) { return that.getCasesViewMore(data); @@ -85,31 +85,6 @@ export default { }, methods: { - /** - * Get cases for Vue Card View - */ - getCases(data) { - let that = this, - dt, - filters = {}; - _.forIn(this.filters, function (item, key) { - filters[item.filterVar] = item.value; - }); - return new Promise((resolutionFunc, rejectionFunc) => { - api.cases - .unassigned(filters) - .then((response) => { - dt = that.formatDataResponse(response.data.data); - resolutionFunc({ - data: dt, - count: response.data.total, - }); - }) - .catch((e) => { - rejectionFunc(e); - }); - }); - }, /** * Get cases for Vue Card View */ diff --git a/workflow/engine/classes/LdapAdvanced.php b/workflow/engine/classes/LdapAdvanced.php index ece83ae1e..d478f1143 100644 --- a/workflow/engine/classes/LdapAdvanced.php +++ b/workflow/engine/classes/LdapAdvanced.php @@ -2994,6 +2994,7 @@ class LdapAdvanced $this->arrayUserUpdateChecked[$username] = 1; $arrayUserDataUpdate = []; + $extendedData = []; foreach ($arrayAttributesToSync as $key => $value) { $fieldName = $key; @@ -3015,12 +3016,24 @@ class LdapAdvanced break; } - if ($ldapAttributeValue != $arrayUser[$username][$fieldName]) { - $arrayUserDataUpdate[$fieldName] = $ldapAttributeValue; + if (isset($arrayUser[$username][$fieldName])) { + if ($ldapAttributeValue != $arrayUser[$username][$fieldName]) { + $arrayUserDataUpdate[$fieldName] = $ldapAttributeValue; + } + } else { + $extendedData[$fieldName] = $ldapAttributeValue; } } } + //update the extended data + if (!empty($extendedData)) { + $json = $arrayUser[$username]['USR_EXTENDED_ATTRIBUTES_DATA']; + $oldExtendedData = empty($json) ? [] : json_decode($json, true); + $extendedData = array_merge($oldExtendedData, $extendedData); + $arrayUserDataUpdate['USR_EXTENDED_ATTRIBUTES_DATA'] = json_encode($extendedData); + } + if (!empty($arrayUserDataUpdate)) { $arrayUserDataUpdate['USR_UID'] = $arrayUser[$username]['USR_UID']; diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po index 7c21013a9..5183e98f2 100755 --- a/workflow/engine/content/translations/english/processmaker.en.po +++ b/workflow/engine/content/translations/english/processmaker.en.po @@ -4016,8 +4016,8 @@ msgstr "Case Description" # TRANSLATION # LABEL/ID_CASE_DOES_NOT_EXIST #: LABEL/ID_CASE_DOES_NOT_EXIST -msgid "Case {CASE_NUMBER} does not exist" -msgstr "Case {CASE_NUMBER} does not exist" +msgid "Case {0} does not exist" +msgstr "Case {0} does not exist" # TRANSLATION # LABEL/ID_CASE_DOES_NOT_EXIST2 diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index 763efc672..43f21e649 100755 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -57481,7 +57481,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_CASE_DELETED_SUCCESSFULLY','en','The Case {APP_NUMBER} was deleted successfully!','2014-01-15') , ( 'LABEL','ID_CASE_DEL_INDEX_DOES_NOT_EXIST','en','The case {0}: {1} with {2}: {3} does not exist.','2015-09-30') , ( 'LABEL','ID_CASE_DESCRIPTION','en','Case Description','2014-01-15') , -( 'LABEL','ID_CASE_DOES_NOT_EXIST','en','Case {CASE_NUMBER} does not exist','2014-01-15') , +( 'LABEL','ID_CASE_DOES_NOT_EXIST','en','Case {0} does not exist','2022-04-19') , ( 'LABEL','ID_CASE_DOES_NOT_EXIST2','en','The case with {0}: {1} does not exist.','2014-06-05') , ( 'LABEL','ID_CASE_DOES_NOT_EXISTS','en','This case does not exist','2014-01-15') , ( 'LABEL','ID_CASE_DOES_NOT_EXIST_JS','en','Case {0} does not exist','2014-01-15') , diff --git a/workflow/engine/methods/authenticationSources/src/components/matchAttributes.vue b/workflow/engine/methods/authenticationSources/src/components/matchAttributes.vue index 502672bdd..4cf76f037 100644 --- a/workflow/engine/methods/authenticationSources/src/components/matchAttributes.vue +++ b/workflow/engine/methods/authenticationSources/src/components/matchAttributes.vue @@ -109,14 +109,15 @@ deleteAttributeProcess() { this.rows.splice(this.selectedRowIndex - 1, 1); }, - saveRow(obj) { + saveRow(object) { + let obj = Object.assign({}, object);//important to clone the object if (obj.index === null) { delete obj.index; this.rows.push(obj); } else { let i = obj.index; delete obj.index; - this.rows[i - 1] = obj; + Object.assign(this.rows[i - 1], obj); } }, connectionSettings() { diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Search.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Search.php index 880aed728..6d435df02 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Search.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Search.php @@ -91,13 +91,13 @@ class Search extends AbstractCases // Filter by user who started if ($this->getUserStartedId()) { // Get the case numbers related to this filter - $result = Delegation::casesStartedBy($this->getUserStartedId(), $this->getOffset(), $this->getLimit()); + $result = Delegation::casesStartedBy($this->getUserStartedId()); $query->specificCases($result); } // Filter by user who completed if ($this->getUserCompletedId()) { // Get the case numbers related to this filter - $result = Delegation::casesCompletedBy($this->getUserCompletedId(), $this->getOffset(), $this->getLimit()); + $result = Delegation::casesCompletedBy($this->getUserCompletedId()); $query->specificCases($result); } // Filter by task diff --git a/workflow/engine/src/ProcessMaker/Model/CaseList.php b/workflow/engine/src/ProcessMaker/Model/CaseList.php index c825f20a8..29025851e 100644 --- a/workflow/engine/src/ProcessMaker/Model/CaseList.php +++ b/workflow/engine/src/ProcessMaker/Model/CaseList.php @@ -366,6 +366,7 @@ class CaseList extends Model [ 'list' => ['inbox', 'draft', 'paused', 'unassigned'], 'field' => 'case_number', + 'idFilter' => 'case_number', 'name' => G::LoadTranslation('ID_MYCASE_NUMBER'), 'type' => 'integer', 'source' => 'APPLICATION', @@ -375,6 +376,7 @@ class CaseList extends Model ], [ 'list' => ['inbox', 'draft', 'paused', 'unassigned'], 'field' => 'case_title', + 'idFilter' => 'caseTitle', 'name' => G::LoadTranslation('ID_CASE_THREAD_TITLE'), 'type' => 'string', 'source' => 'APPLICATION', @@ -384,6 +386,7 @@ class CaseList extends Model ], [ 'list' => ['inbox', 'draft', 'paused', 'unassigned'], 'field' => 'process_category', + 'idFilter' => 'process_category', 'name' => G::LoadTranslation('ID_PROCESS_CATEGORY'), 'type' => 'string', 'source' => 'APPLICATION', @@ -393,6 +396,7 @@ class CaseList extends Model ], [ 'list' => ['inbox', 'draft', 'paused', 'unassigned'], 'field' => 'process_name', + 'idFilter' => 'process_name', 'name' => G::LoadTranslation('ID_PROCESS_NAME'), 'type' => 'string', 'source' => 'APPLICATION', @@ -401,7 +405,8 @@ class CaseList extends Model 'set' => true ], [ 'list' => ['inbox', 'draft', 'paused', 'unassigned'], - 'field' => 'task_title', + 'field' => 'task', + 'idFilter' => 'task', 'name' => G::LoadTranslation('ID_TASK'), 'type' => 'string', 'source' => 'APPLICATION', @@ -411,6 +416,7 @@ class CaseList extends Model ], [ 'list' => ['inbox', 'draft', 'paused', 'unassigned'], 'field' => 'send_by', + 'idFilter' => 'send_by', 'name' => G::LoadTranslation('ID_SEND_BY'), 'type' => 'string', 'source' => 'APPLICATION', @@ -420,6 +426,7 @@ class CaseList extends Model ], [ 'list' => ['inbox', 'paused', 'unassigned'], 'field' => 'due_date', + 'idFilter' => 'due_date', 'name' => G::LoadTranslation('ID_DUE_DATE'), 'type' => 'date', 'source' => 'APPLICATION', @@ -429,6 +436,7 @@ class CaseList extends Model ], [ 'list' => ['inbox', 'paused', 'unassigned'], 'field' => 'delegation_date', + 'idFilter' => 'delegation_date', 'name' => G::LoadTranslation('ID_DELEGATION_DATE'), 'type' => 'date', 'source' => 'APPLICATION', @@ -438,6 +446,7 @@ class CaseList extends Model ], [ 'list' => ['inbox', 'draft', 'paused', 'unassigned'], 'field' => 'priority', + 'idFilter' => 'priority', 'name' => G::LoadTranslation('ID_PRIORITY'), 'type' => 'string', 'source' => 'APPLICATION', diff --git a/workflow/engine/src/ProcessMaker/Model/Delegation.php b/workflow/engine/src/ProcessMaker/Model/Delegation.php index 56fcb2fd6..de0494c45 100644 --- a/workflow/engine/src/ProcessMaker/Model/Delegation.php +++ b/workflow/engine/src/ProcessMaker/Model/Delegation.php @@ -2131,12 +2131,10 @@ class Delegation extends Model * Get cases completed by specific user * * @param int $userId - * @param int $offset - * @param int $limit * * @return array */ - public static function casesCompletedBy(int $userId, int $offset = 0, int $limit = 15) + public static function casesCompletedBy(int $userId) { // Get the case numbers related to this filter $query = Delegation::query()->select(['APP_NUMBER']); @@ -2144,8 +2142,6 @@ class Delegation extends Model $query->participated($userId); // Filter the last thread $query->lastThread(); - // Apply the limit - $query->offset($offset)->limit($limit); // Get the result $results = $query->get(); @@ -2156,12 +2152,10 @@ class Delegation extends Model * Get cases started by specific user * * @param int $userId - * @param int $offset - * @param int $limit * * @return array */ - public static function casesStartedBy(int $userId, int $offset = 0, int $limit = 15) + public static function casesStartedBy(int $userId) { // Get the case numbers related to this filter $query = Delegation::query()->select(['APP_NUMBER']); @@ -2169,8 +2163,6 @@ class Delegation extends Model $query->participated($userId); // Filter the first thread $query->caseStarted(); - // Apply the limit - $query->offset($offset)->limit($limit); // Get the result $results = $query->get(); diff --git a/workflow/engine/src/ProcessMaker/Model/UserConfig.php b/workflow/engine/src/ProcessMaker/Model/UserConfig.php index 5d383048d..a2ebfd4f9 100644 --- a/workflow/engine/src/ProcessMaker/Model/UserConfig.php +++ b/workflow/engine/src/ProcessMaker/Model/UserConfig.php @@ -93,4 +93,65 @@ class UserConfig extends Model ->delete(); return $userConfig; } + + /** + * This updates the filter settings on custom case list. + * @param string $id + * @param array $caseList + */ + public static function updateUserConfig(string $id, array $caseList) + { + //get columns deactivates + $columnsDisableFilter = []; + if (isset($caseList['columns'])) { + foreach ($caseList['columns'] as $column) { + if ($column->enableFilter === false) { + $columnsDisableFilter[] = $column; + } + } + } + //process all custom configuration + $name = 'userConfig'; + $usersConfig = UserConfig::select(['USR_ID', 'USC_SETTING']) + ->where('USC_NAME', '=', $name) + ->get(); + foreach ($usersConfig as $value) { + if (empty($value->USC_SETTING)) { + continue; + } + $lists = json_decode($value->USC_SETTING); + foreach ($lists as &$list) { + if (!property_exists($list, 'customCaseList')) { + continue; + } + foreach ($list->customCaseList as $key => &$item) { + if (intval($key) !== intval($id)) { + continue; + } + if (!property_exists($item, 'filters')) { + continue; + } + if (!is_array($item->filters)) { + continue; + } + $i = count($item->filters) - 1; + while ($i >= 0) { + if (isset($item->filters[$i])) { + foreach ($columnsDisableFilter as $column) { + if ($item->filters[$i]->fieldId === $column->field) { + unset($item->filters[$i]); + //reindex array keys + $item->filters = array_values($item->filters); + } + } + } + $i--; + } + } + } + //update database + $lists = (array) $lists; + UserConfig::editSetting($value->USR_ID, $name, $lists); + } + } } diff --git a/workflow/engine/src/ProcessMaker/Services/Api/CaseList.php b/workflow/engine/src/ProcessMaker/Services/Api/CaseList.php index 78be1aca2..eea57b9a5 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/CaseList.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/CaseList.php @@ -6,6 +6,7 @@ use Exception; use G; use Luracast\Restler\RestException; use ProcessMaker\Model\CaseList as CaseListBusinessModel; +USE ProcessMaker\Model\UserConfig; use ProcessMaker\Services\Api; use RBAC; @@ -62,6 +63,7 @@ class CaseList extends Api throw new RestException(Api::STAT_APP_EXCEPTION, G::LoadTranslation('ID_DOES_NOT_EXIST')); } $caseList = CaseListBusinessModel::getAliasFromColumnName($caseList->toArray()); + UserConfig::updateUserConfig($id, $caseList); return $caseList; } diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Light.php b/workflow/engine/src/ProcessMaker/Services/Api/Light.php index 11750a31c..c57a5edef 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Light.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Light.php @@ -1815,9 +1815,9 @@ class Light extends Api * * @access protected * @class AccessControl {@className \ProcessMaker\Services\Api\Cases} - * @url GET /:app_uid/variables + * @url GET /:appUid/variables * - * @param string $app_uid {@min 1}{@max 32} + * @param string $appUid {@min 1}{@max 32} * @param string $dyn_uid * @param string $pro_uid * @param string $act_uid @@ -1825,7 +1825,7 @@ class Light extends Api * @return mixed * @throws RestException */ - public function doGetCaseVariables($app_uid, $dyn_uid = null, $pro_uid = null, $act_uid = null, $app_index = null) + public function doGetCaseVariables($appUid, $dyn_uid = null, $pro_uid = null, $act_uid = null, $app_index = null) { try { $usr_uid = $this->getUserId(); @@ -1834,7 +1834,7 @@ class Light extends Api if (!empty($pro_uid)) { $_SESSION['PROCESS'] = $pro_uid; } - $response = $cases->getCaseVariables($app_uid, $usr_uid, $dyn_uid, $pro_uid, $act_uid, $app_index); + $response = $cases->getCaseVariables($appUid, $usr_uid, $dyn_uid, $pro_uid, $act_uid, $app_index); return DateTime::convertUtcToTimeZone($response); } catch (Exception $e) {