On the staff client end: Opening a bibliographic record page populates the search bar with the last text entered in the Search the Catalog search bar for that browser session, even if the search wasn't done on the previous page or tab or by the same logged in user. This also happens when links are opened in new tabs. It only prepopulates search text from the Search the Catalog search bar, not from Advanced Search. Only able to recreate the bug on pages that load within the Normal tab of a bibliographic record page: https://staff.**.bywatersolutions.com/cgi-bin/koha/catalogue/detail.pl?biblionumber=** (including #description, #acq_details, #images) 1. Enter text in the Search the Catalog search bar and Submit 2. Click on a search result to open the record page 3. Search field is prepopulated with previous search text Even as you click through to other pages, on and on, once you open another record page, the search bar will once again prepopulate the last text entered in it. Example that automatically opens in new tab, not directly from a search result: 1. Enter text in the Search the Catalog search bar and Submit 2. Open Tools › Manage staged MARC records › Batch # 3. Click on Record # in righthand column 4. Record page opens in new tab with previous search text prepopulated The search bar should clear out upon loading a new page or tab. One user's search history should never load for another user, despite not closing out and reopening the browser.
It has been added by bug 23475. Nick, maybe we should use sessionStorage instead of localStorage?
Nick, this is very confusing IMO. We should invalidate/reset the value at some point. It's not consistent to have the input prefilled if we are coming from another view than the result view.
Ha, it's bug 26247. *** This bug has been marked as a duplicate of bug 26247 ***
Created attachment 135146 [details] [review] Bug 27697: Only preopulate search when we have found a single biblio This patch uses the url parameter we created in 23475 to determine whether we should populate the search bar or not Note - a bookmark with this param will still populate search term with last search To test: 1 - Search staff client for 'cat' 2 - Browse to a patrons checkouts and click on a title, or just go directly to a details page: http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=2850 3 - Search bar says 'cat' 4 - Apply patch 5 - Repeat 1-2 6 - Search bar is not populated 7 - Search "dalek war box set" or a term that finds a single record in your instance 8 - Search bar is populated 9 - Note url like: http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=2850&found1=1
(In reply to Jonathan Druart from comment #3) > Ha, it's bug 26247. > > *** This bug has been marked as a duplicate of bug 26247 *** I unduplicated - that seems more about copying between boxes - this is about populating when we shouldn't
Created attachment 135457 [details] [review] Bug 27697: Only preopulate search when we have found a single biblio This patch uses the url parameter we created in 23475 to determine whether we should populate the search bar or not Note - a bookmark with this param will still populate search term with last search To test: 1 - Search staff client for 'cat' 2 - Browse to a patrons checkouts and click on a title, or just go directly to a details page: http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=2850 3 - Search bar says 'cat' 4 - Apply patch 5 - Repeat 1-2 6 - Search bar is not populated 7 - Search "dalek war box set" or a term that finds a single record in your instance 8 - Search bar is populated 9 - Note url like: http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=2850&found1=1 Signed-off-by: David Nind <david@davidnind.com>
Created attachment 135468 [details] [review] Bug 27697: Only preopulate search when we have found a single biblio This patch uses the url parameter we created in 23475 to determine whether we should populate the search bar or not Note - a bookmark with this param will still populate search term with last search To test: 1 - Search staff client for 'cat' 2 - Browse to a patrons checkouts and click on a title, or just go directly to a details page: http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=2850 3 - Search bar says 'cat' 4 - Apply patch 5 - Repeat 1-2 6 - Search bar is not populated 7 - Search "dalek war box set" or a term that finds a single record in your instance 8 - Search bar is populated 9 - Note url like: http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=2850&found1=1 Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Pushed to master for 22.11. Nice work everyone, thanks!
Pushed to 22.05.x for 22.05.01
This adds a new warning in the log [2022/06/16 10:31:18] [WARN] CGI::param called in list context from /kohadevbox/koha/catalogue/detail.pl line 626, this can lead to vulnerabilities. See the warning in "Fetching the value or values of a single named parameter" at /usr/share/perl5/CGI.pm line 414. It should be $template->param(found1 => scalar $query->param('found1') );
(In reply to Jonathan Druart from comment #10) > This adds a new warning in the log > > [2022/06/16 10:31:18] [WARN] CGI::param called in list context from > /kohadevbox/koha/catalogue/detail.pl line 626, this can lead to > vulnerabilities. See the warning in "Fetching the value or values of a > single named parameter" at /usr/share/perl5/CGI.pm line 414. > > It should be > > $template->param(found1 => scalar $query->param('found1') ); See bug 30997.
thx pushed to 21.11.x for 21.11.07
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed.
This seems like a bug fix rather than a feature. Not sure what documentation is needed. Closing, but feel free to reopen with details.