From 5a9bd492bde7b9feb7e40879e3ce203040774058 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 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. --- 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 90fb535472..a899bf52be 100644 --- a/admin/columns_settings.yml +++ b/admin/columns_settings.yml @@ -988,6 +988,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 8f13fa0374..75270c723e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc @@ -161,6 +161,8 @@ [% CASE 'phone' %]Phone [% CASE 'checkouts' %]Checkouts [% CASE 'account_balance' %]Fines + [% CASE 'sort1' %]Sort 1 + [% CASE 'sort2' %]Sort 2 [% CASE 'action' %]  [% END %] [% END %] @@ -199,7 +201,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 %] @@ -610,6 +612,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 53670d10e0..dfdfda51e9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt @@ -8,7 +8,7 @@ [% PROCESS 'patronfields.inc' %] [% SET libraries = Branches.all %] [% SET categories = Categories.all.unblessed %] -[% SET columns = ['cardnumber', 'name-address', 'dateofbirth', 'branch', 'category', 'dateexpiry', 'checkouts', 'account_balance', 'borrowernotes', 'action'] %] +[% SET columns = ['cardnumber', 'name-address', 'dateofbirth', 'branch', 'category', 'dateexpiry', 'checkouts', 'account_balance', 'borrowernotes', 'sort1', 'sort2', 'action'] %] [% SET searchtype = Koha.Preference('DefaultPatronSearchMethod') %] [% PROCESS 'patron-search.inc' %] [% INCLUDE 'doc-head-open.inc' %] -- 2.30.2