From eeaa6aa01f650a530b0604e8b37dfc608da8e734 Mon Sep 17 00:00:00 2001 From: Gilles Crettenand Date: Wed, 3 Jun 2015 14:11:51 +0200 Subject: [PATCH] Fix display of downloads --- Lib/db/User.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Lib/db/User.php b/Lib/db/User.php index 8ee8d59..f546f03 100644 --- a/Lib/db/User.php +++ b/Lib/db/User.php @@ -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'];