From 9060c5275fb9bab226f33cbb7414caedfcee3e20 Mon Sep 17 00:00:00 2001 From: Magnus Enger Date: Thu, 21 Apr 2016 14:58:11 +0200 Subject: [PATCH] Bug 16316 - Limit patron search to surname MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch makes it possible to limit a patron search to search just for surnames. To test: - Apply the patch - Add two patrons, called e.g. "John Doe" and "Doe John" - Go to Patrons in the Intranet - Make sure you have selected "Search fields" = Standard - Search for "john" and verify both patrons show up - Search for "doe" and verify both patrons show up - Set "Search fields" = Surname and search for "john". "Doe John" should show up, but not "John Doe". - Set "Search fields" = Surname and search for "doe". "John Doe" should show up, but not "Doe John". Update: Revised the last point in the test plan. Sponsored-by: Alingsås Public Library, Sweden Signed-off-by: Owen Leonard Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- C4/Utils/DataTables/Members.pm | 1 + koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc | 5 +++++ koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/C4/Utils/DataTables/Members.pm b/C4/Utils/DataTables/Members.pm index cc3cba095d..0b282ac0fa 100644 --- a/C4/Utils/DataTables/Members.pm +++ b/C4/Utils/DataTables/Members.pm @@ -61,6 +61,7 @@ sub search { my $searchfields = { standard => 'surname,firstname,othernames,cardnumber,userid', + surname => 'surname', email => 'email,emailpro,B_email', borrowernumber => 'borrowernumber', userid => 'userid', 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 1dce31ce4c..e12ccd0d43 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc @@ -22,6 +22,11 @@ [% ELSE %] [% END %] + [% IF searchfieldstype == "surname" %] + + [% ELSE %] + + [% END %] [% IF searchfieldstype == "email" %] [% ELSE %] 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 adfc67dcfc..0bb4bfacbc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt @@ -423,6 +423,11 @@ function filterByFirstLetterSurname(letter) { [% ELSE %] [% END %] + [% IF searchfieldstype == "surname" %] + + [% ELSE %] + + [% END %] [% IF searchfieldstype == "email" %] [% ELSE %] -- 2.39.5