From 69ee06a490a64985dfccd01cf689ae77eea1d2d5 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Mon, 10 Jul 2017 00:07:38 +0000 Subject: [PATCH] Bug 13205: [FOLLOW-UP] Fixing math and variable names Have changed my $last_page = $pages * ( $results_per_page - 1 ); to my $last_page = ( $pages - 1) * $results_per_page; which seems to fix the 'last' button offset! (Comment 10) Will add the box to jump to a page in a separate patch. Adding the pagination to the top on the staff client will be dealt with in Bug 18916 as it is slightly out of the scope of this bug. Signed-off-by: Lee Jamison Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart --- catalogue/search.pl | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers.inc | 2 +- koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc | 2 +- opac/opac-search.pl | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/catalogue/search.pl b/catalogue/search.pl index baeb8b8a0d..05d064bcdc 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -617,7 +617,7 @@ for (my $i=0;$i<@servers;$i++) { my @page_numbers; # total number of pages there will be my $pages = ceil($hits / $results_per_page); - my $last_page = $pages * ( $results_per_page - 1 ); + my $last_page_offset = ( $pages -1 ) * $results_per_page; # default page number my $current_page_number = 1; $current_page_number = ($offset / $results_per_page + 1) if $offset; @@ -668,7 +668,7 @@ for (my $i=0;$i<@servers;$i++) { } # FIXME: no previous_page_offset when pages < 2 $template->param( PAGE_NUMBERS => \@page_numbers, - last_page => $last_page, + last_page_offset => $last_page_offset, previous_page_offset => $previous_page_offset) unless $pages < 2; $template->param( next_page_offset => $next_page_offset) unless $pages eq $current_page_number; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers.inc index 4d9e291b85..1c9bd33723 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers.inc @@ -13,6 +13,6 @@ [% END %] [% IF ( next_page_offset ) %]
  • Next >>
  • -
  • Last
  • +
  • Last
  • [% END %] [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc index a3f35da4e4..fbfdfc8124 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc @@ -14,7 +14,7 @@ [% END %] [% IF ( next_page_offset ) %]
  • Next »
  • -
  • Last
  • +
  • Last
  • [% END %] diff --git a/opac/opac-search.pl b/opac/opac-search.pl index d9c4505fd7..133b671bdf 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -839,7 +839,7 @@ for (my $i=0;$i<@servers;$i++) { my @page_numbers; # total number of pages there will be my $pages = ceil($hits / $results_per_page); - my $last_page = $pages * ( $results_per_page - 1 ); + my $last_page_offset = ( $pages - 1 ) * $results_per_page; # default page number my $current_page_number = 1; if ($offset) { @@ -890,7 +890,7 @@ for (my $i=0;$i<@servers;$i++) { } $template->param( PAGE_NUMBERS => \@page_numbers, - last_page => $last_page, + last_page_offset => $last_page_offset, previous_page_offset => $previous_page_offset) unless $pages < 2; $template->param(next_page_offset => $next_page_offset) unless $pages eq $current_page_number; } -- 2.39.5