[Koha-patches] [PATCH] Bug 5994 : MT2968: private lists display is no longer shortened to 10 lists

Chris Cormack chrisc at catalyst.net.nz
Tue Mar 29 22:54:52 CEST 2011


From: Matthias Meusburger <matthias.meusburger at biblibre.com>

---
 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 5f28d5c..b7192d0 100644
--- 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 77ae394..5c9218a 100644
--- a/C4/VirtualShelves.pm
+++ b/C4/VirtualShelves.pm
@@ -201,11 +201,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({});
@@ -534,7 +536,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 b22837a..9ca01ef 100755
--- a/catalogue/search.pl
+++ b/catalogue/search.pl
@@ -672,7 +672,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 b1bf224..78c0e2a 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 a0d9fdd..c2ee59c 100755
--- a/virtualshelves/addbybiblionumber.pl
+++ b/virtualshelves/addbybiblionumber.pl
@@ -153,7 +153,7 @@ if ( $shelfnumber || ( $shelfnumber == -1 ) ) {    # the shelf already exist.
 }
 else {    # this shelf doesn't already exist.
     my $limit = 10;
-    my ($shelflist);
+    my ($shelflist) = GetRecentShelves(1, undef, $loggedinuser);
     my @shelvesloop;
     my %shelvesloop;
 
-- 
1.7.1



More information about the Koha-patches mailing list