Bug 29878

Summary: Use multiple select widget for AdvancedSearchTypes system preference
Product: Koha Reporter: Owen Leonard <oleonard>
Component: System AdministrationAssignee: Owen Leonard <oleonard>
Status: CLOSED WONTFIX QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: fridolin.somers, gmcharlt
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 29878: Use multiple select widget for AdvancedSearchTypes system preference
Bug 29878: Use multiple select widget for AdvancedSearchTypes system preference
Bug 29878: Use multiple select widget for AdvancedSearchTypes system preference
Bug 29878: (follow-up) Fix opac-topissues.pl
Bug 29878: (follow-up) Change system preference type to multiple

Description Owen Leonard 2022-01-13 17:34:25 UTC
The AdvancedSearchTypes system preference asks for pipe-delimited text, which isn't very user-friendly. We can use a multiple-select widget (as used for  OpacAdvSearchOptions for example) to allow the user to select one or more predefined options.
Comment 1 Owen Leonard 2022-01-13 17:56:29 UTC
Created attachment 129429 [details] [review]
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.
Comment 2 Lucas Gass (lukeg) 2022-01-13 18:14:03 UTC
Created attachment 129431 [details] [review]
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 <lucas@bywatersolutions.com>
Comment 3 Jonathan Druart 2022-01-19 12:55:59 UTC
Created attachment 129603 [details] [review]
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 <lucas@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 4 Fridolin Somers 2022-01-29 02:08:45 UTC
Created attachment 129963 [details] [review]
Bug 29878: (follow-up) Fix opac-topissues.pl

This page is using the preference AdvancedSearchTypes with wrong split character

Test plan :
1) Enable preference OpacTopissue
2) In OPAC click on 'Most popular'
3) Check you see filters on ccode and/or itemtype when they are in AdvancedSearchTypes
Comment 5 Fridolin Somers 2022-01-29 02:09:03 UTC
Created attachment 129964 [details] [review]
Bug 29878: (follow-up) Change system preference type to multiple

AdvancedSearchTypes type must be changed from 'Choice' to 'multiple'.
'Choice' was in fact not the correct type.

Also fix options even if they are useless.
Other multiple preferences set them.

Also replaces split /\,/ with /,/
There is no need to escape.
Comment 6 Fridolin Somers 2022-01-29 02:17:16 UTC
This needs a bit more work.

We see in preference description (searching.pref) :
  Tabs appear in the order listed.

Looks like it is not valid :
Values defined in preference are 'itemtypes,ccode,loc'
I see in system preference page :
    Collection
    Item type
    Shelving location

Is it alphabetical ?

When I select all and save value changes to 'ccode,itemtypes,loc';

Values can not be ordered anymore, we should remove this text.
Comment 7 Katrin Fischer 2022-01-29 22:34:32 UTC
I don't think we should remove the ability to have the tabs appear in the order the library likes. If we can't do this with the multi select, we should not use it. Could we do something similar like we have for the languages? You can check/uncheck and order them.
Comment 8 Katrin Fischer 2022-01-29 22:36:55 UTC
It does work in 20.11: ccode|loc|itemtypes makes the tabs appear in this order in the OPAC.