Fix display of downloads

master
Gilles Crettenand 11 years ago
parent 6d97b2047f
commit eeaa6aa01f

@ -85,11 +85,12 @@ class User extends DbMapping
private function _getCirculations($table, $sort = "ItemNr ASC") {
$sql = sprintf("SELECT
NoticeID,
n.NoticeNr,
CheckOutDate,
ItemNr
FROM %s AS c
INNER JOIN Items AS i ON i.ItemId = c.ItemId
INNER JOIN Notices AS n ON n.NoticeID = i.NoticeID
WHERE
c.UserAccountID = %s
ORDER BY %s", $table, $this->id, $sort);
@ -97,8 +98,10 @@ class User extends DbMapping
$result = Connection::execute($sql);
$circulations = $result->to_array();
$ids = array_map(function($c) { return $c['NoticeID']; }, $circulations);
$books = count($ids) > 0 ? BookSearch::GetBooks($ids, 'id') : array();
// getting the intval of the NoticeNr will remove any 'V' or 'T' and thus we will have no issues with
// the virtual books that are used for Downloads and so.
$codes = array_unique(array_map(function($c) { return intval(trim($c['NoticeNr'])); }, $circulations));
$books = count($codes) > 0 ? BookSearch::GetBooks($codes) : array();
foreach($circulations as $c) {
$id = $c['NoticeID'];

Loading…
Cancel
Save