From 5bec8b0db03ef93079fafcf049d9d2247a825496 Mon Sep 17 00:00:00 2001 From: tipaul Date: Thu, 24 Apr 2003 18:44:17 +0000 Subject: [PATCH] fix for #406 --- opac/opac-searchresults.pl | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/opac/opac-searchresults.pl b/opac/opac-searchresults.pl index 6c4d80cd6f..4d2c8e149d 100755 --- a/opac/opac-searchresults.pl +++ b/opac/opac-searchresults.pl @@ -30,8 +30,6 @@ if ($subject) { # we assume that C4::Search will validate these values for us my @fields = ('keyword', 'subject', 'author', 'illustrator', 'itemnumber', 'isbn', 'date-before', 'date-after', 'class', 'dewey', 'branch', 'title', 'abstract', 'publisher'); - - # collect all the fields ... my %search; @@ -91,7 +89,7 @@ foreach my $res (@results) { my $startfrom=$query->param('startfrom'); -($startfrom) || ($startfrom=0); +($startfrom) || ($startfrom=1); my $resultsarray=\@results; ($resultsarray) || (@$resultsarray=()); @@ -102,7 +100,7 @@ $template->param(startfrom => $startfrom+1); ($startfrom+$num<=$count) ? ($template->param(endat => $startfrom+$num)) : ($template->param(endat => $count)); $template->param(numrecords => $count); my $nextstartfrom=($startfrom+$num<$count) ? ($startfrom+$num) : (-1); -my $prevstartfrom=($startfrom-$num>=0) ? ($startfrom-$num) : (-1); +my $prevstartfrom=($startfrom-$num>=0) ? ($startfrom-$number_of_results) : (-1); $template->param(nextstartfrom => $nextstartfrom); my $displaynext=($nextstartfrom==-1) ? 0 : 1; my $displayprev=($prevstartfrom==-1) ? 0 : 1; @@ -115,12 +113,12 @@ $template->param(SEARCH_RESULTS => $resultsarray); my $numbers; @$numbers = (); -if ($count>10) { - for (my $i=1; $i<$count/10+1; $i++) { +if ($count>$number_of_results) { + for (my $i=1; $i<$count/$number_of_results+1; $i++) { my $highlight=0; my $themelang = $template->param('themelang'); - ($startfrom==($i-1)*10) && ($highlight=1); - push @$numbers, { number => $i, highlight => $highlight , startfrom => ($i-1)*10 }; + ($startfrom==($i-1)*$number_of_results+1) && ($highlight=1); + push @$numbers, { number => $i, highlight => $highlight , startfrom => ($i-1)*$number_of_results+1 }; } } -- 2.20.1