From: vincent@cubedesigners.com Date: Tue, 13 Dec 2016 15:36:13 +0000 (+0000) Subject: fix #1029 @0:10 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=ba509772877f804b348680e1644238f535fd214d;p=cubeextranet.git fix #1029 @0:10 --- diff --git a/inc/ws/DAO/class.ws.dao.document.php b/inc/ws/DAO/class.ws.dao.document.php index 15b9a8309..64c70c553 100644 --- a/inc/ws/DAO/class.ws.dao.document.php +++ b/inc/ws/DAO/class.ws.dao.document.php @@ -34,26 +34,14 @@ class wsDAODocument extends commonDAO { } public function restoreLinksVersion($book_id, $update, $user = 0) { + wsLinks::getLinksAndRulers($book_id, $links, $rulers, $update); - $daoBook = new wsDAOBook($this->con); - $pages = $daoBook->getPagesOfBookAt($book_id, $update); - - $docs = array(); - foreach ($pages as $infos) { - $docs[] = $infos['document_id']; - } - - $r = $this->con->select('SELECT document_id,links,rulers FROM document_links_versions WHERE `update`=' . $update . ' AND document_id IN (' . implode(',', $docs) . ')'); - - while ($r->fetch()) { - wsLinks::setDocumentLinks($r->document_id, $r->links, $r->rulers, $user, 'Links restored from ' . date('Y-m-d H:i:s', $update) . ' version', TIME); - } - + $this->setLinksAndRulers($book_id, json_encode($links), json_encode($rulers), 'Restore links from ' . date('Y-m-d H:i:s', $update), $user); $r = $this->con->select('SELECT * FROM special_links_versions WHERE `update`=' . $update . ' AND book_id=\'' . $this->con->escape($book_id) . '\''); if ($r->count()) { - $dao = new wsDAOBook($this->con); - $dao->setSpecialLinksAndRulers($book_id, $r->links, $r->rulers); + $daoBook = new wsDAOBook($this->con); + $daoBook->setSpecialLinksAndRulers($book_id, $r->links, $r->rulers); } }