Bugzilla – Attachment 14698 Details for
Bug 9407
patrons search should match substrings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 9407: patrons search should match substrings
Bug-9407-patrons-search-should-match-substrings.patch (text/plain), 2.71 KB, created by
Kyle M Hall
on 2013-01-18 14:58:47 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 9407: patrons search should match substrings
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2013-01-18 14:58:47 UTC
Size:
2.71 KB
patch
obsolete
>From cfa2abce6cd1cfd31757f1e4b07cae4b4067120e Mon Sep 17 00:00:00 2001 >From: MJ Ray <mjr@phonecoop.coop> >Date: Wed, 16 Jan 2013 20:13:57 +0000 >Subject: [PATCH] Bug 9407: patrons search should match substrings > > If a patron lives at 4345 Library Rd, a search on Street Address for > Library should find it. However, it does not, but a search for 4345 > Library does. This patch adds a "Search Type" drop-down, defaulting > to the current behaviour. > > To test: > 1) Search for a patron based on a non-leading part of a field. > 2) Should return no results. > 3) Search again with "Search Type" of "Contains". > 4) Should return the patron. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > .../prog/en/includes/patron-search.inc | 6 ++++++ > members/member.pl | 8 +++++++- > 2 files changed, 13 insertions(+), 1 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 880c34c..5023ba5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >@@ -19,6 +19,12 @@ > <option value='streettype,address,address2,city,state,zipcode,country'>Street Address</option> > </select> > >+ <label for="searchtype">Search type:</label> >+ <select name="searchtype" id="searchtype"> >+ <option selected="selected" value=''>Starts with</option> >+ <option value='contain'>Contains</option> >+ </select> >+ > <label for="orderby">Order by:</label> > <select name="orderby" id="searchorderby"> > <option value="">Surname, Firstname</option> >diff --git a/members/member.pl b/members/member.pl >index d25dba9..d705810 100755 >--- a/members/member.pl >+++ b/members/member.pl >@@ -101,13 +101,19 @@ my @searchfields = $searchfields ? split( ',', $searchfields ) : ( "firstname", > $member =~ s/,//g; #remove any commas from search string > $member =~ s/\*/%/g; > >+my $searchtype = $input->param('searchtype'); >+my %searchtype_ok = ( 'contain' => 1 ); >+if ( !defined($searchtype_ok{$searchtype}) ) { >+ undef $searchtype; >+} >+ > my $from = ( $startfrom - 1 ) * $resultsperpage; > my $to = $from + $resultsperpage; > > 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" ); >+ my $search_scope = $searchtype || ( $quicksearch ? "field_start_with" : "start_with" ); > ($results) = Search( $member || $patron, \@orderby, undef, undef, \@searchfields, $search_scope ); > } > >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9407
:
14636
|
14637
|
14659
|
14698
|
14736