Lines 148-154
use C4::Koha;
Link Here
|
148 |
use URI::Escape; |
148 |
use URI::Escape; |
149 |
use POSIX qw(ceil floor); |
149 |
use POSIX qw(ceil floor); |
150 |
use C4::Search::History; |
150 |
use C4::Search::History; |
151 |
|
151 |
use String::Random; |
152 |
use Koha::ItemTypes; |
152 |
use Koha::ItemTypes; |
153 |
use Koha::Library::Groups; |
153 |
use Koha::Library::Groups; |
154 |
use Koha::Patrons; |
154 |
use Koha::Patrons; |
Lines 454-464
for (my $ii = 0; $ii < @operands; ++$ii)
Link Here
|
454 |
# Params that can only have one value |
454 |
# Params that can only have one value |
455 |
my $scan = $params->{'scan'}; |
455 |
my $scan = $params->{'scan'}; |
456 |
my $count = C4::Context->preference('numSearchResults') || 20; |
456 |
my $count = C4::Context->preference('numSearchResults') || 20; |
457 |
my $results_per_page = $params->{'count'} || $count; |
457 |
my @results_per_page_options = grep /^\d+$/, |
|
|
458 |
map {s/\s+//g;$_;} |
459 |
split /,/, C4::Context->preference('numSearchResultsPerPage'); |
460 |
push(@results_per_page_options, $count); |
461 |
@results_per_page_options = do { my %seen; grep { !$seen{$_}++ } @results_per_page_options }; |
462 |
@results_per_page_options = sort {$a <=> $b} @results_per_page_options; |
463 |
|
464 |
my $results_per_page = $params->{'results_per_page'} || $cgi->cookie("results_per_page") || $count; |
465 |
my $page = $cgi->param('page') || 1; |
458 |
my $offset = $params->{'offset'} || 0; |
466 |
my $offset = $params->{'offset'} || 0; |
459 |
$offset = 0 if $offset < 0; |
467 |
$offset = 0 if $offset < 0; |
460 |
my $page = $cgi->param('page') || 1; |
468 |
my $hits; |
461 |
#my $offset = ($page-1)*$results_per_page; |
|
|
462 |
my $expanded_facet = $params->{'expand'}; |
469 |
my $expanded_facet = $params->{'expand'}; |
463 |
|
470 |
|
464 |
# Define some global variables |
471 |
# Define some global variables |
Lines 553-559
my @sup_results_array;
Link Here
|
553 |
for (my $i=0;$i<@servers;$i++) { |
560 |
for (my $i=0;$i<@servers;$i++) { |
554 |
my $server = $servers[$i]; |
561 |
my $server = $servers[$i]; |
555 |
if ($server =~/biblioserver/) { # this is the local bibliographic server |
562 |
if ($server =~/biblioserver/) { # this is the local bibliographic server |
556 |
my $hits = $results_hashref->{$server}->{"hits"} // 0; |
563 |
$hits = $results_hashref->{$server}->{"hits"} // 0; |
|
|
564 |
$results_per_page = $hits if $results_per_page == 'all'; |
557 |
my $page = $cgi->param('page') || 0; |
565 |
my $page = $cgi->param('page') || 0; |
558 |
my @newresults = searchResults({ 'interface' => 'intranet' }, $query_desc, $hits, $results_per_page, $offset, $scan, |
566 |
my @newresults = searchResults({ 'interface' => 'intranet' }, $query_desc, $hits, $results_per_page, $offset, $scan, |
559 |
$results_hashref->{$server}->{"RECORDS"}); |
567 |
$results_hashref->{$server}->{"RECORDS"}); |
Lines 619-625
for (my $i=0;$i<@servers;$i++) {
Link Here
|
619 |
if ($query_desc || $limit_desc) { |
627 |
if ($query_desc || $limit_desc) { |
620 |
$template->param(searchdesc => 1); |
628 |
$template->param(searchdesc => 1); |
621 |
} |
629 |
} |
622 |
$template->param(results_per_page => $results_per_page); |
630 |
$template->param(results_per_page => $results_per_page == $hits ? 'all' : $results_per_page); |
623 |
# must define a value for size if not present in DB |
631 |
# must define a value for size if not present in DB |
624 |
# in order to avoid problems generated by the default size value in TT |
632 |
# in order to avoid problems generated by the default size value in TT |
625 |
foreach my $line (@newresults) { |
633 |
foreach my $line (@newresults) { |