From dff843923aee285793744da741f24e0b2d2f2dfc Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 24 Aug 2023 10:57:37 +0000 Subject: [PATCH] Bug 34608: Add sort1 and sort2 to patron search results MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds the option of displaying patron "sort1" and "sort2" statistical fields in the patron module's main search results. The fields are hidden by default in the updated table configuration. To test, apply the patch and restart services. - Go to Patrons and perform a search. - You should not see columns for sort1 and sort2. - Under the "Columns" button you should see options to display sort1 and sort2. Confirm that they work to show and hide the columns. - Confirm that the sort1 and sort2 columns are sortable and searchable. - Go to Administration -> Table settings. - Under Patrons -> member, toggle the sort1 and sort1 "hidden by default" checkboxes and save the configuration. - Return to patron search results to confirm that the columns are now shown by default. Signed-off-by: Émily-Rose Francoeur --- admin/columns_settings.yml | 6 +++++ .../prog/en/includes/patron-search.inc | 26 ++++++++++++++++++- .../prog/en/modules/members/member.tt | 2 +- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml index 4dfb152a6c..5ec87c6ab0 100644 --- a/admin/columns_settings.yml +++ b/admin/columns_settings.yml @@ -1089,6 +1089,12 @@ modules: columnname: fines - columnname: circ_notes + - + columnname: sort1 + is_hidden: 1 + - + columnname: sort2 + is_hidden: 1 - columnname: actions cannot_be_toggled: 1 diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc index 747a106f65..97fa549628 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc @@ -178,6 +178,8 @@ [% CASE 'phone' %]Phone [% CASE 'checkouts' %]Checkouts [% CASE 'account_balance' %]Fines + [% CASE 'sort1' %]Sort 1 + [% CASE 'sort2' %]Sort 2 [% CASE 'action' %]  [% END %] [% END %] @@ -209,7 +211,7 @@ [%# - redirect_if_attribute_equal: Name of the attribute to use for the redirect. Query using this attribute, before the normal search %] [%# filter: Same as patron_search_table %] [%# open_on_row_click: boolean, default off. Will allow to select a patron by clicking on the whole tr element %] -[%# columns: list of columns that will be displayed. Possible values are: 'checkbox', 'cardnumber', 'dateofbirth', 'address', 'name', 'name-address', 'branch', 'category', 'dateexpiry', 'borrowernotes, 'phone', 'checkouts', 'account_balance', 'action' %] +[%# columns: list of columns that will be displayed. Possible values are: 'checkbox', 'cardnumber', 'dateofbirth', 'address', 'name', 'name-address', 'branch', 'category', 'dateexpiry', 'borrowernotes, 'phone', 'checkouts', 'account_balance', 'sort1', 'sort2', 'action' %] [%# preview_on_name_click: Open a modal window with patron's info when the name is clicked %] [%# actions: list of buttons to display in the action column. Possible values are: 'select', 'add', 'edit', 'checkout' %] [%# sticky_header and sticky_to: If we need a sticky header %] @@ -614,6 +616,28 @@ } } + + [% CASE 'sort1' %] + { + "data": "statistics_1", + "searchable": true, + "orderable": true, + "render": function( data, type, row, meta ) { + return escape_str(data); + } + } + + [% CASE 'sort2' %] + { + "data": "statistics_2", + "searchable": true, + "orderable": true, + "render": function( data, type, row, meta ) { + return escape_str(data); + } + } + + [% CASE 'action' %] { "data": function( row, type, val, meta ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt index 13bc58c91f..1ed2ebbb0d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt @@ -10,7 +10,7 @@ [% PROCESS 'patronfields.inc' %] [% SET libraries = Branches.all %] [% SET categories = Categories.all.unblessed %] -[% SET columns = ['cardnumber', 'name-address', 'phone', 'dateofbirth', 'branch', 'category', 'dateexpiry', 'checkouts', 'account_balance', 'borrowernotes', 'action'] %] +[% SET columns = ['cardnumber', 'name-address', 'phone', 'dateofbirth', 'branch', 'category', 'dateexpiry', 'checkouts', 'account_balance', 'borrowernotes', 'sort1', 'sort2', 'action'] %] [% SET searchtype = searchtype || Koha.Preference('DefaultPatronSearchMethod') %] [% PROCESS 'patron-search.inc' %] [% INCLUDE 'doc-head-open.inc' %] -- 2.39.2