Bug 30164 - Header filter not taken into account on the cities view
Summary: Header filter not taken into account on the cities view
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal
Assignee: Jonathan Druart
QA Contact: Tomás Cohen Arazi (tcohen)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-23 14:20 UTC by Jonathan Druart
Modified: 2022-12-12 21:24 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.00,21.11.04,21.05.13
Circulation function:


Attachments
Bug 30164: Fix datatable wrapper when no filter passed (2.32 KB, patch)
2022-02-23 14:27 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 30164: Fix datatable wrapper when no filter passed (2.38 KB, patch)
2022-02-25 06:18 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 30164: Fix datatable wrapper when no filter passed (2.44 KB, patch)
2022-02-25 09:10 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2022-02-23 14:20:56 UTC
The "Search cities" filter in the header is not taken into account and all the cities are displayed.
Comment 1 Jonathan Druart 2022-02-23 14:27:04 UTC
Created attachment 131036 [details] [review]
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.
Comment 2 Fridolin Somers 2022-02-25 06:18:08 UTC
Created attachment 131097 [details] [review]
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>
Comment 3 Tomás Cohen Arazi (tcohen) 2022-02-25 09:10:20 UTC
Created attachment 131104 [details] [review]
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>
Comment 4 Fridolin Somers 2022-03-02 08:49:23 UTC
Pushed to master for 22.05, thanks to everybody involved ﷐[U+1F984]﷑
Comment 5 Kyle M Hall (khall) 2022-03-04 13:22:50 UTC
Pushed to 21.11.x for 21.11.04
Comment 6 Andrew Fuerste-Henry 2022-03-20 15:11:01 UTC
Pushed to 21.05.x for 21.05.13
Comment 7 Victor Grousset/tuxayo 2022-03-21 00:16:59 UTC
Not backported to oldoldstable (20.11.x). Feel free to ask if it's needed.