Bugzilla – Attachment 37522 Details for
Bug 13822
Patron autocomplete search is severly limited
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 13822 - Patron autocomplete search is severly limited
PASSED-QA-Bug-13822---Patron-autocomplete-search-i.patch (text/plain), 2.39 KB, created by
Katrin Fischer
on 2015-04-06 10:01:34 UTC
(
hide
)
Description:
[PASSED QA] Bug 13822 - Patron autocomplete search is severly limited
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2015-04-06 10:01:34 UTC
Size:
2.39 KB
patch
obsolete
>From 0f10a7ffb22d1c092cf9caa3b6a4001cfbd1376f Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 27 Mar 2015 11:21:39 -0400 >Subject: [PATCH] [PASSED QA] Bug 13822 - Patron autocomplete search is severly > limited >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >The script that returns data for the patron autocomplete does not use C4::Members::Search. Instead it uses bespoke code that does not behave like the traditional search and is very limited in how it can search. > >If, for example, I search for "Kyle Hall" in the standard search, I would get "Kyle Hall" back as a result. For the autocomplete search, I will not. > >This script should use C4::Members::Search to provide better searching and to keep the code base DRY. > >Test Plan: >1) Enable the system preference CircAutocompl >2) Create a user with the first name "Test" and the surname "User" >3) Perform a checkout autocomplete search for "Test User" >4) Note you do not get the user as a result >5) Apply this patch >6) Try different combinations of "Test" and "User" such as > Test User > User Test > U Test > Test U > etc. >7) Note these searches now work > >Works as expected. >Signed-off-by: Marc Véron <veron@veron.ch> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > circ/ysearch.pl | 23 ++++++++++++++++------- > 1 file changed, 16 insertions(+), 7 deletions(-) > >diff --git a/circ/ysearch.pl b/circ/ysearch.pl >index 8e43b8e..7370b39 100755 >--- a/circ/ysearch.pl >+++ b/circ/ysearch.pl >@@ -51,14 +51,23 @@ if ( C4::Context->preference("IndependentBranches") > $limit_on_branch = 1; > } > >+my @parts = split( / /, $query ); >+my @params; >+foreach my $p (@parts) { >+ push( >+ @params, >+ -or => [ >+ surname => { -like => "$p%" }, >+ firstname => { -like => "$p%" }, >+ cardnumber => { -like => "$p%" }, >+ ] >+ ); >+} >+ >+push( @params, { branchcode => C4::Context->userenv->{branch} } ) if $limit_on_branch; >+ > my $borrowers_rs = Koha::Borrowers->search( >- { -or => { >- surname => { -like => "$query%" }, >- firstname => { -like => "$query%" }, >- cardnumber => { -like => "$query%" }, >- ( $limit_on_branch ? { branchcode => C4::Context->userenv->{branch} } : () ), >- }, >- }, >+ { -and => \@params }, > { > # Get the first 10 results > page => 1, >-- >1.9.1
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 13822
:
36808
|
37009
|
37024
|
37173
|
37177
|
37328
|
37331
| 37522