Bug 38108 - Make display of table filters in staff interface holdings table configurable
Summary: Make display of table filters in staff interface holdings table configurable
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Lucas Gass (lukeg)
QA Contact: Emily Lamancusa (emlam)
URL:
Keywords:
Depends on: 33568 38071
Blocks: 39315
  Show dependency treegraph
 
Reported: 2024-10-07 19:52 UTC by David Nind
Modified: 2025-03-23 14:16 UTC (History)
10 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This patch adds a new system preference called 'AlwaysShowHoldingsTableFilters'. This system preference allows staff to control the behavior of the filters on the items detail page. It can be set to either always show the filters by default or to never show the filters by default.
Version(s) released in:
25.05.00,24.11.03
Circulation function:


Attachments
Bug 38108: Add system preference AlwaysShowHoldingsTableFilters (2.55 KB, patch)
2025-02-24 20:48 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 38108: Add ability to show/hide table filters via system preference (4.70 KB, patch)
2025-02-24 20:48 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 38108: Add system preference AlwaysShowHoldingsTableFilters (2.60 KB, patch)
2025-02-25 16:43 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 38108: Add ability to show/hide table filters via system preference (4.74 KB, patch)
2025-02-25 16:43 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 38108: Add system preference AlwaysShowHoldingsTableFilters (2.67 KB, patch)
2025-02-25 20:33 UTC, Emily Lamancusa (emlam)
Details | Diff | Splinter Review
Bug 38108: Add ability to show/hide table filters via system preference (4.81 KB, patch)
2025-02-25 20:33 UTC, Emily Lamancusa (emlam)
Details | Diff | Splinter Review
Bug 38108: (QA follow-up) Use say_success in dbrev (2.32 KB, patch)
2025-02-25 20:33 UTC, Emily Lamancusa (emlam)
Details | Diff | Splinter Review
Bug 38108: Add Cypress tests (8.46 KB, patch)
2025-03-11 15:57 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Nind 2024-10-07 19:52:05 UTC
In current main (October 2024), the holdings table for a record in the staff interface does not show the standard DataTable navigation elements until "Show filters" is clicked.

I think that the standard table navigation elements should be shown by default.

To replicate:

1. Go to a record in the staff interface with multiple items (for example record 146, The definitive guide to Catalyst : writing extensible, scalable, and maintainable Perl-based Web applications <staffinterfaceurl>/cgi-bin/koha/catalogue/detail.pl?biblionumber=146).

2. In the holdings table section, note that you have to click on "Show filters" for the standard table navigation elements to display:

   Showing 1 to 4 of 4 entries
   -------------------------------------
   Show 20 entries First Previous Next Last Search: _______ Clear filter
   ....

Other notes:
1. Behavour for previous versions - note that before 24.05.00 and bug 33568, all items were shown without any pagination, even for hundreds of items:
   . 24.05.00: navigation only shown once "Show filters" is clicked
   . 23.11.06: partial table navigation "Showing 1 of 1 entries Search______ Clear filter"
   . 23.05.14: the same as 23.11.06
2. Bug 33568 - Use the REST API to display items on the staff biblio detail view: totally rewrote the display of the items table
Comment 1 Jonathan Druart 2024-10-08 14:12:26 UTC
It is displayed if needed.

The idea here is to keep the UI as minimal as possible.
If length is 20 and you have <= 20 items, the pagination won't be displayed.

If you have more, the pagination will be displayed even if "Show filters" is not clicked.
Comment 2 Aleisha Amohia 2024-12-02 19:06:19 UTC
It would be good to have the option to show filters by default - this setting could be stored in localStorage (similar to how Koha can remember to show checkouts by default)
Comment 3 Lucas Gass (lukeg) 2024-12-02 19:46:50 UTC
(In reply to Jonathan Druart from comment #1)
> It is displayed if needed.
> 
> The idea here is to keep the UI as minimal as possible.
> If length is 20 and you have <= 20 items, the pagination won't be displayed.
> 
> If you have more, the pagination will be displayed even if "Show filters" is
> not clicked.

They display if needed, I don't think we need anything else. What would be the use case for showing filters that don't do anything?
Comment 4 Miranda Nero 2025-02-07 16:54:25 UTC
We have our items set to display 50 items per page to get as many libraries showing on the first page as possible without bogging down the loading time. We use the search box to narrow down those items quickly by barcode, for example, rather than visually search to find it. We would appreciate the option to have the filters show by default even when there are less than 50 items. It makes sense for the page navigation to only show when useful, but the search box should be separate.
Comment 5 Jonathan Druart 2025-02-10 11:48:55 UTC
(In reply to Miranda Nero from comment #4)
> We have our items set to display 50 items per page to get as many libraries
> showing on the first page as possible without bogging down the loading time.
> We use the search box to narrow down those items quickly by barcode, for
> example, rather than visually search to find it. We would appreciate the
> option to have the filters show by default even when there are less than 50
> items. It makes sense for the page navigation to only show when useful, but
> the search box should be separate.

How do you do that? In Javascript?

The main "Search" box is displayed (in last in 'main') even if all items are displayed. Which version are you using?
Comment 6 Miranda Nero 2025-02-10 16:00:02 UTC
(In reply to Jonathan Druart from comment #5)
> How do you do that? In Javascript?
> 
> The main "Search" box is displayed (in last in 'main') even if all items are
> displayed. Which version are you using?

We changed the "Default display length" to 50 in the otherholdings_table settings. The search box only shows for us on bibs that have 51+ items in the other holdings tab. I just did a little more testing and narrowed down the behavior even more to this happening if your logged in library does not have any holdings. When the "Other holdings" tab is the only tab showing and there are 50 or fewer items in it, the search bar disappears.
Comment 7 Jonathan Druart 2025-02-11 09:34:46 UTC
(In reply to Miranda Nero from comment #6)
> (In reply to Jonathan Druart from comment #5)
> > How do you do that? In Javascript?
> > 
> > The main "Search" box is displayed (in last in 'main') even if all items are
> > displayed. Which version are you using?
> 
> We changed the "Default display length" to 50 in the otherholdings_table
> settings. The search box only shows for us on bibs that have 51+ items in
> the other holdings tab. I just did a little more testing and narrowed down
> the behavior even more to this happening if your logged in library does not
> have any holdings. When the "Other holdings" tab is the only tab showing and
> there are 50 or fewer items in it, the search bar disappears.

Seems to work for me on "main": https://snipboard.io/AW8Jgo.jpg
Comment 8 Miranda Nero 2025-02-12 15:53:36 UTC
(In reply to Jonathan Druart from comment #7)
> (In reply to Miranda Nero from comment #6)
> > (In reply to Jonathan Druart from comment #5)
> > > How do you do that? In Javascript?
> > > 
> > > The main "Search" box is displayed (in last in 'main') even if all items are
> > > displayed. Which version are you using?
> > 
> > We changed the "Default display length" to 50 in the otherholdings_table
> > settings. The search box only shows for us on bibs that have 51+ items in
> > the other holdings tab. I just did a little more testing and narrowed down
> > the behavior even more to this happening if your logged in library does not
> > have any holdings. When the "Other holdings" tab is the only tab showing and
> > there are 50 or fewer items in it, the search bar disappears.
> 
> Seems to work for me on "main": https://snipboard.io/AW8Jgo.jpg

Strange - here's what I see on our main site: https://snipboard.io/L7M9Ch.jpg
Comment 9 Lisette Scheer 2025-02-18 20:51:35 UTC
This also means the "clear filter" link doesn't show, though there is an x in the search box that works to clear it, it only shows while you're in the box or hovering.
Comment 10 Lucas Gass (lukeg) 2025-02-24 18:57:27 UTC
Whatever is done here should be done on top of Bug 37334.
Comment 11 Lucas Gass (lukeg) 2025-02-24 19:20:36 UTC
(In reply to Aleisha Amohia from comment #2)
> It would be good to have the option to show filters by default - this
> setting could be stored in localStorage (similar to how Koha can remember to
> show checkouts by default)

In this case I think I prefer a system preference because localStorage would be cleared on logout which might be annoying for staff. 

The 'checkouss by default' that you mention is controlled via sys pref, AlwaysLoadCheckoutsTable
Comment 12 Lucas Gass (lukeg) 2025-02-24 20:48:04 UTC
Created attachment 178638 [details] [review]
Bug 38108: Add system preference AlwaysShowHoldingsTableFilters
Comment 13 Lucas Gass (lukeg) 2025-02-24 20:48:06 UTC
Created attachment 178639 [details] [review]
Bug 38108: Add ability to show/hide table filters via system preference

To test:
1. APPLY PATCH, updatedatabase, restart_all
2. Search for the 'AlwaysShowHoldingsTableFilters' system preference. It should be set to 'Don't'.
3. Without changing the system preference, go to a record detail page.
4. The filters should not show by default.
5. Make sure that toggling the Hide filters/Show filters button still work as expected.
6. Set 'AlwaysShowHoldingsTableFilters' to 'Do'.
7. Now the filters should show by default when you load the table.
8. Make sure that toggling the Hide filters/Show filters button still work as expected.
Comment 14 Lucas Gass (lukeg) 2025-02-24 20:51:33 UTC
(In reply to Lucas Gass (lukeg) from comment #10)
> Whatever is done here should be done on top of Bug 37334.

This doesn't conflict with Bug 37334 so I am removing that dependency.
Comment 15 Andrew Fuerste-Henry 2025-02-25 16:43:04 UTC
Created attachment 178691 [details] [review]
Bug 38108: Add system preference AlwaysShowHoldingsTableFilters

Signed-off-by: Rebecca Coert <rcoert@arlingtonva.us>
Comment 16 Andrew Fuerste-Henry 2025-02-25 16:43:07 UTC
Created attachment 178692 [details] [review]
Bug 38108: Add ability to show/hide table filters via system preference

To test:
1. APPLY PATCH, updatedatabase, restart_all
2. Search for the 'AlwaysShowHoldingsTableFilters' system preference. It should be set to 'Don't'.
3. Without changing the system preference, go to a record detail page.
4. The filters should not show by default.
5. Make sure that toggling the Hide filters/Show filters button still work as expected.
6. Set 'AlwaysShowHoldingsTableFilters' to 'Do'.
7. Now the filters should show by default when you load the table.
8. Make sure that toggling the Hide filters/Show filters button still work as expected.

Signed-off-by: Rebecca Coert <rcoert@arlingtonva.us>
Comment 17 Emily Lamancusa (emlam) 2025-02-25 20:33:00 UTC
Created attachment 178694 [details] [review]
Bug 38108: Add system preference AlwaysShowHoldingsTableFilters

Signed-off-by: Rebecca Coert <rcoert@arlingtonva.us>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 18 Emily Lamancusa (emlam) 2025-02-25 20:33:03 UTC
Created attachment 178695 [details] [review]
Bug 38108: Add ability to show/hide table filters via system preference

To test:
1. APPLY PATCH, updatedatabase, restart_all
2. Search for the 'AlwaysShowHoldingsTableFilters' system preference. It should be set to 'Don't'.
3. Without changing the system preference, go to a record detail page.
4. The filters should not show by default.
5. Make sure that toggling the Hide filters/Show filters button still work as expected.
6. Set 'AlwaysShowHoldingsTableFilters' to 'Do'.
7. Now the filters should show by default when you load the table.
8. Make sure that toggling the Hide filters/Show filters button still work as expected.

Signed-off-by: Rebecca Coert <rcoert@arlingtonva.us>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 19 Emily Lamancusa (emlam) 2025-02-25 20:33:05 UTC
Created attachment 178696 [details] [review]
Bug 38108: (QA follow-up) Use say_success in dbrev

Use say_success instead of say when outputting a line that the
system preference was added successfully

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 20 Emily Lamancusa (emlam) 2025-02-25 20:34:41 UTC
Nice quality of life enhancement, thanks Lucas! Passing QA
Comment 21 Katrin Fischer 2025-02-26 11:55:53 UTC
It's kind of funny that first we remove the pref to show the filters and now we reintroduce it again? Can't find the old bug now, but this rings a bell..
Comment 22 Katrin Fischer 2025-02-26 12:01:24 UTC
Amended system preference description to mention staff interface.
Comment 23 Katrin Fischer 2025-02-26 12:19:42 UTC
Pushed for 25.05!

Well done everyone, thank you!
Comment 24 Lucas Gass (lukeg) 2025-03-03 23:40:23 UTC
Can this be backported to 24.11?
Comment 25 Jonathan Druart 2025-03-04 11:27:38 UTC
(In reply to Katrin Fischer from comment #21)
> It's kind of funny that first we remove the pref to show the filters and now
> we reintroduce it again? Can't find the old bug now, but this rings a bell..

I don't remember we had a syspref.

(In reply to Lucas Gass (lukeg) from comment #11)
> (In reply to Aleisha Amohia from comment #2)
> > It would be good to have the option to show filters by default - this
> > setting could be stored in localStorage (similar to how Koha can remember to
> > show checkouts by default)
> 
> In this case I think I prefer a system preference because localStorage would
> be cleared on logout which might be annoying for staff. 

But I don't understand the use case here, could you explain please?

If there is no pagination does it still makes sense to display them?

> The 'checkouss by default' that you mention is controlled via sys pref,
> AlwaysLoadCheckoutsTable

Controlled by a syspref for the default behaviour, but then is stored in localStorage (The "Always show checkouts automatically" checkbox).
Comment 26 Katrin Fischer 2025-03-04 13:08:30 UTC
I think the question was about displaying the filters and if you set "per page" to a higher value, you will still want to see the filters, not necessarily the paging.
Comment 27 Lucas Gass (lukeg) 2025-03-04 14:13:49 UTC
> But I don't understand the use case here, could you explain please?
> 
> If there is no pagination does it still makes sense to display them?

I think pagination controls is only part of this. From my understanding staff wanted to have the ability to see the other controls by default. The filters for home/holding library, collection, etc without having to click 'Show filters' each time.
Comment 28 Jonathan Druart 2025-03-11 15:57:00 UTC
Created attachment 179171 [details] [review]
Bug 38108: Add Cypress tests
Comment 29 Jonathan Druart 2025-03-11 15:57:27 UTC
I am really not convinced by this change. And don't think it should be driven by a syspref.

However any changes made to this page must be covered by tests please.
Comment 30 Jonathan Druart 2025-03-11 16:06:20 UTC
(In reply to Jonathan Druart from comment #29)
> I am really not convinced by this change. And don't think it should be
> driven by a syspref.
> 
> However any changes made to this page must be covered by tests please.

Tests that I have added in the previous patch, I am not asking anything (for this time :D).
Comment 31 Katrin Fischer 2025-03-17 07:28:13 UTC
Pushed for 25.05!

Well done everyone, thank you!
Comment 32 Paul Derscheid 2025-03-23 14:09:20 UTC
Nice work everyone!

Pushed to 24.11.x for 24.11.03