Bug 7544 - Add ability search borrowers only on email / phone
authorKyle M Hall <kyle@bywatersolutions.com>
Wed, 15 Feb 2012 15:44:20 +0000 (10:44 -0500)
committerPaul Poulain <paul.poulain@biblibre.com>
Mon, 27 Feb 2012 17:25:26 +0000 (18:25 +0100)
This commit adds a new pulldown field to the patron quick search.
This pulldown "Search Fields" can have any number of field combinations
to search on. The combinations added in this commit are:

Standard: Default, searches on original fields
Email: Searches on email, emailpro, and B_email
Borrower Number: Searches on borrowernumber
Phone Number: Searches on phone, phonepro, B_phone, altcontactphone, and mobile

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Tested by running searches on all the new fields, and the old fields
with limits on branch and category. The seach on phone number could be
a bit more inclusive, but it works with and without symbols so I
give my sign off on this patch.

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Documentation should note that phone numbers should be searched only on the
numbers of a phone number, and separate the area code and exchange with spaces,
regardless of how the number is entered in the database.

So no dashes or parentheses in the phone search, and the last 7 search works with spaces, i.e. xxx xxxx.

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc
members/member.pl

index 5376e87..17a212f 100644 (file)
@@ -53,7 +53,16 @@ YAHOO.util.Event.onContentReady("header_search", function() {
        <span class="filteraction" id="filteraction_off"> <a href="#" onclick="$('#filters').toggle();$('.filteraction').toggle();">[-]</a></span>
        <span class="filteraction" id="filteraction_on"> <a href="#" onclick="$('#filters').toggle();$('.filteraction').toggle();">[+]</a></span>
        [% END %]
-    order by:
+
+      <label for="searchfields">Search fields:</label>
+      <select name="searchfields" id="searchfields">
+          <option selected="selected" value=''>Standard</option>
+          <option value='email,emailpro,B_email,'>Email</option>
+          <option value='borrowernumber'>Borrower number</option>
+          <option value='phone,phonepro,B_phone,altcontactphone,mobile'>Phone number</option>
+      </select>
+
+    <label for="orderby">Order by:</label>
     <select name="orderby" id="searchorderby">
     <option value="surname,0">Surname</option>
     <option value="cardnumber,0">Cardnumber</option>
index d759c31..9b793f4 100755 (executable)
@@ -94,6 +94,9 @@ else {
        @orderby = ({surname=>0},{firstname=>0});
 }
 
+my $searchfields = $input->param('searchfields');
+my @searchfields = $searchfields ? split( ',', $searchfields ) : ( "firstname", "surname", "othernames", "cardnumber", "userid", "email" );
+
 $member =~ s/,//g;   #remove any commas from search string
 $member =~ s/\*/%/g;
 
@@ -104,7 +107,7 @@ my ($count,$results);
 if ($member || keys %$patron) {
     #($results)=Search($member || $patron,{surname=>1,firstname=>1},[$from,$to],undef,["firstname","surname","email","othernames"]  );
     my $search_scope = ( $quicksearch ? "field_start_with" : "start_with" );
-    ($results) = Search( $member || $patron, \@orderby, undef, undef, [ "firstname", "surname", "othernames", "cardnumber", "userid", "email" ], $search_scope );
+    ($results) = Search( $member || $patron, \@orderby, undef, undef, \@searchfields, $search_scope );
 }
 
 if ($results) {