@@ -, +, @@ --- 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(-) --- a/C4/Auth.pm +++ a/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; --- a/C4/VirtualShelves.pm +++ a/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; --- a/catalogue/search.pl +++ a/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}; --- a/opac/opac-addbybiblionumber.pl +++ a/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}; --- a/virtualshelves/addbybiblionumber.pl +++ a/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; --