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 <ldjamison@marywood.edu>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Aleisha Amohia 2017-07-10 00:07:38 +00:00 committed by Jonathan Druart
parent 5fc0a1f5b1
commit 69ee06a490
4 changed files with 6 additions and 6 deletions

View File

@ -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;
}

View File

@ -13,6 +13,6 @@
[% END %]
[% IF ( next_page_offset ) %]
<li><a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi |html %][% limit_cgi |html %]&amp;offset=[% next_page_offset %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by |url %][% END %]">Next &gt;&gt;</a></li>
<li><a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi |html %][% limit_cgi |html %]&amp;offset=[% last_page %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by |url %][% END %]">Last</a></li>
<li><a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi |html %][% limit_cgi |html %]&amp;offset=[% last_page_offset %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by |url %][% END %]">Last</a></li>
[% END %]
</ul></nav>[% END %]

View File

@ -14,7 +14,7 @@
[% END %]
[% IF ( next_page_offset ) %]
<li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&amp;offset=[% next_page_offset %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by |html %][% END %]">Next &raquo;</a></li>
<li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&amp;offset=[% last_page %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by |html %][% END %]">Last</a></li>
<li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&amp;offset=[% last_page_offset %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by |html %][% END %]">Last</a></li>
[% END %]
</ul>
</div>

View File

@ -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;
}