Bugzilla – Attachment 68072 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: (alternate) Datatable column filters use exact match by default
Bug-18961-alternate-Datatable-column-filters-use-e.patch (text/plain), 3.40 KB, created by
Fridolin Somers
on 2017-10-13 13:08:09 UTC
(
hide
)
Description:
Bug 18961: (alternate) Datatable column filters use exact match by default
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2017-10-13 13:08:09 UTC
Size:
3.40 KB
patch
obsolete
>From 2c6592d8b78b07bd2145b365678a1c588556a543 Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Fri, 13 Oct 2017 14:41:33 +0200 >Subject: [PATCH] Bug 18961: (alternate) Datatable column filters use exact > match by default > >Datatable column filters of type select do not do an exact match. E.g. for a select with values 'Fiction' and 'Non-fiction', filtering after 'Fiction' will match both. > >Similar problems can happen for other column filters of type select as well, see: >jQuery DataTable ColumnFilter plugin. Can the 'select' filter style support exact match? >https://stackoverflow.com/questions/9520423/jquery-datatable-columnfilter-plugin-can-the-select-filter-style-support-exac > >This patch removes the fact that search text in colum filter behaves as 'contains', match is exact by default so that filter with select are good. >For text filters, one can always use whilcards characters like in items search form. >Patch adds an hint text after search results. > >Test plan : >- Apply patch of Bug 16485 - Collection column in Item search is always empty >- Make sure you have collection codes 'Fiction' and 'Non-fiction' >- Do an item search >- Filter column 'Collection', select 'Fiction' >- Result: Column contains items of both collections (Fiction and Non-fiction) >- Choose a barcode from results, for example 123456 >- Search on barcode with '3' of this barcode, you get no result >- Search on barcode with '%3%', you get the barcode in results >--- > catalogue/itemsearch.pl | 11 ++++------- > .../intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt | 8 +++++++- > 2 files changed, 11 insertions(+), 8 deletions(-) > >diff --git a/catalogue/itemsearch.pl b/catalogue/itemsearch.pl >index c48f2f1..433fad3 100755 >--- a/catalogue/itemsearch.pl >+++ b/catalogue/itemsearch.pl >@@ -58,13 +58,10 @@ if (defined $format and $format eq 'json') { > foreach my $i (0 .. ($iColumns - 1)) { > my $sSearch = $cgi->param("sSearch_$i"); > if (defined $sSearch and $sSearch ne '') { >- my @words = split /\s+/, $sSearch; >- foreach my $word (@words) { >- push @f, $columns[$i]; >- push @q, "%$word%"; >- push @op, 'like'; >- push @c, 'and'; >- } >+ push @f, $columns[$i]; >+ push @q, "$sSearch"; >+ push @op, 'like'; >+ push @c, 'and'; > } > } > $cgi->param('f', @f); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >index 5588242..c24cdde 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >@@ -303,9 +303,15 @@ > .append("<h1>" + _("Item search results") + "</h1>") > .append($('<p>').append(advSearchLink)) > .append(editSearchAndExportLinks); >+ >+ var results_footer = $('<p>') >+ .addClass('hint') >+ .html(_("You can use the following wildcard characters: % _")); >+ > $('#results-wrapper').empty() > .append(results_heading) >- .append(table); >+ .append(table) >+ .append(results_footer); > > var params = []; > $form.find('select').not(':disabled').find('option:selected').each(function () { >-- >2.7.4
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