From 5bd71b5b7dfd9f1eccfd2c12a78321406018ffeb Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 21 Oct 2021 18:44:50 +0000 Subject: [PATCH] Bug 22605: (follow-up) Fix operators - Don't add an operator on first loop - Only add plus option on last loop - Fix indentation of first search box - Remove spaces from operators in query_cgi and add to query and query_desc Signed-off-by: Katrin Fischer Signed-off-by: Fridolin Somers --- C4/Search.pm | 6 +++--- .../intranet-tmpl/prog/en/modules/catalogue/advsearch.tt | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 9dfca44df3..b19dc17a29 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1586,7 +1586,7 @@ sub _build_initial_query { my $operator = ""; if ($params->{previous_operand}){ #If there is a previous operand, add a supplied operator or the default 'and' - $operator = ($params->{operator}) ? " ".($params->{operator})." " : ' AND '; + $operator = ($params->{operator}) ? ($params->{operator}) : 'AND'; } #NOTE: indexes_set is typically set when doing truncation or field weighting @@ -1594,14 +1594,14 @@ sub _build_initial_query { #e.g. "kw,wrdl:test" #e.g. " and kw,wrdl:test" - $params->{query} .= $operator . $operand; + $params->{query} .= " " . $operator . " " . $operand; $params->{query_cgi} .= "&op=".uri_escape_utf8($operator) if $operator; $params->{query_cgi} .= "&idx=".uri_escape_utf8($params->{index}) if $params->{index}; $params->{query_cgi} .= "&q=".uri_escape_utf8($params->{original_operand}) if ( $params->{original_operand} ne '' ); #e.g. " and kw,wrdl: test" - $params->{query_desc} .= $operator . ( $params->{index_plus} // q{} ) . " " . ( $params->{original_operand} // q{} ); + $params->{query_desc} .= " " . $operator . " " . ( $params->{index_plus} // q{} ) . " " . ( $params->{original_operand} // q{} ); $params->{previous_operand} = 1 unless $params->{previous_operand}; #If there is no previous operand, mark this as one diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt index 762c624056..fd7c6fed17 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt @@ -107,6 +107,9 @@ Search for [% FOREACH query IN queries %] [% IF ( expanded_options ) %] + [% IF loop.first %] +
+ [% ELSE %]
[% SET opindex = loop.index - 1 %] + [% END %] [% ELSE %]
[% END %] @@ -131,7 +135,9 @@ [% INCLUDE 'search_indexes.inc' %] [% IF ( expanded_options ) %] + [% IF ( loop.last ) %] [+] + [% END %] [% IF ( loop.first ) %] [% END %] @@ -238,7 +244,6 @@ [% END %] - [% IF ( UNIMARC ) %] [% INCLUDE 'subtypes_unimarc.inc' %] [% ELSE %] -- 2.39.5