From 10a6eeb94a84a2d70adc6c5fa1471ab94cb1d7be Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 29 Jul 2016 09:27:58 +0200 Subject: [PATCH] Bug 15839: [QA Follow-up] Paging on opac-showreviews Content-Type: text/plain; charset=utf-8 Paging is kind of messy here. This patch at least improves somewhat. The page number should be rounded. The results per page should be passed to the template too. Signed-off-by: Marcel de Rooy Tested a number of reviews and played with count parameter in URL. --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-showreviews.tt | 8 ++++---- opac/opac-showreviews.pl | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-showreviews.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-showreviews.tt index 464aa21..507c118 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-showreviews.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-showreviews.tt @@ -154,21 +154,21 @@
[% IF ( previous_page_offset ) %] - << Previous + << Previous [% ELSE %] [% IF ( previous_page_first ) %] - << Previous + << Previous [% END %] [% END %] [% FOREACH PAGE_NUMBER IN PAGE_NUMBERS %] [% IF ( PAGE_NUMBER.highlight ) %] [% PAGE_NUMBER.pg %] [% ELSE %] - [% PAGE_NUMBER.pg %] + [% PAGE_NUMBER.pg %] [% END %] [% END %] [% IF ( next_page_offset ) %] - Next >> + Next >> [% END %]
[% END # / IF PAGE_NUMBERS %] diff --git a/opac/opac-showreviews.pl b/opac/opac-showreviews.pl index 995ad70..839a536 100755 --- a/opac/opac-showreviews.pl +++ b/opac/opac-showreviews.pl @@ -30,7 +30,7 @@ use C4::Biblio; use C4::Members qw/GetMemberDetails/; use Koha::DateUtils; use Koha::Reviews; -use POSIX qw(ceil strftime); +use POSIX qw(ceil floor strftime); my $template_name; my $query = new CGI; @@ -38,7 +38,7 @@ my $format = $query->param("format") || ''; my $count = C4::Context->preference('OPACnumSearchResults') || 20; my $results_per_page = $query->param('count') || $count; my $offset = $query->param('offset') || 0; -my $page = $offset / $results_per_page + 1; +my $page = floor( $offset / $results_per_page ) + 1; if ($format eq "rss") { $template_name = "opac-showreviews-rss.tt"; @@ -180,6 +180,7 @@ $template->param(next_page_offset => $next_page_offset) unless $pages eq $curren $template->param( reviews => $reviews, + results_per_page => $results_per_page, ); output_html_with_http_headers $query, $cookie, $template->output; -- 1.7.10.4