Browse Source

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 <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
22.05.x
Nick Clemens 3 years ago
committed by Fridolin Somers
parent
commit
5bd71b5b7d
  1. 6
      C4/Search.pm
  2. 7
      koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt

6
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

7
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt

@ -107,6 +107,9 @@
<legend>Search for </legend>
[% FOREACH query IN queries %]
[% IF ( expanded_options ) %]
[% IF loop.first %]
<div class="search-term-row" style="text-indent: 4.25em;">
[% ELSE %]
<div class="search-term-row">
[% SET opindex = loop.index - 1 %]
<select name="op">
@ -124,6 +127,7 @@
<option value="NOT">not</option>
[% END %]
</select>
[% END %]
[% ELSE %]
<div>
[% END %]
@ -131,7 +135,9 @@
[% INCLUDE 'search_indexes.inc' %]
<input type="text" size="30" name="q" title="Enter search terms" value="[% query | html %]" />
[% IF ( expanded_options ) %]
[% IF ( loop.last ) %]
<a href="JavaScript:add_field();" id="ButtonPlus" title="Add another field">[+]</a>
[% END %]
[% IF ( loop.first ) %]
<label for="scan">Scan indexes:</label> <input type="checkbox" name="scan" id="scan" value="1" />
[% END %]
@ -238,7 +244,6 @@
<!-- /BASIC LIMITS -->
[% END %]
[% IF ( UNIMARC ) %]
[% INCLUDE 'subtypes_unimarc.inc' %]
[% ELSE %]

Loading…
Cancel
Save