Skip to content

Commit

Permalink
Merge pull request #21514 from mattwire/1624_2319_casedashboard
Browse files Browse the repository at this point in the history
Fix issues with case sorting/searching from case dashboard
  • Loading branch information
demeritcowboy authored Mar 21, 2022
2 parents c224ce8 + 0f73dba commit b807943
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CRM/Case/BAO/Case.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,8 @@ public static function getCaseActivityQuery($type, $userID, $condition = NULL, $
"GROUP_CONCAT(DISTINCT IF(case_relationship.contact_id_b = $userID, case_relation_type.label_a_b, case_relation_type.label_b_a) SEPARATOR ', ') as case_role",
't_act.activity_date_time as activity_date_time',
't_act.id as activity_id',
'case_status.label AS case_status',
'civicrm_case_type.title AS case_type',
];

$query = CRM_Contact_BAO_Query::appendAnyValueToSelect($selectClauses, 'case_id');
Expand All @@ -424,6 +426,11 @@ public static function getCaseActivityQuery($type, $userID, $condition = NULL, $
FROM civicrm_case
INNER JOIN civicrm_case_contact ON civicrm_case.id = civicrm_case_contact.case_id
INNER JOIN civicrm_contact ON civicrm_case_contact.contact_id = civicrm_contact.id
LEFT JOIN civicrm_case_type ON civicrm_case.case_type_id = civicrm_case_type.id
LEFT JOIN civicrm_option_group option_group_case_status ON ( option_group_case_status.name = 'case_status' )
LEFT JOIN civicrm_option_value case_status ON ( civicrm_case.status_id = case_status.value
AND option_group_case_status.id = case_status.option_group_id )
HERESQL;

// 'upcoming' and 'recent' show the next scheduled and most recent
Expand Down
6 changes: 3 additions & 3 deletions CRM/Case/Selector/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
$rows[$result->case_id] = $row;
}

//retrive the scheduled & recent Activity type and date for selector
//retrieve the scheduled & recent Activity type and date for selector
if (!empty($scheduledInfo)) {
$schdeduledActivity = CRM_Case_BAO_Case::getNextScheduledActivity($scheduledInfo, 'upcoming');
foreach ($schdeduledActivity as $key => $value) {
Expand Down Expand Up @@ -417,12 +417,12 @@ public function &getColumnHeaders($action = NULL, $output = NULL) {
],
[
'name' => ts('Most Recent'),
'sort' => 'case_recent_activity_date',
// @fixme: Triggers DB error field not found on "Find Cases": 'sort' => 'case_recent_activity_date',
'direction' => CRM_Utils_Sort::DONTCARE,
],
[
'name' => ts('Next Sched.'),
'sort' => 'case_scheduled_activity_date',
// @fixme: Triggers DB error field not found on "Find Cases": 'sort' => 'case_scheduled_activity_date',
'direction' => CRM_Utils_Sort::DONTCARE,
],
['name' => ts('Actions')],
Expand Down

0 comments on commit b807943

Please sign in to comment.