From 286bbd741b34bb21f5e820658557f2e8b3a0b4de 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. Signed-off-by: Rebecca Coert --- .../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 af13412104..84451e0aa4 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 11eed37437..40b08d0c91 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 19eb3aefb4..801f7dad1e 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