From 6ad5290b1eea6e6cb9c5bce93ae75edf4a97ddf1 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 17 Feb 2022 10:57:25 +0100 Subject: [PATCH] Bug 30055: Don't hardcode the default sort column At this point it does not change anything, all calls to members/search.pl has "name" in second column, but that will be helpful in follow-up bugs. Signed-off-by: Tomas Cohen Arazi --- koha-tmpl/intranet-tmpl/prog/en/modules/members/search.tt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/search.tt index d74f044ea2..8f14421f9e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/search.tt @@ -182,6 +182,8 @@ ]; }, }; + [% SET default_sort_column = "name" %] + [% SET order_column_index = 0 %] patrons_table = $("#memberresultst").kohaTable({ "ajax": { [% SWITCH filter %] @@ -198,10 +200,12 @@ [% END %] }, embed: ['extended_attributes'], - "order": [[ 1, "asc" ]], "iDeferLoading": 0, "columns": [ [% FOR column IN columns %] + [% IF default_sort_column == column %] + [% order_column_index = loop.count - 1%] + [% END %] [% SWITCH column %] [% CASE 'cardnumber' %] { @@ -289,6 +293,7 @@ [% UNLESS loop.last %],[% END %] [% END %] ], + "order": [[ [% order_column_index %], "asc" ]], 'bAutoWidth': false, 'sPaginationType': 'full_numbers', "iDisplayLength": [% Koha.Preference('PatronsPerPage') | html %], -- 2.35.1