From 7d301ce6b3a4bdb008816c26258c18be8e0b3ebd Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Mon, 24 Feb 2025 20:44:07 +0000 Subject: [PATCH] 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. --- .../html_helpers/tables/items/catalogue_detail.inc | 9 +++++++-- .../prog/en/modules/admin/preferences/cataloguing.pref | 6 ++++++ .../intranet-tmpl/prog/en/modules/catalogue/detail.tt | 7 +++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc index 3959fee4436..922f9cddade 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc @@ -50,8 +50,13 @@ [% BLOCK items_table %]
- - + [% IF Koha.Preference('AlwaysShowHoldingsTableFilters') %] + + + [% ELSE %] + + + [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref index 11eed374376..40b08d0c91d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref @@ -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 diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 19eb3aefb48..801f7dad1ea 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -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 -- 2.39.5