[Koha-patches] [PATCH] kohabug 2437 Corrects LIMIT offset algorithm
Galen Charlton
galen.charlton at liblime.com
Mon Aug 4 17:15:20 CEST 2008
From: Chris Nighswonger <chris.nighswonger at liblime.com>
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 <galen.charlton at liblime.com>
---
C4/VirtualShelves/Page.pm | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm
index 4589aba..a81f1d0 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 );
--
1.5.5.GIT
More information about the Koha-patches
mailing list