From a43940bbf0493f7c3d33dd1d8f66859dc26dcac1 Mon Sep 17 00:00:00 2001
From: Ere Maijala <ere.maijala@helsinki.fi>
Date: Thu, 28 Mar 2019 13:44:39 +0200
Subject: [PATCH] Bug 22592: Fixes to index scan
Makes sure the scan term is displayed and redirection to record page is not used with index scan for a single result. Also adds a submit button so that you can submit a change for selected index or term easier.
Signed-off-by: Michal Denar <black23@gmail.com>
---
catalogue/search.pl | 6 +++---
.../intranet-tmpl/prog/en/modules/catalogue/results.tt | 3 ++-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/catalogue/search.pl b/catalogue/search.pl
index 514c4a9b2c..c670c584b6 100755
--- a/catalogue/search.pl
+++ b/catalogue/search.pl
@@ -498,7 +498,7 @@ if ($query_cgi) {
if ($input_name eq 'idx') {
$scan_index_to_use = $input_value; # unless $scan_index_to_use;
}
- if ($input_name eq 'q') {
+ if (!defined $scan_search_term_to_use && $input_name eq 'q') {
$scan_search_term_to_use = Encode::decode_utf8( uri_unescape( $input_value ));
}
}
@@ -582,8 +582,8 @@ for (my $i=0;$i<@servers;$i++) {
$template->param( EnableSearchHistory => 1 );
}
- ## If there's just one result, redirect to the detail page
- if ($total == 1) {
+ ## If there's just one result, redirect to the detail page unless doing an index scan
+ if ($total == 1 && !$scan) {
my $biblionumber = $newresults[0]->{biblionumber};
my $defaultview = C4::Context->preference('IntranetBiblioDefaultView');
my $views = { C4::Search::enabled_staff_search_views };
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
index 626b23823d..c559dd62ef 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
@@ -306,7 +306,7 @@
[% ELSE %]<option value="ti">Title</option>[% END %]
[% IF ( ms_ticommaphr ) %]<option selected="selected" value="ti,phr">Title phrase</option>
[% ELSE %]<option value="ti,phr">Title phrase</option>[% END %]
- [% IF ( ms_aucommaphr ) %]<option selected="selected" value="au,phr">Author</option>
+ [% IF ( ms_au || ms_aucommaphr ) %]<option selected="selected" value="au,phr">Author</option>
[% ELSE %]<option value="au,phr">Author</option>[% END %]
[% IF ( ms_su ) %]<option selected="selected" value="su">Subject</option>
[% ELSE %]<option value="su">Subject</option>[% END %]
@@ -324,6 +324,7 @@
[% ELSE %]<option value="ss">ISSN</option>[% END %]
</select>
<input type="hidden" name="scan" value="1" />
+ <input class="submit" type="submit" value="Submit" />
</td>
</tr>
</table>
--
2.17.1