Bug 19046 made search terms and dropdown preserve in the staff client, however, if one search for a barcode or something that returns a single record the dropdown and box are cleared
Created attachment 92357 [details] [review] Bug 23475: Use cookies to preserve simple search values
This patch is a POC - it needs some work and extension for the OPAC, but it should demonstrate possibility of passing through to the details page - Other options would be to build everythign into the url, or be able to process details page from search.pl - this seemed a quick way to get things there
Patch tested with a sandbox, by Séverine QUEUNE <severine.queune@bulac.fr>
Created attachment 93558 [details] [review] Bug 23475: Use cookies to preserve simple search values Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Finally worked cleaning the cookies ! I just had a little encoding issue with the last 'é' (see screenshot) but I don't know it if comes from the patch I'm not sure it comes form the patch so I signed it.
Created attachment 93562 [details] Little issue with the final é
Severine: Please describe how you got the encoding issue. I see a title field on your image. Where does it come from ? Nick: At first glance it seems to me that you should encode/decode unicode stuff when saving and fetching from CGI cookies. I had a quick look in CGI on cpan but the docs are very quiet about it. Cannot see if -utf8 should handle cookie values too. Please check. Changing status for feedback
Hi Marcel, I know I used a Biblibre's sandbox in Unimarc, but I can't remember if it was http://pro.es5-koha.sandbox.biblibre.eu (login with test/test) which uses ES5 or http://pro.es6-koha.sandbox.biblibre.eu with ES6. I tried with several title and everything worked fine, except for the title "Mademoiselle liberté" with this little issue. This is something quite usual with some letter with diacritics in French (see for example bug 23542), so as I said, I'm not sure it comes from the patch, nor if the patch could solve this problem.
Created attachment 108124 [details] [review] Bug 23475: Use cookies to preserve simple search values To test: 1 - Enable IntranetCatalogSearchPulldown 2 - Perform a search that brings you to a single title 3 - Note the search is not displayed on the details page 4 - Apply patch 5 - Repeat 6 - Note the search is retained on details page 7 - Try with different dropdown values and search terms 8 - Test search terms including accented characters etc
(In reply to Marcel de Rooy from comment #7) > Nick: At first glance it seems to me that you should encode/decode unicode > stuff when saving and fetching from CGI cookies. I had a quick look in CGI > on cpan but the docs are very quiet about it. Cannot see if -utf8 should > handle cookie values too. Please check. It looks like Firefox and Chrome both URI encode the values when we save them. To decode we need unescape, then utf8 decode, at least that's what worked. Afaict, things are not consistent: https://stackoverflow.com/questions/1969232/what-are-allowed-characters-in-cookies
Nice work. In my opinion cookie name "pulldown_selection" is too generic. I propose you use a prefix like "cat_search".
Created attachment 109624 [details] [review] Bug 23475: Make cookie name more explicit
I loaded this onto a sandbox, but received the following error when searching for a record with just one match: Undefined subroutine &CGI::Compile::ROOT::kohadevbox_koha_catalogue_detail_2epl::uri_unescape called at /kohadevbox/koha/catalogue/detail.pl line 121 A search which returns multiple records functions as expected.
Created attachment 111325 [details] [review] Bug 23475: (follow-up) Include URI::Escape
Created attachment 111338 [details] [review] Bug 23475: Use cookies to preserve simple search values To test: 1 - Enable IntranetCatalogSearchPulldown 2 - Perform a search that brings you to a single title 3 - Note the search is not displayed on the details page 4 - Apply patch 5 - Repeat 6 - Note the search is retained on details page 7 - Try with different dropdown values and search terms 8 - Test search terms including accented characters etc Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Created attachment 111339 [details] [review] Bug 23475: Make cookie name more explicit Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Created attachment 111340 [details] [review] Bug 23475: (follow-up) Include URI::Escape Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Works well - here's some of the accented searches I used on the sandbox in case they're useful for others testing: Howe, Zoë Street Strk̆v̜elser Ślez
Created attachment 111798 [details] [review] Bug 23475: Use cookies to preserve simple search values To test: 1 - Enable IntranetCatalogSearchPulldown 2 - Perform a search that brings you to a single title 3 - Note the search is not displayed on the details page 4 - Apply patch 5 - Repeat 6 - Note the search is retained on details page 7 - Try with different dropdown values and search terms 8 - Test search terms including accented characters etc Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 111799 [details] [review] Bug 23475: Make cookie name more explicit Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 111800 [details] [review] Bug 23475: (follow-up) Include URI::Escape Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Please document the new cookies here: https://wiki.koha-community.org/wiki/Use_of_Cookies
Why a cookie? We could use localStorage here.
Created attachment 112697 [details] [review] Bug 23475: Use localStorage to preserve simple search values To test: 1 - Enable IntranetCatalogSearchPulldown 2 - Perform a search that brings you to a single title 3 - Note the search is not displayed on the details page 4 - Apply patch 5 - Repeat 6 - Note the search is retained on details page 7 - Try with different dropdown values and search terms 8 - Test search terms including accented characters etc
Created attachment 112714 [details] [review] Bug 23475: Use localStorage to preserve simple search values To test: 1 - Enable IntranetCatalogSearchPulldown 2 - Perform a search that brings you to a single title 3 - Note the search is not displayed on the details page 4 - Apply patch 5 - Repeat 6 - Note the search is retained on details page 7 - Try with different dropdown values and search terms 8 - Test search terms including accented characters etc
Created attachment 112971 [details] [review] Bug 23475: Use localStorage to preserve simple search values To test: 1 - Enable IntranetCatalogSearchPulldown 2 - Perform a search that brings you to a single title 3 - Note the search is not displayed on the details page 4 - Apply patch 5 - Repeat 6 - Note the search is retained on details page 7 - Try with different dropdown values and search terms 8 - Test search terms including accented characters etc Signed-off-by: David Nind <david@davidnind.com>
Created attachment 113744 [details] [review] Bug 23475: Use localStorage to preserve simple search values To test: 1 - Enable IntranetCatalogSearchPulldown 2 - Perform a search that brings you to a single title 3 - Note the search is not displayed on the details page 4 - Apply patch 5 - Repeat 6 - Note the search is retained on details page 7 - Try with different dropdown values and search terms 8 - Test search terms including accented characters etc Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
1. There are 2 unneeded use statements in catalogue/detail.pl 2. Shouldn't we use the same selectors for: + if ( search_index ){ $('.advsearch[name="idx"]').val(search_index)}; vs + localStorage.setItem('cat_search_pulldown_selection', $("#cat-search-block select.advsearch").val() ); and + if ( search_value ){ $('#search-form').val(search_value)}; vs + localStorage.setItem('searchbox_value', $("#cat-search-block #search-form").val() ); to make thing more obvious. Is there a reason not to?
Created attachment 113784 [details] [review] Bug 23475: (follow-up) Fix selectors and stray use statements
Found a bug: 1. Search for "Chapman" on the adv search 2. The detail page has "undefined" in the search box
Created attachment 113904 [details] [review] Bug 23475: Unset the storage if the values do not exist
Created attachment 114055 [details] [review] Bug 23475: Use localStorage to preserve simple search values To test: 1 - Enable IntranetCatalogSearchPulldown 2 - Perform a search that brings you to a single title 3 - Note the search is not displayed on the details page 4 - Apply patch 5 - Repeat 6 - Note the search is retained on details page 7 - Try with different dropdown values and search terms 8 - Test search terms including accented characters etc Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Bug 23475: (follow-up) Fix selectors and stray use statements
Created attachment 114056 [details] [review] Bug 23475: Unset the storage if the values do not exist
Pushed to master for 21.05, thanks to everybody involved!
Pushed to 20.11.x for 20.11.01
Backported to 20.05.x for 20.05.07
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.
Hello everyone, I updated an old version of Koha to version 21.11.11. Following the steps of the bug solution the error continues. My Koha uses Zebra as its indexing engine. Could you confirm me if the solution also works for Zebra or only for Elasticsearch? Thank you
(In reply to Ricardo Ruiz from comment #38) > Hello everyone, > > I updated an old version of Koha to version 21.11.11. Following the steps of > the bug solution the error continues. > > My Koha uses Zebra as its indexing engine. Could you confirm me if the > solution also works for Zebra or only for Elasticsearch? > > Thank you As this bug has been closed, please file a new one and give the steps on how to see the problematic behaviour. You can link it to this one using the See also if you think it's similar.