diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po index 7cb1eb9de..71e6b1710 100755 --- a/workflow/engine/content/translations/english/processmaker.en.po +++ b/workflow/engine/content/translations/english/processmaker.en.po @@ -3545,6 +3545,12 @@ msgstr "The Case was deleted successfully." msgid "Case Uid" msgstr "Case Uid" +# TRANSLATION +# LABEL/ID_CASE_THREAD_TITLE +#: LABEL/ID_CASE_THREAD_TITLE +msgid "Case thread title" +msgstr "Case thread title" + # TRANSLATION # LABEL/ID_CASES #: LABEL/ID_CASES diff --git a/workflow/engine/controllers/appProxy.php b/workflow/engine/controllers/appProxy.php index acce036e0..6fb7a04d0 100644 --- a/workflow/engine/controllers/appProxy.php +++ b/workflow/engine/controllers/appProxy.php @@ -354,7 +354,7 @@ class AppProxy extends HttpProxyController ], $j++ => [ // Case Title per thread 'id' => 'CASE_TITLE', - 'label' => G::LoadTranslation('ID_TASK_TITLE') . ': ', + 'label' => G::LoadTranslation('ID_CASE_THREAD_TITLE') . ': ', 'value' => $row['DEL_TITLE'], ], $j++ => [ // Current User diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index 743394fc3..ce8993135 100755 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -57397,6 +57397,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_CASELIST_CAN_NOT_BE_IMPORTED_THE_PMTABLE_NOT_EXIST','en','Custom Case List {0} can not be imported because the PM Table does not exist in this Workspace.','2021-08-20') , ( 'LABEL','ID_CASE_DELETE_SUCCESFULLY','en','The Case was deleted successfully.','2020-01-08') , ( 'LABEL','ID_CASE_UID','en','Case Uid','2021-04-04') , +( 'LABEL','ID_CASE_THREAD_TITLE','en','Case thread title','2021-08-27') , ( 'LABEL','ID_CASES','en','HOME','2014-01-15') , ( 'LABEL','ID_CASES1','en','Cases','2015-12-15') , ( 'LABEL','ID_CASES_DELETE_SUCCESFULLY','en','All Cases were deleted successfully.','2020-01-08') , diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Search.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Search.php index e52cc980f..c49b89faa 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Search.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Search.php @@ -62,10 +62,10 @@ class Search extends AbstractCases } // Specific case title if (!empty($this->getCaseTitle())) { - // Join with delegation - $query->joinDelegation(); + // Get the result + $result = Delegation::casesThreadTitle($this->getCaseTitle(), $this->getOffset(), $this->getLimit()); // Add the filter - // $query->title($this->getCaseTitle()); + $query->specificCases($result); } // Filter by category if ($this->getCategoryId()) { diff --git a/workflow/engine/src/ProcessMaker/Model/Delegation.php b/workflow/engine/src/ProcessMaker/Model/Delegation.php index 22d9772b3..22427bfef 100644 --- a/workflow/engine/src/ProcessMaker/Model/Delegation.php +++ b/workflow/engine/src/ProcessMaker/Model/Delegation.php @@ -442,7 +442,7 @@ class Delegation extends Model $query->whereRaw("MATCH(APP_DELEGATION.DEL_TITLE) AGAINST('{$search}' IN BOOLEAN MODE)"); } else { // Searching using "like" operator - $query->where('APP_DELEGATION.DEL_TITLE', 'LIKE', "%${$search}%"); + $query->where('APP_DELEGATION.DEL_TITLE', 'LIKE', "%{$search}%"); } return $query; @@ -2081,4 +2081,29 @@ class Delegation extends Model return $results->values()->toArray(); } + + /** + * Get cases filter by thread title + * + * @param string $search + * @param int $offset + * @param int $limit + * + * @return array + */ + public static function casesThreadTitle(string $search, int $offset = 0, int $limit = 15) + { + // Get the case numbers related to this filter + $query = Delegation::query()->select(['APP_NUMBER']); + // Filter the title + $query->title($search); + // Group by + $query->groupBy('APP_NUMBER'); + // Apply the limit + $query->offset($offset)->limit($limit); + // Get the result + $results = $query->get(); + + return $results->values()->toArray(); + } }