From 59b6b9d7726ef69e308cb00811964abacd263280 Mon Sep 17 00:00:00 2001 From: Michael Hafen Date: Tue, 20 Jul 2021 12:12:42 -0600 Subject: [PATCH] Bug 28726: Add sort1 and sort2 to patron card creator - patron search. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also adds a select all / clear all and checkboxes. Test plan: 1. start a new batch in the patron card creator (Tools -> Patron card creator -> New -> card batch) 2. click the Add patron(s) button. Observe that Category and Library are the only options. 3. Close search for patron window. 4. Apply patch. 5. click the Add patron(s) button. Observe that you can now search for patrons by their sort1 and sort2 values. 6. perform a search and observe the 'Select all | Clear all | Add selected patrons' links and button. 7. use the Select all link to select all the patrons found by the search. 8. use the Add selected patrons button to add the selected patrons to the card batch's Add by borrowernumber(s) text input field. 9. close the search for patron window. Signed-off-by: Emmanuel Bétemps --- .../prog/en/includes/patron-search.inc | 52 ++++++++++++++++++- .../prog/en/modules/members/search.tt | 45 +++++++++++++++- .../prog/en/modules/patroncards/edit-batch.tt | 2 +- members/search.pl | 16 ++++++ 4 files changed, 111 insertions(+), 4 deletions(-) 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 52f9da0105..9bc743c1b2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc @@ -56,6 +56,26 @@ [% END %] + [% CASE 'sort1' %] +
  • + + +
  • + [% CASE 'sort2' %] +
  • + + +
  • [% CASE 'search_field' %]
  • @@ -308,11 +328,31 @@ return { "like": start_with + "%" } }, "-and": function(){ + let filters = []; + let f_sort1 = $("#sort1_filter").val(); + if ( f_sort1 ) { + filters.push({ + "me.sort1": f_sort1 + }); + } + let f_sort2 = $("#sort2_filter").val(); + if ( f_sort2 ) { + filters.push({ + "me.sort2": f_sort2 + }); + } + let pattern = $("#search_patron_filter").val(); - if (!pattern) return ""; + if (!pattern) { + if ( filters.length == 0 ) { + return ""; + } + else { + return filters; + } + } let patterns = pattern.split(' ').filter(function(s){ return s.length }); - let filters = []; let search_type = $("#searchtype_filter").val() || "contain"; let search_fields = $("#searchfieldstype_filter").val(); if ( !search_fields ) { @@ -728,6 +768,12 @@ if ( $("#branchcode_filter").val() ) { searched += _(" in library ") + $("#branchcode_filter").find("option:selected").text(); } + if ( $("#sort1_filter").val() ) { + searched += _(" with sort1 ") + $("#sort1_filter").find("option:selected").text(); + } + if ( $("#sort2_filter").val() ) { + searched += _(" with sort2 ") + $("#sort2_filter").find("option:selected").text(); + } $("#searchpattern").text(searched); $("#searchpattern").parent().show(); } @@ -785,6 +831,8 @@ $("#searchtype_filter option[value='contain']").prop("selected", true); $("#categorycode_filter option:first").prop("selected", true); $("#branchcode_filter option:first").prop("selected", true); + $("#sort1_filter option:first").prop("selected", true); + $("#sort2_filter option:first").prop("selected", true); $("#firstletter_filter").val(''); $("#search_patron_filter").val(''); /* remove any search string added by firstletter search */ 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 fecba041ea..18e0aedd46 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/search.tt @@ -17,10 +17,24 @@