Bug 37442

Summary: Add customizable dropdown selections for the advanced search filters
Product: Koha Reporter: Sam Lau <samalau>
Component: SearchingAssignee: Sam Lau <samalau>
Status: Failed QA --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: lucas
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 37442: Add customizable dropdown selections for the advanced search filters
Bug 37442: Add customizable dropdown selections for the advanced search filters

Description Sam Lau 2024-07-23 21:54:00 UTC
It would be useful if we could customize the options for the dropdown selections in the advanced search filters. Currently, the options are hard-coded with a large list of options for each dropdown, making it difficult to adjust which options are shown, the way they are ordered, etc.
Comment 1 Sam Lau 2024-07-23 21:56:06 UTC
Created attachment 169448 [details] [review]
Bug 37442: Add customizable dropdown selections for the advanced search filters

To test:
1) Apply patch, restart_all
2) Visit Tools->HTML customizations
3) Click 'New entry using text editor'
4) For 'Display location', select "StaffAdvancedSearchList"
5) Make the publication date today.
6) For the content, put some dropdown options... you can paste in this block for example:

<option value="au">Author</option>
<option value="ti">Title</option>
<option value="bc">Barcode</option>

7) Visit the Advanced search page
8) In the search dropdowns, notice that there are only the options that you provided (Author, Title, Barcode)
9) In the top search dropdown, select 'Title' and type in "the"
10) Press 'Search'. The search completes succesfully. Now press 'Edit this search'
11) You should be brought back to the 'Advanced search' page and the top dropdown should be selected as 'Title' and have "the" prefilled.
12) In the second search dropdown, select "Author" and type in "John"
13) Now press search. Once again press "Edit this search" and note the items are prefilled correctly.
14) Go back to Tools->HTML customizations and delete the 'StaffAdvancedSearchList' we initially created.
15) Back at the 'Advanced search' page, the dropdown options should be back to the default. Do some searches to ensure the searches work, and when editing, the options are correctly prefilled.
Comment 2 Eric Garcia 2024-07-24 14:31:37 UTC
Created attachment 169494 [details] [review]
Bug 37442: Add customizable dropdown selections for the advanced search filters

To test:
1) Apply patch, restart_all
2) Visit Tools->HTML customizations
3) Click 'New entry using text editor'
4) For 'Display location', select "StaffAdvancedSearchList"
5) Make the publication date today.
6) For the content, put some dropdown options... you can paste in this block for example:

<option value="au">Author</option>
<option value="ti">Title</option>
<option value="bc">Barcode</option>

7) Visit the Advanced search page
8) In the search dropdowns, notice that there are only the options that you provided (Author, Title, Barcode)
9) In the top search dropdown, select 'Title' and type in "the"
10) Press 'Search'. The search completes succesfully. Now press 'Edit this search'
11) You should be brought back to the 'Advanced search' page and the top dropdown should be selected as 'Title' and have "the" prefilled.
12) In the second search dropdown, select "Author" and type in "John"
13) Now press search. Once again press "Edit this search" and note the items are prefilled correctly.
14) Go back to Tools->HTML customizations and delete the 'StaffAdvancedSearchList' we initially created.
15) Back at the 'Advanced search' page, the dropdown options should be back to the default. Do some searches to ensure the searches work, and when editing, the options are correctly prefilled.

Signed-off-by: Eric Garcia <cubingguy714@gmail.com>
Comment 3 Katrin Fischer 2024-10-29 22:19:14 UTC
If I see it correctly in the code, this patch breaks the *NumbersPreferPhrase system preferences behavior. Can you please check?