Lines 201-211
sub GetRecentShelves ($$$) {
Link Here
|
201 |
my ($mincategory, $row_count, $owner) = @_; |
201 |
my ($mincategory, $row_count, $owner) = @_; |
202 |
my (@shelflist); |
202 |
my (@shelflist); |
203 |
my $total = _shelf_count($owner, $mincategory); |
203 |
my $total = _shelf_count($owner, $mincategory); |
204 |
my @params = ($owner, $mincategory, 0, $row_count); #FIXME: offset is hardcoded here, but could be passed in for enhancements |
204 |
my @params = ($owner, $mincategory); |
|
|
205 |
push @params, $row_count if (defined $row_count); |
205 |
shift @params if (not defined $owner); |
206 |
shift @params if (not defined $owner); |
206 |
my $query = "SELECT * FROM virtualshelves"; |
207 |
my $query = "SELECT * FROM virtualshelves"; |
207 |
$query .= ((defined $owner) ? " WHERE owner = ? AND category = ?" : " WHERE category >= ? "); |
208 |
$query .= ((defined $owner) ? " WHERE owner = ? AND category = ?" : " WHERE category >= ? "); |
208 |
$query .= " ORDER BY lastmodified DESC LIMIT ?, ?"; |
209 |
$query .= " ORDER BY lastmodified DESC"; |
|
|
210 |
$query .= " LIMIT ?" if (defined $row_count); |
209 |
my $sth = $dbh->prepare($query); |
211 |
my $sth = $dbh->prepare($query); |
210 |
$sth->execute(@params); |
212 |
$sth->execute(@params); |
211 |
@shelflist = $sth->fetchall_arrayref({}); |
213 |
@shelflist = $sth->fetchall_arrayref({}); |
Lines 534-540
sub RefreshShelvesSummary ($$$) {
Link Here
|
534 |
my $session = C4::Auth::get_session($sessionID); |
536 |
my $session = C4::Auth::get_session($sessionID); |
535 |
my ($total, $totshelves, $barshelves, $pubshelves); |
537 |
my ($total, $totshelves, $barshelves, $pubshelves); |
536 |
|
538 |
|
537 |
($barshelves, $totshelves) = GetRecentShelves(1, $row_count, $loggedinuser); |
539 |
($barshelves, $totshelves) = GetRecentShelves(1, undef, $loggedinuser); |
538 |
$total->{'bartotal'} = $totshelves; |
540 |
$total->{'bartotal'} = $totshelves; |
539 |
($pubshelves, $totshelves) = GetRecentShelves(2, $row_count, undef); |
541 |
($pubshelves, $totshelves) = GetRecentShelves(2, $row_count, undef); |
540 |
$total->{'pubtotal'} = $totshelves; |
542 |
$total->{'pubtotal'} = $totshelves; |