Browse Source

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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 022330b8d2)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit c31ed9aaf1)
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
21.11.x
Nick Clemens 2 years ago
committed by Arthur Suzuki
parent
commit
7fa8d2341b
  1. 2
      catalogue/detail.pl
  2. 14
      koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt

2
catalogue/detail.pl

@ -605,6 +605,8 @@ if ( C4::Context->preference('UseCourseReserves') ) {
$template->param( course_reserves => $course_reserves );
}
$template->param(found1 => $query->param('found1') );
$template->param(biblio => $biblio);
output_html_with_http_headers $query, $cookie, $template->output;

14
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt

@ -1373,12 +1373,14 @@ Note that permanent location is a code, and location may be an authval.
[% END %]
});
$(document).ready(function() {
var search_index = localStorage.getItem("cat_search_pulldown_selection");
var search_value = localStorage.getItem("searchbox_value");
if ( search_index ){ $('#cat-search-block select.advsearch').val(search_index)};
if ( search_value ){ $('#cat-search-block #search-form').val(search_value)};
});
[% IF (found1) %]
$(document).ready(function() {
var search_index = localStorage.getItem("cat_search_pulldown_selection");
var search_value = localStorage.getItem("searchbox_value");
if ( search_index ){ $('#cat-search-block select.advsearch').val(search_index)};
if ( search_value ){ $('#cat-search-block #search-form').val(search_value)};
});
[% END %]
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]

Loading…
Cancel
Save