Bug 33190 - Add search history button to advance search form if EnableSearchHistory keep
Summary: Add search history button to advance search form if EnableSearchHistory keep
Status: Needs documenting
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Adam Styles
QA Contact: Kyle M Hall
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-10 05:46 UTC by Adam Styles
Modified: 2023-10-20 16:23 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact: Kelly McElligott
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00


Attachments
screen shot of search history button in koha dev box as preview (214.84 KB, image/png)
2023-03-10 05:46 UTC, Adam Styles
Details
Add search history button to advance search form if EnableSearchHistory keep (28.46 KB, text/plain)
2023-03-10 06:28 UTC, Adam Styles
Details
Bug 33190: Add search history button to advance search form if EnableSearchHistory keep (2.08 KB, patch)
2023-03-10 20:37 UTC, Adam Styles
Details | Diff | Splinter Review
Bug 33190: Add search history button to advance search form if EnableSearchHistory keep (2.20 KB, patch)
2023-03-12 01:39 UTC, Adam Styles
Details | Diff | Splinter Review
Bug 33190: Add search history button to advance search form if EnableSearchHistory keep (2.05 KB, patch)
2023-03-14 01:28 UTC, Adam Styles
Details | Diff | Splinter Review
Bug 33190: Add search history button to advance search form if EnableSearchHistory keep (2.28 KB, patch)
2023-03-14 09:36 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 33190: Add search history button to advance search form if EnableSearchHistory keep (2.32 KB, patch)
2023-04-21 15:56 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Styles 2023-03-10 05:46:11 UTC
Created attachment 148047 [details]
screen shot of search history button in koha dev box as preview

Hi All,

I believe the 'search history' feature to be quite useful in daily repeated search work flows, further to this it is a feature fairly hidden behind a drop down UI in the top right when logged in. 

Therefor to promote the use of this valuable tool and also to improve it's discoverability, I propose the follow new enhancement.

User story:
* Add 'search history' button to advanced search button groups if 'EnableSearchHistory' sys pref is set to 'keep'

Key logic:
* If 'EnableSearchHistory' sys pref is set to 'keep' (this is an existing sys pref), an additional 'search history' button will populate at the of the current advance search buttons group
* This new button element makes use of the existing syntax for other button on page and loads the font awesome 4.7 history icon which aligns with the buttons action.
* The button will not display unless 'EnableSearchHistory' sys pref is set to 'keep', which makes use of a IF statement in the advsearch.tt template file at around line 100 ish (see patch)

```
[% IF Koha.Preference('EnableSearchHistory') %]
<div class="btn-group">
<a href="/cgi-bin/koha/catalogue/search-history.pl" class="btn btn-link"><i class="fa fa-history"></i> search history</a>
</div>
[% END %]

```

I have tested in Koha dev box v22 and all works well. I will create test plan in patch commit message.

I am creating my first patch for this very soon, just reading coding guidelines to ensure I patch as community expects.

See attached screen shot.

I welcome feedback.

Thanks.
Comment 1 Adam Styles 2023-03-10 06:28:59 UTC
Created attachment 148048 [details]
Add search history button to advance search form if EnableSearchHistory keep

Bug 33190: Add search history button to advance search form if EnableSearchHistory keep
    
Add 'search history' button to advanced search button groups if 'EnableSearchHistory' sys pref is set to 'keep' via added code block to advsearch.tt
    
To test:
1) Login to Koha dev box instance
2) Select 'Advanced search module' '/cgi-bin/koha/catalogue/search.pl' 'Search history' icon will not be visible in tools groups in form.
3) Select 'koha administration' module '/cgi-bin/koha/admin/admin-home.pl'
4) Enter 'EnableSearchHistory' string into top search field 
5) Change 'EnableSearchHistory' value to 'keep'
6) Press 'Save all Searching preferences' to save pref changes
7) Navigate back to Koha landing home '/cgi-bin/koha/mainpage.pl'
8) Select 'Advanced search module' '/cgi-bin/koha/catalogue/search.pl'
9) 'Search history' icon will now be visible in tools groups in form
10) SIGN OFF
Comment 2 Adam Styles 2023-03-10 06:33:06 UTC
Hi All,

I could not get BZ to work in order to apply my patch via git from branch 'bug_33190' I created in Koha dev box, so I used built in patch UI here to upload the edited 'advsearch.tt' file from my branch.

I will try to get bz working from future bugs.

Please let me know what else is required to do in order for this to be tested/reviewed.

Thanks in advance for the help.

Thanks.
Comment 3 Katrin Fischer 2023-03-10 13:41:37 UTC
Hi Adam, 

are you actually using kohadevbox? If so, you might want to have a look at the newer koha-testing-docker: https://gitlab.com/koha-community/koha-testing-docker.

And in general, feel free to pop into IRC, if you already got that far, I am sure we can help with the last few steps :)
Comment 4 Adam Styles 2023-03-10 20:14:35 UTC
Hi Katrin,

I am running Koha-testing-docker via linux virtualbox setup.

I will re-read https://wiki.koha-community.org/wiki/Git_bz_configuration
guide and then reach in IRC if git bz still an issue.

Thanks.
Comment 5 Adam Styles 2023-03-10 20:37:40 UTC
Created attachment 148099 [details] [review]
Bug 33190: Add search history button to advance search form if EnableSearchHistory keep

Add 'search history' button to advanced search button groups if 'EnableSearchHistory' sys pref is set to 'keep' via added code block to advsearch.tt

To test:
1) Login to Koha dev box instance
2) Select 'Advanced search module' '/cgi-bin/koha/catalogue/search.pl' 'Search history' icon will not be visible in tools groups in form.
3) Select 'koha administration' module '/cgi-bin/koha/admin/admin-home.pl'
4) Enter 'EnableSearchHistory' string into top search field
5) Change ' EnableSearchHistory' value to 'keep'
6) Press 'Save all Searching preferences' to save pref changes
7) Navigate back to Koha landing home '/cgi-bin/koha/mainpage.pl'
8) Select 'Advanced search module' '/cgi-bin/koha/catalogue/search.pl'
9) 'Search history' icon will now be visible in tools groups in form
10) SIGN OFF

Sponsored-by: N/A
Comment 6 Adam Styles 2023-03-10 20:43:35 UTC
with respect I request sign off for my first patch, or discussion on it's merit. thanks.
Comment 7 Katrin Fischer 2023-03-11 11:42:35 UTC
Hi Adam, 

your new file looks like a patch should, thanks!

Some things to note:

1) The older file that was uploaded as 'patch' would have confused our scripts so I have obsoleted and only left your new file. This will make things work with sandboxes and git bz for others.

2) I notice that you code is not using any identation. We use 4 spaces for indentation and it should fit in its spot with the rest of the code. 

3) Sponsored-by: N/A is not needed and would show as N/A in release notes, but we can delete this in a later step. You could list your institution as sponsor if you want :)

We currently have a big backlog of patches and we rely on volunteers for testing and QA'ing code, so it might take a little while to get feedback.
Comment 8 Adam Styles 2023-03-12 01:39:51 UTC
Created attachment 148105 [details] [review]
Bug 33190: Add search history button to advance search form if EnableSearchHistory keep

Add 'search history' button to advanced search button groups if 'EnableSearchHistory' sys pref is set to 'keep' via added code block to advsearch.tt

To test:
1) Login to Koha dev box instance
2) Select 'Advanced search module' '/cgi-bin/koha/catalogue/search.pl' 'Search history' icon will not be visible in tools groups in form.
3) Select 'koha administration' module '/cgi-bin/koha/admin/admin-home.pl'
4) Enter 'EnableSearchHistory' string into top search field
5) Change ' EnableSearchHistory' value to 'keep'
6) Press 'Save all Searching preferences' to save pref changes
7) Navigate back to Koha landing home '/cgi-bin/koha/mainpage.pl'
8) Select 'Advanced search module' '/cgi-bin/koha/catalogue/search.pl'
9) 'Search history' icon will now be visible in tools groups in form
10) SIGN OFF
Comment 9 Adam Styles 2023-03-12 01:44:41 UTC
Hi Katrin,

Thanks so much for this feedback.

I have rebuilt my patch with the correct code indentation.

It was good practice for patch submission.

I can imagine such the list of patches to test is quite long, I am just happy to have possibly contributed.

Thanks.
Comment 10 Matt Blenkinsop 2023-03-13 15:27:17 UTC
Hi Adam,

I've just been through your test plan and the patch works as advertised :) Just one small change that needs making - the button is labelled "search history". Koha uses sentence case for strings so this would need to be "Search history". If you can change that and re-submit the patch I can sign it off for you and send it to the QA team. Let me know if you need any assistance
Comment 11 Adam Styles 2023-03-14 01:28:45 UTC
Created attachment 148150 [details] [review]
Bug 33190: Add search history button to advance search form if EnableSearchHistory keep

Add 'search history' button to advanced search button groups if 'EnableSearchHistory' sys pref is set to 'keep' via added code block to advsearch.tt

To test:
1) Login to Koha dev box instance
2) Select 'Advanced search module' '/cgi-bin/koha/catalogue/search.pl' 'Search history' icon will not be visible in tools groups in form.
3) Select 'koha administration' module '/cgi-bin/koha/admin/admin-home.pl'
4) Enter 'EnableSearchHistory' string into top search field
5) Change ' EnableSearchHistory' value to 'keep'
6) Press 'Save all Searching preferences' to save pref changes
7) Navigate back to Koha landing home '/cgi-bin/koha/mainpage.pl'
8) Select 'Advanced search module' '/cgi-bin/koha/catalogue/search.pl'
9) 'Search history' icon will now be visible in tools groups in form
10) SIGN OFF
Comment 12 Adam Styles 2023-03-14 01:31:06 UTC
Hi Matt,

Thanks so much for the review.
I have updated source and re-submitted patch with required naming convention.

Thanks so much.
Comment 13 Matt Blenkinsop 2023-03-14 09:36:33 UTC
Created attachment 148153 [details] [review]
Bug 33190: Add search history button to advance search form if EnableSearchHistory keep

Add 'search history' button to advanced search button groups if 'EnableSearchHistory' sys pref is set to 'keep' via added code block to advsearch.tt

To test:
1) Login to Koha dev box instance
2) Select 'Advanced search module' '/cgi-bin/koha/catalogue/search.pl' 'Search history' icon will not be visible in tools groups in form.
3) Select 'koha administration' module '/cgi-bin/koha/admin/admin-home.pl'
4) Enter 'EnableSearchHistory' string into top search field
5) Change ' EnableSearchHistory' value to 'keep'
6) Press 'Save all Searching preferences' to save pref changes
7) Navigate back to Koha landing home '/cgi-bin/koha/mainpage.pl'
8) Select 'Advanced search module' '/cgi-bin/koha/catalogue/search.pl'
9) 'Search history' icon will now be visible in tools groups in form
10) SIGN OFF

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 14 Martin Renvoize 2023-03-16 08:26:24 UTC
This is a great little enhancement, thanks Adam (and thanks for lending some guidance here Matt too).

I have one very minor query, and I'm going to ask our resident UI guru to weigh in on it.

The button placement and style is inline with the actions that take place on the same page.  There's already precedents for that with the 'Go to item search' which is also a link to another page.  I'm wondering if we aught to distinguish more between 'Link to new page' and 'Actions on current page' here?  We could make this 'feel' like an action by updating the text to 'View search history', but that lengthens the button and I (and accessability guidelines) tend to prefer less wordy links (I'd actually opt for dropping the 'Go to' in the "Item search" button too).  Or perhaps we could distinguish these two buttons somehow.. add a separator before them as a logical group.. or right aligh these two.. or change the style up a bit?

Owen, do you have any thoughts?
Comment 15 Adam Styles 2023-03-18 00:23:57 UTC
Hi Martin,

Thanks for considering my UI feature for the community and also thanks for kick starting a UX improvement conversation. I look forward to seeing what can be improved for everyone.

Thanks 8-)
Comment 16 Kyle M Hall 2023-04-21 15:56:06 UTC
Created attachment 150057 [details] [review]
Bug 33190: Add search history button to advance search form if EnableSearchHistory keep

Add 'search history' button to advanced search button groups if 'EnableSearchHistory' sys pref is set to 'keep' via added code block to advsearch.tt

To test:
1) Login to Koha dev box instance
2) Select 'Advanced search module' '/cgi-bin/koha/catalogue/search.pl' 'Search history' icon will not be visible in tools groups in form.
3) Select 'koha administration' module '/cgi-bin/koha/admin/admin-home.pl'
4) Enter 'EnableSearchHistory' string into top search field
5) Change ' EnableSearchHistory' value to 'keep'
6) Press 'Save all Searching preferences' to save pref changes
7) Navigate back to Koha landing home '/cgi-bin/koha/mainpage.pl'
8) Select 'Advanced search module' '/cgi-bin/koha/catalogue/search.pl'
9) 'Search history' icon will now be visible in tools groups in form
10) SIGN OFF

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 17 Kyle M Hall 2023-04-21 15:56:49 UTC
After trying half a dozen different things, I've come to the conclusion that the link is sufficiently self-explanatory as-is.
Comment 18 Tomás Cohen Arazi 2023-05-16 13:18:10 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 19 Pedro Amorim 2023-06-07 11:44:55 UTC
Enhancement. Not pushing to 22.11.x.