From 43250e27cdfa4e33fafe8bc77592d28979aa315c 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 --- C4/Search.pm | 6 +++--- koha-tmpl/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 f36e3364b3..99a83f7250 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1585,7 +1585,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 @@ -1593,14 +1593,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}; #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 2858e5a6ab..4a05878fc5 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.11.0