From: vincent@cubedesigners.com Date: Wed, 16 Nov 2016 17:25:27 +0000 (+0000) Subject: done #947 @1.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=4c522adc435f4dd7115f3158ece75784097b6b08;p=cubeextranet.git done #947 @1.5 --- diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index a5edbd595..d275cbd04 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -298,7 +298,7 @@ class wsDAOBook extends commonDAO { } public function getPagesOfBookAt($book_id, $time) { - $r = $this->con->select('SELECT * FROM book_pages_versions WHERE book_id=\'' . $this->con->escape($book_id) . '\' ORDER BY `update`'); + $r = $this->con->select('SELECT * FROM book_pages_versions WHERE book_id=\'' . $this->con->escape($book_id) . '\' ORDER BY `update` ASC'); if (!$r->count()) { return $this->getPagesOfBook($book_id); } @@ -309,9 +309,11 @@ class wsDAOBook extends commonDAO { } return $pages; } + $pages = null; while ($r->fetch()) { if ($r->update > $time) { + if (is_null($pages)) { return $this->getPagesOfBook($book_id); } @@ -319,9 +321,14 @@ class wsDAOBook extends commonDAO { if (null === $res || !count($res)) { return $this->getPagesOfBook($book_id); } + return $res; + } + if (!count(unserialize($r->composition))) { + continue; } $pages = $r->composition; } + $res = unserialize($pages); if (null === $res || !count($res)) { return $this->getPagesOfBook($book_id); diff --git a/inc/ws/Util/class.ws.links.php b/inc/ws/Util/class.ws.links.php index 4b493392c..950f1fe36 100644 --- a/inc/ws/Util/class.ws.links.php +++ b/inc/ws/Util/class.ws.links.php @@ -209,7 +209,6 @@ class wsLinks { $daoBook = new wsDAOBook($core->con); $pages = $daoBook->getPagesOfBookAt($book_id, $time); - foreach ($pages as $p => $infos) { $documents[] = $infos['document_id']; } @@ -222,7 +221,7 @@ class wsLinks { $rulers = array(); foreach ($documents as $d) { - echo $d."\n"; + echo $d . "\n"; if (is_null($time)) { $lr = self::getDocumentLastLinks($d); } else {