From d283f35ed8b60b64a7466b1726b3cf1cbcd80e7b Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 13 Jan 2022 17:48:25 +0000 Subject: [PATCH] Bug 29878: Use multiple select widget for AdvancedSearchTypes system preference This patch updates system preferences so that the AdvancedSearchTypes preference uses a multiple-select widget. This lets users select one or more checkboxes in a dropdown rather than requiring that they enter pipe-delimited text. To test, apply the patch and run updatedatabase. - Go to Administration -> System Preferences and search for 'AdvancedSearchTypes' - The input should be styled as a multiple-select widget. Test that you can select one, more, or all of the options. - Test that your selections are saved successfully and that the changes are reflected on the OPAC and staff interface advanced search pages. Signed-off-by: Lucas Gass Signed-off-by: Jonathan Druart --- catalogue/search.pl | 2 +- installer/data/mysql/atomicupdate/bug-29878.pl | 15 +++++++++++++++ .../en/modules/admin/preferences/searching.pref | 10 ++++++---- opac/opac-search.pl | 2 +- 4 files changed, 23 insertions(+), 6 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug-29878.pl diff --git a/catalogue/search.pl b/catalogue/search.pl index 5da9c063f3b..a5419bf3e58 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -720,7 +720,7 @@ It also accounts for the "item-level_itypes" system preference. sub prepare_adv_search_types { my ($types) = @_; - my @advanced_search_types = split( /\|/, $types ); + my @advanced_search_types = split( /\,/, $types ); # the index parameter is different for item-level itemtypes my $itype_or_itemtype = diff --git a/installer/data/mysql/atomicupdate/bug-29878.pl b/installer/data/mysql/atomicupdate/bug-29878.pl new file mode 100755 index 00000000000..f8a9ce7d8b1 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug-29878.pl @@ -0,0 +1,15 @@ +use Modern::Perl; + +return { + bug_number => "29878", + description => "Use multiple select for AdvancedSearchTypes system preference", + up => sub { + my ($args) = @_; + my $dbh = $args->{dbh}; + + $dbh->do(q{ + UPDATE systempreferences SET value = REPLACE(value, '|', ',') + WHERE variable IN ('AdvancedSearchTypes') + }); + }, +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref index a0d7ec430da..f589b75cd67 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref @@ -96,11 +96,13 @@ Searching: 0: "Don't add" - search history of the unlogged user to the next patron logging in. - - - Show tabs in the OPAC and staff interface advanced search for limiting searches on the + - Show tabs in the OPAC and staff interface advanced search for limiting searches by - pref: AdvancedSearchTypes - class: long - - "fields (separate values with |). Tabs appear in the order listed.
" - - "Currently supported values: Item types (itemtypes), Collection Codes (ccode) and Shelving Location (loc)." + multiple: + itemtypes: Item type + ccode: Collection + loc: Shelving location + - "Tabs appear in the order listed.
" - - Limit the languages listed in the advanced search drop-down to the - pref: AdvancedSearchLanguages diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 8d5fe07bc00..5fd4be435ec 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -240,7 +240,7 @@ my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':' my @advancedsearchesloop; my $cnt; my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes") || "itemtypes"; -my @advanced_search_types = split(/\|/, $advanced_search_types); +my @advanced_search_types = split(/\,/, $advanced_search_types); my $hidingrules = C4::Context->yaml_preference('OpacHiddenItems') // {}; -- 2.25.1