Bug 39473 - Drop-down filters on item holdings table should match codes exactly
Summary: Drop-down filters on item holdings table should match codes exactly
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Jonathan Druart
QA Contact: Lucas Gass (lukeg)
URL:
Keywords: rel_24_11_candidate
Depends on: 33568
Blocks: 40118
  Show dependency treegraph
 
Reported: 2025-03-27 16:15 UTC by Emily Lamancusa (emlam)
Modified: 2025-06-11 15:41 UTC (History)
4 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes the dropdown filters for the holdings table in the staff interface. The filters now use an exact match. Example: Items with an item type of BK (Books) and BKA (Other type of book) would both be shown if either was selected in the dropdown list, instead of just the items for the specific item type.
Version(s) released in:
25.05.00
Circulation function:


Attachments
Bug 39473: Add Cypress tests (1.93 KB, patch)
2025-04-22 12:44 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 39473: Use exact search for column filtering with dropdown (1.74 KB, patch)
2025-04-22 12:44 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 39473: Add Cypress tests (3.62 KB, patch)
2025-04-22 14:08 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 39473: Use exact search for column filtering with dropdown (1.79 KB, patch)
2025-04-26 20:03 UTC, David Nind
Details | Diff | Splinter Review
Bug 39473: Add Cypress tests (3.66 KB, patch)
2025-04-26 20:03 UTC, David Nind
Details | Diff | Splinter Review
Bug 39473: Use exact search for column filtering with dropdown (1.84 KB, patch)
2025-05-08 19:28 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 39473: Add Cypress tests (3.72 KB, patch)
2025-05-08 19:28 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Emily Lamancusa (emlam) 2025-03-27 16:15:30 UTC
To reproduce:
0. If not using default KTD data, create an item type with the following settings:
   Item type: BK
   Description: Books
   leave all other values on their defaults

1. Create a new item type with the following settings:
   Item type: BKA
   Description: Other type of book
   leave all other values on their defaults

2. Add or edit items on a bib record so that the record has at least one item of type "Books" and at least one item of type "Another type of book"

3. Go to Normal View for that bib record

4. Click "Show filters" above the item holdings table

5. In the Item type column, filter by "Books"
--> Both "Books" and "Another type of book" items show in the table
--> The drop-down is set to "Other type of book", even though you selected "Books"

The table and drop-down appear matching on item type codes that contain the string "BK", rather than matching on the exact string. I was able to reproduce the bug with branchcodes as well.
Comment 1 Jonathan Druart 2025-04-22 12:44:09 UTC
Created attachment 181258 [details] [review]
Bug 39473: Add Cypress tests
Comment 2 Jonathan Druart 2025-04-22 12:44:12 UTC
Created attachment 181259 [details] [review]
Bug 39473: Use exact search for column filtering with dropdown

We need to use an exact search when using the id of an option.

Test plan:
0. If not using default KTD data, create an item type with the following settings:
   Item type: BK
   Description: Books
   leave all other values on their defaults

1. Create a new item type with the following settings:
   Item type: BKA
   Description: Other type of book
   leave all other values on their defaults

2. Add or edit items on a bib record so that the record has at least one item of type "Books" and at least one item of type "Another type of book"

3. Go to Normal View for that bib record

4. Click "Show filters" above the item holdings table

5. In the Item type column, filter by "Books"
Only "Books" items show in the table
Comment 3 Jonathan Druart 2025-04-22 14:08:12 UTC
Created attachment 181268 [details] [review]
Bug 39473: Add Cypress tests
Comment 4 Jonathan Druart 2025-04-22 14:08:58 UTC
(In reply to Jonathan Druart from comment #3)
> Created attachment 181268 [details] [review] [review]
> Bug 39473: Add Cypress tests

This is not really nice code but I failed to make it pretty.
Comment 5 David Nind 2025-04-26 20:03:47 UTC
Created attachment 181570 [details] [review]
Bug 39473: Use exact search for column filtering with dropdown

We need to use an exact search when using the id of an option.

Test plan:
0. If not using default KTD data, create an item type with the following settings:
   Item type: BK
   Description: Books
   leave all other values on their defaults

1. Create a new item type with the following settings:
   Item type: BKA
   Description: Other type of book
   leave all other values on their defaults

2. Add or edit items on a bib record so that the record has at least one item of type "Books" and at least one item of type "Another type of book"

3. Go to Normal View for that bib record

4. Click "Show filters" above the item holdings table

5. In the Item type column, filter by "Books"
Only "Books" items show in the table

Signed-off-by: David Nind <david@davidnind.com>
Comment 6 David Nind 2025-04-26 20:03:50 UTC
Created attachment 181571 [details] [review]
Bug 39473: Add Cypress tests

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 David Nind 2025-04-26 20:18:05 UTC
Testing notes (using KTD)
1. Tests pass before and after the patch:
   yarn cypress run --spec t/cypress/integration/KohaTable/Holdings_spec.ts
Comment 8 Lucas Gass (lukeg) 2025-05-08 19:28:39 UTC
Created attachment 182109 [details] [review]
Bug 39473: Use exact search for column filtering with dropdown

We need to use an exact search when using the id of an option.

Test plan:
0. If not using default KTD data, create an item type with the following settings:
   Item type: BK
   Description: Books
   leave all other values on their defaults

1. Create a new item type with the following settings:
   Item type: BKA
   Description: Other type of book
   leave all other values on their defaults

2. Add or edit items on a bib record so that the record has at least one item of type "Books" and at least one item of type "Another type of book"

3. Go to Normal View for that bib record

4. Click "Show filters" above the item holdings table

5. In the Item type column, filter by "Books"
Only "Books" items show in the table

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 9 Lucas Gass (lukeg) 2025-05-08 19:28:41 UTC
Created attachment 182110 [details] [review]
Bug 39473: Add Cypress tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 10 Katrin Fischer 2025-05-09 07:14:11 UTC
Pushed for 25.05!

Well done everyone, thank you!