Bug 30164: Fix datatable wrapper when no filter passed
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 23 Feb 2022 14:21:04 +0000 (15:21 +0100)
committerAndrew Fuerste-Henry <andrew@bywatersolutions.com>
Sun, 20 Mar 2022 15:09:37 +0000 (15:09 +0000)
commita87323e2549c6432ee3b55ea1cb9c2f27c942a40
treea596ea0577b0de33935f588fbfb97e85f3b52233
parent062950162c25bf6ffec5c07c457799a8ee348d0a
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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 43dd25e2aa2298bea2a60cacaa8c465cf5f7678c)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/js/datatables.js