Bugzilla – Attachment 29825 Details for
Bug 12595
Finding a patron witht firstname and surname should display the patron detail
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 12595: Search a patron by his/her firstname and surname
PASSED-QA-Bug-12595-Search-a-patron-by-hisher-firs.patch (text/plain), 2.92 KB, created by
Kyle M Hall (khall)
on 2014-07-18 12:08:57 UTC
(
hide
)
Description:
[PASSED QA] Bug 12595: Search a patron by his/her firstname and surname
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-07-18 12:08:57 UTC
Size:
2.92 KB
patch
obsolete
>From 08554e248696e3af91169b3f19a051feac8bea79 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Thu, 17 Jul 2014 13:26:46 +0200 >Subject: [PATCH] [PASSED QA] Bug 12595: Search a patron by his/her firstname and surname > >Before bug 9811, if you searched for "John Doe" and only 1 patron with >this firstname/surname existed, the patron detail page was displayed. > >Now the result lists all patrons with ( firstname=john or doe ) or ( >surname=john or doe). Which is quite annoying when you expect only 1 >result. > >Test plan: >0/ Create some patrons like: "John Doe", "Jane Doe", "John Smith". >1/ Search for "John Doe" in the patron search box >2/ Verify you got 2 results >3/ Apply the patch >4/ Search for "John Doe" in the patron search box >5/ Verify you are redirected to the right patron detail page. > >Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Utils/DataTables/Members.pm | 25 +++++++++++++------------ > 1 files changed, 13 insertions(+), 12 deletions(-) > >diff --git a/C4/Utils/DataTables/Members.pm b/C4/Utils/DataTables/Members.pm >index 992d67f..c52007a 100644 >--- a/C4/Utils/DataTables/Members.pm >+++ b/C4/Utils/DataTables/Members.pm >@@ -54,7 +54,6 @@ sub search { > > # split on coma > $searchmember =~ s/,/ /g if $searchmember; >- my @where_strs_or; > my $searchfields = { > standard => 'surname,firstname,othernames,cardnumber', > email => 'email,emailpro,B_email', >@@ -65,21 +64,23 @@ sub search { > sort1 => 'sort1', > sort2 => 'sort2', > }; >- for my $searchfield ( split /,/, $searchfields->{$searchfieldstype} ) { >- foreach my $term ( split / /, $searchmember) { >- next unless $term; >- $searchmember =~ s/\*/%/g; # * is replaced with % for sql >- $term .= '%' # end with anything >- if $term !~ /%$/; >- $term = "%$term" # begin with anythin unless start_with >- if $term !~ /^%/ >- and $searchtype eq "contain"; >+ foreach my $term ( split / /, $searchmember) { >+ next unless $term; >+ $searchmember =~ s/\*/%/g; # * is replaced with % for sql >+ $term .= '%' # end with anything >+ if $term !~ /%$/; >+ $term = "%$term" # begin with anythin unless start_with >+ if $term !~ /^%/ >+ and $searchtype eq "contain"; >+ my @where_strs_or; >+ for my $searchfield ( split /,/, $searchfields->{$searchfieldstype} ) { > push @where_strs_or, "borrowers." . $dbh->quote_identifier($searchfield) . " LIKE ?"; > push @where_args, $term; > } >+ >+ push @where_strs, '('. join (' OR ', @where_strs_or) . ')' >+ if @where_strs_or; > } >- push @where_strs, '('. join (' OR ', @where_strs_or) . ')' >- if @where_strs_or; > > my $where; > $where = " WHERE " . join (" AND ", @where_strs) if @where_strs; >-- >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 12595
:
29799
|
29801
| 29825 |
29852
|
29855
|
29857
|
29858