Browse Source

fix for 1610: Redirect to result when opac search returns only one item

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
3.0.x
Joshua Ferraro 15 years ago
parent
commit
850b9ac67c
  1. 6
      catalogue/search.pl
  2. 6
      opac/opac-search.pl

6
catalogue/search.pl

@ -489,6 +489,12 @@ for (my $i=0;$i<@servers;$i++) {
my $page = $cgi->param('page') || 0;
my @newresults = searchResults( $query_desc,$hits,$results_per_page,$offset,@{$results_hashref->{$server}->{"RECORDS"}});
$total = $total + $results_hashref->{$server}->{"hits"};
## If there's just one result, redirect to the detail page
if ($total == 1) {
my $biblionumber=@newresults[0]->{biblionumber};
print $cgi->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber");
exit;
}
if ($hits) {
$template->param(total => $hits);
my $limit_cgi_not_availablity = $limit_cgi;

6
opac/opac-search.pl

@ -347,6 +347,12 @@ for (my $i=0;$i<=@servers;$i++) {
@newresults = searchResults( $query_desc,$hits,$results_per_page,$offset,@{$results_hashref->{$server}->{"RECORDS"}});
}
$total = $total + $results_hashref->{$server}->{"hits"};
## If there's just one result, redirect to the detail page
if ($total == 1) {
my $biblionumber=@newresults[0]->{biblionumber};
print $cgi->redirect("/cgi-bin/koha/opac-detail.pl?biblionumber=$biblionumber");
exit;
}
if ($hits) {
$template->param(total => $hits);
my $limit_cgi_not_availablity = $limit_cgi;

Loading…
Cancel
Save