From 74ac15800bbf358e3f1133a1f212400797640112 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 4 Mar 2019 15:39:29 -0300 Subject: [PATCH] Bug 19046: Make seach pulldown to retain index selection This patch also fixes add the term in the search input Test plan: Enable IntranetCatalogSearchPulldown Search for a term using the search input in the header (simple search) Re-do selecting different indices The selection must retain on the search result page. Signed-off-by: Pierre-Marc Thibault Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens --- catalogue/search.pl | 8 + .../prog/en/includes/cat-search.inc | 2 +- .../prog/en/includes/search_indexes.inc | 203 +++++++++++++++--- 3 files changed, 179 insertions(+), 34 deletions(-) diff --git a/catalogue/search.pl b/catalogue/search.pl index af70dac698..f3d653f737 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -385,12 +385,20 @@ my @indexes = map uri_unescape($_), $cgi->multi_param('idx'); if ($indexes[0] && (!$indexes[1] || $params->{'scan'})) { my $idx = "ms_".$indexes[0]; $idx =~ s/\,/comma/g; # template toolkit doesn't like variables with a , in it + $idx =~ s/-/dash/g; # template toolkit doesn't like variables with a dash in it $template->param($idx => 1); } # an operand can be a single term, a phrase, or a complete ccl query my @operands = map uri_unescape($_), $cgi->multi_param('q'); +# if a simple search, display the value in the search box +if ($operands[0] && !$operands[1]) { + my $ms_query = $operands[0]; + $ms_query =~ s/ #\S+//; + $template->param(ms_value => $ms_query); +} + # limits are use to limit to results to a pre-defined category such as branch or language my @limits = map uri_unescape($_), $cgi->multi_param('limit'); my @nolimits = map uri_unescape($_), $cgi->multi_param('nolimit'); diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-search.inc index 215ebaf3de..b14619bdb1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-search.inc @@ -28,7 +28,7 @@

Enter search keywords:

[% IF ( Koha.Preference('IntranetCatalogSearchPulldown') ) %][% INCLUDE 'search_indexes.inc' %][% END %] - +
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/search_indexes.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/search_indexes.inc index 1aff1a4091..733e7d3f36 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/search_indexes.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/search_indexes.inc @@ -1,46 +1,175 @@ [% USE Koha %] -- 2.39.5