Bugzilla – Attachment 67883 Details for
Bug 18961
Datatable column filters of style 'select' should do an exact match
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18961: Use exact match for select filters on item search
Bug-18961-Use-exact-match-for-select-filters-on-it.patch (text/plain), 1.55 KB, created by
Jonathan Druart
on 2017-10-10 15:21:47 UTC
(
hide
)
Description:
Bug 18961: Use exact match for select filters on item search
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-10-10 15:21:47 UTC
Size:
1.55 KB
patch
obsolete
>From 1f1e0f4a7787502d1e9487872912926c4b1b703b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 10 Oct 2017 12:18:10 -0300 >Subject: [PATCH] Bug 18961: Use exact match for select filters on item search > >The SQL operator LIKE is always used for filters when searching for >items. > >If the filter is a select, we should search for an exact match. >That way we avoid problematic search like "%NFIC%" and "%FIC%" (one >includes the other one). > >Test plan: >- Make sure you have collection codes 'Fiction' and 'Non-fiction' >- Do an item search >- Filter column 'Collection', select 'Fiction' >- Result: Column contains items from Fiction only >--- > catalogue/itemsearch.pl | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > >diff --git a/catalogue/itemsearch.pl b/catalogue/itemsearch.pl >index c48f2f1aba..369142e1b1 100755 >--- a/catalogue/itemsearch.pl >+++ b/catalogue/itemsearch.pl >@@ -61,9 +61,15 @@ if (defined $format and $format eq 'json') { > my @words = split /\s+/, $sSearch; > foreach my $word (@words) { > push @f, $columns[$i]; >- push @q, "%$word%"; >- push @op, 'like'; > push @c, 'and'; >+ >+ if ( grep /^$columns[$i]$/, qw( ccode homebranch holdingbranch location notforloan ) ) { >+ push @q, "$word"; >+ push @op, '='; >+ } else { >+ push @q, "%$word%"; >+ push @op, 'like'; >+ } > } > } > } >-- >2.11.0
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 18961
:
67883
|
67924
|
68072
|
68258