Bug 16316 - Limit patron search to surname
authorMagnus Enger <magnus@libriotech.no>
Thu, 21 Apr 2016 12:58:11 +0000 (14:58 +0200)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 29 Apr 2016 15:53:24 +0000 (15:53 +0000)
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 <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

C4/Utils/DataTables/Members.pm
koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc
koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt

index cc3cba0..0b282ac 100644 (file)
@@ -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',
index 1dce31c..e12ccd0 100644 (file)
               [% ELSE %]
                 <option value='standard'>Standard</option>
               [% END %]
+              [% IF searchfieldstype == "surname" %]
+                <option selected="selected" value='surname'>Surname</option>
+              [% ELSE %]
+                <option value='surname'>Surname</option>
+              [% END %]
               [% IF searchfieldstype == "email" %]
                 <option selected="selected" value='email'>Email</option>
               [% ELSE %]
index adfc67d..0bb4bfa 100644 (file)
@@ -423,6 +423,11 @@ function filterByFirstLetterSurname(letter) {
                 [% ELSE %]
                   <option value='standard'>Standard</option>
                 [% END %]
+                [% IF searchfieldstype == "surname" %]
+                  <option selected="selected" value='surname'>Surname</option>
+                [% ELSE %]
+                  <option value='surname'>Surname</option>
+                [% END %]
                 [% IF searchfieldstype == "email" %]
                   <option selected="selected" value='email'>Email</option>
                 [% ELSE %]