From 40e5e1f00fa6b4c38a8ab1464d8baf68b1b81350 Mon Sep 17 00:00:00 2001 From: Emily-Rose Francoeur Date: Thu, 26 Oct 2023 11:28:35 -0400 Subject: [PATCH] Bug 30745: Display pagination for the results page I have fixed the pagination issue when the search returns multiple results. Test plan: - Enable elasticsearch - git to labels/label-item-search.pl - search using after date only => check you get items with date-of-acquisition greater than after date - search using before date only => check you get items with date-of-acquisition less than before date - search using after and before date => check you get items with date-of-acquisition between after and before - Combine this searches with a specified index - enable zebra and repeat these tests pagination tests - Perform a search that returns more than 20 notices - Navigate through different result pages using page numbers, the "Next" button, and the "Previous" button => On each page, check that "Results X through X of X" displays the correct information --- .../prog/en/modules/labels/result.tt | 7 ++--- labels/label-item-search.pl | 29 +++++++++---------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt index e6b44617da..36090f5e3f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt @@ -5,17 +5,17 @@ [% IF ( displayprev || displaynext ) %] [% END %] @@ -54,7 +54,6 @@
- [% FOREACH result_se IN result_set %]

[% result_se.title | html %]

diff --git a/labels/label-item-search.pl b/labels/label-item-search.pl index b07e4e1c93..8cebec8278 100755 --- a/labels/label-item-search.pl +++ b/labels/label-item-search.pl @@ -40,7 +40,7 @@ my $query = CGI->new; my $type = $query->param('type'); my $op = $query->param('op') || ''; my $batch_id = $query->param('batch_id'); -my $ccl_query = $query->param('ccl_query'); +my @limits = split(" AND ", $query->param('limits') || ""); my $startfrom = $query->param('startfrom') || 1; my ($template, $loggedinuser, $cookie) = (undef, undef, undef); my ( @@ -68,13 +68,9 @@ if ( $op eq "do_search" ) { my $searcher = Koha::SearchEngine::Search->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); - my @limits; - if ($datefrom) { - push(@limits, "acqdate,ge,st-date-normalized=$datefrom"); - } - - if ($dateto) { - push(@limits, "acqdate,le,st-date-normalized=$dateto"); + if (!@limits) { + push(@limits, "acqdate,ge,st-date-normalized=$datefrom") if ($datefrom); + push(@limits, "acqdate,le,st-date-normalized=$dateto") if ($dateto); } my ( $build_error, $query, $simple_query, $query_cgi, @@ -90,8 +86,9 @@ if ( $op eq "do_search" ) { ); if (!defined $error && @{$results->{biblioserver}{RECORDS}} ) { - $show_results = @{$results->{biblioserver}{RECORDS}}; - $marcresults = $results->{biblioserver}{RECORDS}; + $show_results = grep { defined $_ } @{$results->{biblioserver}{RECORDS}}; + $marcresults = [ grep { defined $_ } @{$results->{biblioserver}{RECORDS}} ]; + $total_hits = $results->{biblioserver}{hits}; } else { Koha::Logger->get->warn("ERROR label-item-search: no results from simple_search_compat"); @@ -196,11 +193,13 @@ if ($show_results) { ); $template->param( - results => ($show_results ? 1 : 0), - result_set=> \@results_set, - batch_id => $batch_id, - type => $type, - ccl_query => $ccl_query, + results => ($show_results ? 1 : 0), + result_set => \@results_set, + batch_id => $batch_id, + type => $type, + idx => $idx, + ccl_textbox => $ccl_textbox, + limits => join(" AND ", @limits), ); } -- 2.34.1