From 606f72b97ac415ed2e135378e6c292b15a77ab36 Mon Sep 17 00:00:00 2001 From: Chris Nighswonger Date: Mon, 4 Aug 2008 10:15:20 -0500 Subject: [PATCH] kohabug 2437 Corrects LIMIT offset algorithm Because of a miscalculation in the offset algorithm, the LIMIT offset creeps backwards by a magnitude for every page beyond page two. This patch corrects the algorithm to behave as expected. Signed-off-by: Galen Charlton Signed-off-by: Joshua Ferraro --- C4/VirtualShelves/Page.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm index 4589aba78b..a81f1d0ed0 100755 --- a/C4/VirtualShelves/Page.pm +++ b/C4/VirtualShelves/Page.pm @@ -66,9 +66,9 @@ sub shelfpage ($$$$$) { my ($shelflimit, $shelfoffset, $shelveslimit, $shelvesoffset); # FIXME: These limits should not be hardcoded... $shelflimit = 20; # Limits number of items returned for a given query - $shelfoffset = (($itemoff == 1) ? 0 : ($itemoff * 10)); # Sets the offset to begin retrieving items at + $shelfoffset = ($itemoff - 1) * 20; # Sets the offset to begin retrieving items at $shelveslimit = 20; # Limits number of shelves returned for a given query (row_count) - $shelvesoffset = (($shelfoff == 1) ? 0 : ($shelfoff * 10)); # Sets the offset to begin retrieving shelves at (offset) + $shelvesoffset = ($shelfoff - 1) * 20; # Sets the offset to begin retrieving shelves at (offset) # getting the Shelves list my $category = (($displaymode eq 'privateshelves') ? 1 : 2); my ($shelflist, $totshelves) = GetShelves( $category, $shelveslimit, $shelvesoffset, $loggedinuser ); -- 2.39.2