Bugzilla – Attachment 131097 Details for
Bug 30164
Header filter not taken into account on the cities view
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30164: Fix datatable wrapper when no filter passed
Bug-30164-Fix-datatable-wrapper-when-no-filter-pas.patch (text/plain), 2.38 KB, created by
Fridolin Somers
on 2022-02-25 06:18:08 UTC
(
hide
)
Description:
Bug 30164: Fix datatable wrapper when no filter passed
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2022-02-25 06:18:08 UTC
Size:
2.38 KB
patch
obsolete
>From 0d99b4459549e67029461acb63f2040895945680 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 23 Feb 2022 15:21:04 +0100 >Subject: [PATCH] Bug 30164: Fix datatable wrapper when no filter passed > >This problem appears (at least) on the cities list view: >If you pass a filter in the "Search cities" filter in the header, it >won't be taken into account and all the cities will be displayed. > >There are two problems. First we are passing an "empty" q=[] in the >body, the filter from the header is passed as URL parameters. We should >not need to pass the q if it's empty. >Then the main problem is coming from a bug in >Koha::REST::Plugin::Query but I didn't manage to track it down. If we >have two 2 passed, only the second one will be used. We are certainly >using a hash somewhere we should not. > >This patch is fixing the bug but not on the correct side. A follow-up >bug should take care of the main problem at lower level. > >Test plan: >Hit /admin/cities.pl >Create some cities >Use the filter in the header of the page and submit >=> Without this patch all cities are retrieved >=> With this patch applied only the relevant cities are displayed. > >Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> >--- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index c95a972328..2d88fcdd05 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -602,7 +602,10 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { > and_query_parameters.push(default_filters); > } > query_parameters = and_query_parameters; >- query_parameters.push(or_query_parameters); >+ if ( or_query_parameters.length) { >+ query_parameters.push(or_query_parameters); >+ } >+ > if(query_parameters.length) { > query_parameters = JSON.stringify(query_parameters.length === 1?query_parameters[0]:{"-and": query_parameters}); > if(options.header_filter) { >-- >2.35.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 30164
:
131036
|
131097
|
131104