-=head2 GetShelvesSummary
-
- ($shelves, $total) = GetShelvesSummary($mincategory, $row_count, $offset, $owner)
-
-Returns the number of shelves specified by C<$row_count> and C<$offset> as well as the total
-number of shelves that meet the C<$owner> and/or C<$mincategory> criteria. C<$mincategory>,
-C<$row_count>, and C<$offset> are required. C<$owner> must be supplied when C<$mincategory> == 1.
-When C<$mincategory> is 2 or 3, supply undef as argument for C<$owner>.
-
-=cut
-
-sub GetShelvesSummary ($$$$) {
- my ($mincategory, $row_count, $offset, $owner) = @_;
- my @params = ($owner, $mincategory, ($offset ? $offset : 0), $row_count);
- my @params1 = ($owner, $mincategory);
- if ($mincategory > 1) {
- shift @params;
- shift @params1;
- }
- my $total = _shelf_count($owner, $mincategory);
- # grab only the shelves meeting the row_count/offset spec...
- my $query = qq(
- SELECT
- virtualshelves.shelfnumber,
- virtualshelves.shelfname,
- owner,
- CONCAT(firstname, ' ', surname) AS name,
- virtualshelves.category,
- count(virtualshelfcontents.biblionumber) AS count
- FROM virtualshelves
- LEFT JOIN virtualshelfcontents ON virtualshelves.shelfnumber = virtualshelfcontents.shelfnumber
- LEFT JOIN borrowers ON virtualshelves.owner = borrowers.borrowernumber );
- $query .= ($mincategory == 1) ? "WHERE owner=? AND category=?" : "WHERE category>=?";
- $query .= qq(
- GROUP BY virtualshelves.shelfnumber
- ORDER BY virtualshelves.category
- DESC
- LIMIT ?, ?);
- my $sth2 = $dbh->prepare($query);
- $sth2->execute(@params);
- my $shelves = $sth2->fetchall_arrayref({});
- return ($shelves, $total);
-
- # Probably NOT the final implementation since it is still bulky (repeated hash keys).
- # might like an array of rows of delimited values:
- # 1|2||0|blacklist|112
- # 2|6|Josh Ferraro|51|en_fuego|106
-}
-
-=head2 GetRecentShelves