5

Currently cases with recent activities are sorted oldest>newest - i'd like the newest to be at the top.

I am guessing i could do it within Case/Page/DashboardSelector.tpl but i'm floundering from there.. is it possible? thanks!

1 Answer 1

3

I don't think you can do it in the smarty template but since you might want the sorting of similar listings to be consistent anywhere it's used you could just change line 545 in CRM_Case_BAO_Case::getCaseActivityQuery() so that it sorts descending.

      $query .= " ORDER BY case_recent_activity_date ASC ";

becomes

      $query .= " ORDER BY case_recent_activity_date DESC ";

Obviously editing core files directly isn't recommended, but that's where the sorting happens for this.

2
  • thanks! i'll do some careful checking before making any core changes.. perhaps i can do it with a module/extension though. Commented Dec 12, 2017 at 9:33
  • You might be able to do it with the pageRun hook, and then re-sort the "recentCases" element. Haven't tested but something like $recentCases = $page->get_template_vars('recentCases'); which should give you an array you can sort. docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_pageRun
    – Demerit
    Commented Dec 12, 2017 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.