PMCORE-3245

This commit is contained in:
Paula Quispe
2021-08-27 16:49:33 -04:00
parent aa7729d3e7
commit c35fe76ce3
5 changed files with 37 additions and 5 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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') ,

View File

@@ -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()) {

View File

@@ -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();
}
}