From b97de5af12d54d2cce197e7ad755ac27df3a9604 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Wed, 15 Feb 2017 02:42:10 +0000 Subject: [PATCH] Bug 13205: Last/first page options for result list paging MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch adds first and last page buttons to the pagination at the bottom of a page of catalog search results. To test: 1) Apply patch 2) Do a number of searches 3) For each search, ensure that the first and last page buttons work as expected Sponsored-by: Catalyst IT Followed test plan, works as expected. Signed-off-by: Marc Véron Signed-off-by: Lee Jamison Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart --- catalogue/search.pl | 2 ++ .../intranet-tmpl/prog/en/includes/page-numbers.inc | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/catalogue/search.pl b/catalogue/search.pl index 7a8cf126dd..7b8e5e2818 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -617,6 +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) - $results_per_page; # default page number my $current_page_number = 1; $current_page_number = ($offset / $results_per_page + 1) if $offset; @@ -667,6 +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, 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 bf277c06e8..d593cdf661 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers.inc @@ -1,7 +1,14 @@ [% IF ( PAGE_NUMBERS ) %][% END %] -- 2.39.5