From 6209e7794665645af1c5ad4757435cf81a0f4049 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Thu, 12 Oct 2017 14:27:57 +0530 Subject: [PATCH] CRM-21305, fixed sorting of column on batch transaction listing page ---------------------------------------- * CRM-21305: Sorting not working on Batch listing page https://issues.civicrm.org/jira/browse/CRM-21305 --- CRM/Batch/Page/AJAX.php | 31 +++++++++++++++++-------- templates/CRM/Financial/Form/Search.tpl | 4 ++-- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/CRM/Batch/Page/AJAX.php b/CRM/Batch/Page/AJAX.php index 7f8fd93813..2877e0244c 100644 --- a/CRM/Batch/Page/AJAX.php +++ b/CRM/Batch/Page/AJAX.php @@ -54,21 +54,32 @@ class CRM_Batch_Page_AJAX { * @deprecated */ public static function getBatchList() { - $sortMapper = array( - 0 => 'title', - 1 => 'type_id', - 2 => '', - 3 => 'total', - 4 => 'status_id', - 5 => '', - ); - + $context = isset($_REQUEST['context']) ? CRM_Utils_Type::escape($_REQUEST['context'], 'String') : NULL; + if ($context != 'financialBatch') { + $sortMapper = array( + 0 => 'title', + 1 => 'type_id.label', + 2 => 'item_count', + 3 => 'total', + 4 => 'status_id.label', + 5 => 'created_id.sort_name', + ); + } + else { + $sortMapper = array( + 1 => 'title', + 2 => 'payment_instrument_id.label', + 3 => 'item_count', + 4 => 'total', + 5 => 'status_id.label', + 6 => 'created_id.sort_name', + ); + } $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer'); $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0; $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25; $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL; $sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc'; - $context = isset($_REQUEST['context']) ? CRM_Utils_Type::escape($_REQUEST['context'], 'String') : NULL; $params = $_REQUEST; if ($sort && $sortOrder) { diff --git a/templates/CRM/Financial/Form/Search.tpl b/templates/CRM/Financial/Form/Search.tpl index 9e0c7543e4..5df3040f49 100644 --- a/templates/CRM/Financial/Form/Search.tpl +++ b/templates/CRM/Financial/Form/Search.tpl @@ -99,8 +99,8 @@ CRM.$(function($) { {sClass:'crm-batch-checkbox', bSortable:false}, {sClass:'crm-batch-name'}, {sClass:'crm-batch-payment_instrument'}, - {sClass:'crm-batch-item_count right'}, - {sClass:'crm-batch-total right'}, + {sClass:'crm-batch-item_count right', bSortable:false}, + {sClass:'crm-batch-total right', bSortable:false}, {sClass:'crm-batch-status'}, {sClass:'crm-batch-created_by'}, {sClass:'crm-batch-links', bSortable:false}, -- 2.25.1