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>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Lucas Gass 2025-02-24 20:44:07 +00:00 committed by Katrin Fischer
parent 9a55785c8b
commit 04f398890e
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
3 changed files with 18 additions and 4 deletions

View File

@ -50,8 +50,13 @@
[% BLOCK items_table %]
<div class="[% tab | html %]_table_table_controls">
<span class="show_hide_filters">
<button class="btn btn-link show_filters" data-tab="[% tab | html %]"><i class="fa fa-filter"></i> Show filters</button>
<button class="btn btn-link hide_filters" data-tab="[% tab | html %]" style="display: none;"><i class="fa fa-filter"></i> Hide filters</button>
[% IF Koha.Preference('AlwaysShowHoldingsTableFilters') %]
<button class="btn btn-link show_filters" data-tab="[% tab | html %]" style="display: none;"><i class="fa fa-filter"></i> Show filters</button>
<button class="btn btn-link hide_filters" data-tab="[% tab | html %]"><i class="fa fa-filter"></i> Hide filters</button>
[% ELSE %]
<button class="btn btn-link show_filters" data-tab="[% tab | html %]"><i class="fa fa-filter"></i> Show filters</button>
<button class="btn btn-link hide_filters" data-tab="[% tab | html %]" style="display: none;"><i class="fa fa-filter"></i> Hide filters</button>
[% END %]
</span>
<button class="btn btn-link SelectAll" data-tab="[% tab | html %]"><i class="fa fa-check"></i> Select all</button>
<button class="btn btn-link ClearAll" data-tab="[% tab | html %]"><i class="fa fa-times"></i> Clear all</button>

View File

@ -294,6 +294,12 @@ Cataloging:
homebranch: 'home library'
holdingbranch: 'holding library'
- "is the logged in user's library. The second tab will contain all other items."
-
- pref: AlwaysShowHoldingsTableFilters
choices:
1: "Do"
0: "Don't"
- always show filters by default on the holdings table in the record details page.
-
- "Don't show"
- pref: NotesToHide

View File

@ -2039,8 +2039,11 @@
// Early return if the tab is not shown (ie. no table)
if (!$("#%s-tab".format(tab_id)).length) return;
build_items_table(tab_id, false, {}, build_items_table_drawncallback);
[% IF Koha.Preference('AlwaysShowHoldingsTableFilters') %]
build_items_table(tab_id, true, {}, build_items_table_drawncallback);
[% ELSE %]
build_items_table(tab_id, false, {}, build_items_table_drawncallback);
[% END %]
[% IF bundlesEnabled %]
// Add event listener for opening and closing bundle details