From: Matthias Meusburger <[email protected]>

Signed-off-by: Henri-Damien LAURENT <[email protected]>
---
 C4/Auth.pm                          |    2 +-
 C4/VirtualShelves.pm                |    8 +++++---
 catalogue/search.pl                 |    2 +-
 opac/opac-addbybiblionumber.pl      |    2 +-
 virtualshelves/addbybiblionumber.pl |    2 +-
 5 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/C4/Auth.pm b/C4/Auth.pm
index b6ed2cc..21efd4d 100755
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -837,7 +837,7 @@ sub checkauth {
                                # and the number of lists to be displayed of 
each type in the 'Lists' button drop down
                                my $row_count = 10; # FIXME:This probably 
should be a syspref
                                my ($total, $totshelves, $barshelves, 
$pubshelves);
-                               ($barshelves, $totshelves) = 
C4::VirtualShelves::GetRecentShelves(1, $row_count, $borrowernumber);
+                               ($barshelves, $totshelves) = 
C4::VirtualShelves::GetRecentShelves(1, undef, $borrowernumber);
                                $total->{'bartotal'} = $totshelves;
                                ($pubshelves, $totshelves) = 
C4::VirtualShelves::GetRecentShelves(2, $row_count, undef);
                                $total->{'pubtotal'} = $totshelves;
diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm
index 735087e..82acee0 100644
--- a/C4/VirtualShelves.pm
+++ b/C4/VirtualShelves.pm
@@ -203,11 +203,13 @@ sub GetRecentShelves ($$$) {
        my ($mincategory, $row_count, $owner) = @_;
     my (@shelflist);
        my $total = _shelf_count($owner, $mincategory);
-       my @params = ($owner, $mincategory, 0, $row_count);      #FIXME: offset 
is hardcoded here, but could be passed in for enhancements
+       my @params = ($owner, $mincategory);    
+       push @params, $row_count if (defined $row_count);
        shift @params if (not defined $owner);
        my $query = "SELECT * FROM virtualshelves";
        $query .= ((defined $owner) ? " WHERE owner = ? AND category = ?" : " 
WHERE category >= ? ");
-       $query .= " ORDER BY lastmodified DESC LIMIT ?, ?";
+       $query .= " ORDER BY lastmodified DESC";
+       $query .= " LIMIT ?" if (defined $row_count);
        my $sth = $dbh->prepare($query);
        $sth->execute(@params);
        @shelflist = $sth->fetchall_arrayref({});
@@ -573,7 +575,7 @@ sub RefreshShelvesSummary ($$$) {
        my $session = C4::Auth::get_session($sessionID);
        my ($total, $totshelves, $barshelves, $pubshelves);
 
-       ($barshelves, $totshelves) = GetRecentShelves(1, $row_count, 
$loggedinuser);
+       ($barshelves, $totshelves) = GetRecentShelves(1, undef, $loggedinuser);
        $total->{'bartotal'} = $totshelves;
        ($pubshelves, $totshelves) = GetRecentShelves(2, $row_count, undef);
        $total->{'pubtotal'} = $totshelves;
diff --git a/catalogue/search.pl b/catalogue/search.pl
index adb3cc7..b89fdf6 100755
--- a/catalogue/search.pl
+++ b/catalogue/search.pl
@@ -644,7 +644,7 @@ if ($query_desc || $limit_desc) {
 
 my $row_count = 10; # FIXME:This probably should be a syspref
 my ($pubshelves, $total) = GetRecentShelves(2, $row_count, undef);
-my ($barshelves, $total) = GetRecentShelves(1, $row_count, $borrowernumber);
+my ($barshelves, $total) = GetRecentShelves(1, undef, $borrowernumber);
 
 my @pubshelves = @{$pubshelves};
 my @barshelves = @{$barshelves};
diff --git a/opac/opac-addbybiblionumber.pl b/opac/opac-addbybiblionumber.pl
index cb3a372..dabb884 100755
--- a/opac/opac-addbybiblionumber.pl
+++ b/opac/opac-addbybiblionumber.pl
@@ -102,7 +102,7 @@ else {
     my %shelvesloop;
     #grab each type of shelf, open (type 3) should not be limited by user.
     foreach my $shelftype (1,2,3) {
-        my ($shelflist) = GetRecentShelves($shelftype, $limit, $shelftype == 3 
? undef : $loggedinuser);
+        my ($shelflist) = GetRecentShelves($shelftype, $shelftype == 1 ? undef 
: $limit, $shelftype == 3 ? undef : $loggedinuser);
         for my $shelf (@{ $shelflist->[0] }) {
             push(@shelvesloop, $shelf->{shelfnumber});
             $shelvesloop{$shelf->{shelfnumber}} = $shelf->{shelfname};
diff --git a/virtualshelves/addbybiblionumber.pl 
b/virtualshelves/addbybiblionumber.pl
index 215a145..8b8a6ca 100755
--- a/virtualshelves/addbybiblionumber.pl
+++ b/virtualshelves/addbybiblionumber.pl
@@ -152,7 +152,7 @@ if ( $shelfnumber || ( $shelfnumber == -1 ) ) {    # the 
shelf already exist.
 }
 else {    # this shelf doesn't already exist.
     my $limit = 10;
-    my ($shelflist) = GetRecentShelves(1, $limit, $loggedinuser);
+    my ($shelflist) = GetRecentShelves(1, undef, $loggedinuser);
     my @shelvesloop;
     my %shelvesloop;
     for my $shelf ( @{ $shelflist->[0] } ) {
-- 
1.6.3.3

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to