Bug 40565

Summary: Column filters on the item search do not work
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Staff interfaceAssignee: Jonathan Druart <jonathan.druart>
Status: Pushed to stable --- QA Contact: Brendan Lawlor <blawlor>
Severity: normal    
Priority: P5 - low CC: blawlor, gmcharlt, lucas
Version: unspecifiedKeywords: additional_work_needed
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40122
GIT URL: Change sponsored?: ---
Patch complexity: Trivial patch Documentation contact:
Documentation submission: Text to go in the release notes:
This patch fixes a problem that made the column search filters not to work when doing an item search.
Version(s) released in:
25.11.00,25.05.04
Circulation function:
Bug Depends on: 40876    
Bug Blocks: 38311    
Attachments: Bug 40565: Fix column filters on item search
Bug 40565: Fix column filters on item search
Bug 40565: Fix column filters on item search
Bug 40565: (follow-up) Make sure there is a table_node
Revert "Bug 40565: (follow-up) Make sure there is a table_node"
Bug 40565: Correctly fix the retrieval of 'id'

Description Jonathan Druart 2025-07-31 12:55:26 UTC

    
Comment 1 Jonathan Druart 2025-07-31 13:02:26 UTC
Created attachment 184924 [details] [review]
Bug 40565: Fix column filters on item search

The item search table is different from the other tables.
It is using server-side but its own way (not using the REST API).

Test plan:
Search items and filter using the column filters: collections, library,
item types, AVs, etc.

QA: I am not very happy with this patch but, feel free to suggest a
better fix!
Note that "results" was too generic and it felt better to adjust it.
Comment 2 David Nind 2025-08-01 08:16:04 UTC
Created attachment 184973 [details] [review]
Bug 40565: Fix column filters on item search

The item search table is different from the other tables.
It is using server-side but its own way (not using the REST API).

Test plan:
Search items and filter using the column filters: collections, library,
item types, AVs, etc.

QA: I am not very happy with this patch but, feel free to suggest a
better fix!
Note that "results" was too generic and it felt better to adjust it.

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Brendan Lawlor 2025-09-22 19:44:05 UTC
Created attachment 186744 [details] [review]
Bug 40565: Fix column filters on item search

The item search table is different from the other tables.
It is using server-side but its own way (not using the REST API).

Test plan:
Search items and filter using the column filters: collections, library,
item types, AVs, etc.

QA: I am not very happy with this patch but, feel free to suggest a
better fix!
Note that "results" was too generic and it felt better to adjust it.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Comment 4 Brendan Lawlor 2025-09-22 19:53:54 UTC
This works as described.

Since item search doesn't use the API and has its own way of handling parameters it makes sense that the values of the options in the table header dropdowns need to be the plain codes instead of a regex for starting and ending with the code.

Changing the id of the table to item_search to be more specific makes this change to datatables.js more clear.

I like how simple this solution is, and couldn't come up with any alternative. Passing QA.
Comment 5 Lucas Gass (lukeg) 2025-09-23 22:24:39 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 6 Lucas Gass (lukeg) 2025-09-24 21:18:58 UTC
This is causing a problem with the datatable on http://localhost:8081/cgi-bin/koha/acquisition/vendors:

Uncaught (in promise) TypeError: table_node.attr is not a function

I think it's maybe responsible for the failures I see here also:

https://jenkins.koha-community.org/job/Koha_Main/lastCompletedBuild/testReport/
Comment 7 Lucas Gass (lukeg) 2025-09-24 22:10:10 UTC
Created attachment 186903 [details] [review]
Bug 40565: (follow-up) Make sure there is a table_node
Comment 8 Jonathan Druart 2025-09-25 07:59:05 UTC
I am working a follow-ups.
Comment 9 Jonathan Druart 2025-09-25 10:38:28 UTC
Created attachment 186911 [details] [review]
Revert "Bug 40565: (follow-up) Make sure there is a table_node"

This reverts commit addd5e3a0d32e227834c02c2b16ac735decb80fa.
Comment 10 Jonathan Druart 2025-09-25 10:38:30 UTC
Created attachment 186912 [details] [review]
Bug 40565: Correctly fix the retrieval of 'id'

For other tables than those from Vue apps, table_node is the node and we
need to retrieve the object before accessing the attr function
Comment 11 Jonathan Druart 2025-09-25 10:40:14 UTC
Found a separate bug that was linked to the last failure.

It needs to be pushed before the last 2 patches.

Lucas: please push the patch from bug 40876 then:
 Revert "Bug 40565: (follow-up) Make sure there is a table_node"
 Bug 40565: Correctly fix the retrieval of 'id'
Comment 12 Jonathan Druart 2025-09-25 10:41:52 UTC
After this you should run
prove t/db_dependent/selenium/patrons_search.t
cypress run --spec t/cypress/integration/ERM/Licenses_spec.ts 
cypress run --spec t/cypress/integration/KohaTable/PatronSearch_spec.ts

They must all pass
Comment 13 Lucas Gass (lukeg) 2025-09-25 17:09:35 UTC
Follow-ups here pushed to main.
Comment 14 Lucas Gass (lukeg) 2025-09-25 17:10:01 UTC
(In reply to Jonathan Druart from comment #11)
> Found a separate bug that was linked to the last failure.
> 
> It needs to be pushed before the last 2 patches.
> 
> Lucas: please push the patch from bug 40876 then:
>  Revert "Bug 40565: (follow-up) Make sure there is a table_node"
>  Bug 40565: Correctly fix the retrieval of 'id'

I have pushed in this order.
Comment 15 Paul Derscheid 2025-09-25 17:34:35 UTC
Nice work everyone!

Pushed to 25.05.x