From bb09f41808f1e2fbb794d35731def56ee9f29d02 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Wed, 22 Nov 2023 02:34:08 +0000 Subject: [PATCH] Bug 35372: Add support for OpacAdvancedSearchTypes to be empty and disabled This enhancement makes it possible to leave the OpacAdvancedSearchTypes system preference empty if your library would like to disable the item filter tabs available on the OPAC advanced search. It also adds a message to the system preference description to describe this. To test: 1. Go to Koha Administration -> system preferences. Search for the OpacAdvancedSearchTypes system preference and remove its contents, so it is saved empty. 2. Go to advanced search in the OPAC. Notice the item types tab still shows as a filter option. 3. Apply the patch, restart services and refresh the advanced search 4. Confirm the item types tab no longer shows. 5. Add something back to the OpacAdvancedSearchTypes system preference i.e. itemtypes, ccode 6. Go back to advanced search and confirm your expected tabs show as normal Sponsored-by: Education Services Australia SCIS --- .../intranet-tmpl/prog/en/modules/admin/preferences/opac.pref | 3 ++- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt | 2 +- opac/opac-search.pl | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index a68e7eaa2d3..f6aee05b702 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -929,7 +929,8 @@ OPAC: - pref: OpacAdvancedSearchTypes class: long - "fields (separate values with |). Tabs appear in the order listed.
" - - "Currently supported values: Item types (itemtypes), Collection, (ccode) and Shelving location (loc)." + - "Currently supported values: Item types (itemtypes), Collection, (ccode) and Shelving location (loc).
" + - Leave empty to disable these tabs in the OPAC advanced search. Authentication: - - pref: OPACShibOnly diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt index 21d4d1b0251..a8dff2fa6db 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt @@ -155,7 +155,7 @@
[%# Following on one line for translatability %] - [% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('itemtype').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('itemtype').size > 0 and expanded_options ) ) %] + [% IF advancedsearchesloop and ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('itemtype').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('itemtype').size > 0 and expanded_options ) ) %]
[% WRAPPER tabs id= "advsearches" %] [% WRAPPER tabs_nav %] diff --git a/opac/opac-search.pl b/opac/opac-search.pl index ae864ee30cf..02489bff0ed 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -248,7 +248,7 @@ foreach my $itemtype ( keys %{$itemtypes} ) { my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype'; my @advancedsearchesloop; my $cnt; -my $advanced_search_types = C4::Context->preference("OpacAdvancedSearchTypes") || "itemtypes"; +my $advanced_search_types = C4::Context->preference("OpacAdvancedSearchTypes"); my @advanced_search_types = split(/\|/, $advanced_search_types); my $hidingrules = C4::Context->yaml_preference('OpacHiddenItems') // {}; -- 2.30.2