From 08ac71a6b1b15f0b610fe081d502e38a9b7b7b2d Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Wed, 25 May 2011 15:39:00 +0000 Subject: [PATCH] --- inc/commons/class.common.core.php | 1 + inc/ws/Controlleur/class.ws.url.php | 28 ++++++++++++++++++++++------ inc/ws/DAO/class.ws.dao.book.php | 11 +++++++++++ inc/ws/Metier/class.ws.book.php | 2 +- 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/inc/commons/class.common.core.php b/inc/commons/class.common.core.php index 02a7caf5b..3c4d928e3 100644 --- a/inc/commons/class.common.core.php +++ b/inc/commons/class.common.core.php @@ -374,6 +374,7 @@ class commonCore extends cubeCore { $db->books->numerotation('text', 0, false); $db->books->changedate('integer', 0, false); $db->books->compiledate('integer', 0, false); + $db->books->version('integer',0,false,2); // Clés $db->books->primary('pk_books', 'book_id'); $db->books->index('index_books_nom', 'BTREE', 'nom'); diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index e376ad592..b8db5475c 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -71,6 +71,7 @@ class wsUrl { } if ($droits->revendeur) { $res .= '' . commonUrl::orderby(__('Status'), 'status', $settings, 'sort' . $change) . ''; + $res.='' . __('V') . ''; } $res .= str_repeat('', $droits->creation ? 5 : 4); $res .= ''; @@ -113,11 +114,20 @@ class wsUrl { } else if ($book->status > 1) { $res .= '' . $core->books_status[1] . ''; } + $res.=''.$book->version.''; + } + if ($book->version > 1 || $droits->admin) { + $res .= '' . $btVoir . ''; + $res .= '' . $btEdit . ''; + } else { + $res.=''; } - $res .= '' . $btVoir . ''; - $res .= '' . $btEdit . ''; $res .= '' . $btStats . ''; - $res .= '' . $btDownload . ''; + if ($book->version > 1) { + $res .= '' . $btDownload . ''; + } else { + $res.=''; + } if ($droits->creation) { $res .= '' . $btDel . ''; } @@ -365,8 +375,8 @@ html{height:100%}' . "\n"; $res .= '' . date('Y-m-d H:i:s', $time) . ''; $res .= '' . $infos['links'] . ''; $res .= '' . $infos['rulers'] . ''; - $res.=''.$infos['user'].''; - $res.=''.$infos['comments'].''; + $res.='' . $infos['user'] . ''; + $res.='' . $infos['comments'] . ''; $res .= '' . __('Restaurer') . ''; $res .= '' . str_replace(' ', ' ', __('Export Excel')) . ''; $res .= ''; @@ -765,7 +775,11 @@ html{height:100%}' . "\n"; protected static function checkDocumentVersionOfBook($book_id) { global $core; cubePHP::neverStop(); - $dao = new wsDAOBook($core->con); + $daoBook = new wsDAOBook($core->con); + $book = $daoBook->selectById($book_id); + if ($book->version == 2) { + return; + } $pages = $dao->getPagesOfBook($book_id); $toUpdate = array(); foreach ($pages as $p => $infos) { @@ -784,6 +798,8 @@ html{height:100%}' . "\n"; $daoDoc = new wsDAODocument($core->con); $daoDoc->setLinksFromOldFluidbook($book_id); } + + $daoBook->setVersion($book_id, 2); } public static function testOldLink($args) { diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index 14b2c84b5..c23780386 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -36,6 +36,7 @@ class wsDAOBook extends commonDAO { $book->facturable_id = $r->facturable_id; $book->tache = $r->tache; $book->projet = $r->projet; + $book->version=$r->version; return $book; } @@ -57,6 +58,7 @@ class wsDAOBook extends commonDAO { $book->parametres = new wsBookParametres(); $book->tache = 0; $book->pages = array(); + $book->version=2; return $book; } @@ -137,6 +139,7 @@ class wsDAOBook extends commonDAO { $c->theme = $r->theme; $c->changedate = TIME; $c->compiledate = 0; + $c->version=2; $book_id = $c->book_id = $this->getNextId(); $c->insert(); @@ -162,6 +165,7 @@ class wsDAOBook extends commonDAO { $c->lang = $lang; $c->changedate = TIME; $c->compiledate = TIME; + $c->version=2; $book_id = $c->book_id = $this->getNextId(); $c->insert(); return $this->selectById($book_id); @@ -436,6 +440,13 @@ class wsDAOBook extends commonDAO { $c->status = 2; $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\''); } + + public function setVersion($book_id,$version){ + $c=$this->con->openCursor('books'); + $c->version=$version; + $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\''); + + } public function touch($book_id) { $c = $this->con->openCursor('books'); diff --git a/inc/ws/Metier/class.ws.book.php b/inc/ws/Metier/class.ws.book.php index fbc30f627..c0c458220 100644 --- a/inc/ws/Metier/class.ws.book.php +++ b/inc/ws/Metier/class.ws.book.php @@ -28,7 +28,7 @@ class wsBook extends cubeMetier { protected $specialRulers; protected $changedate; protected $compiledate; - protected $syncv1; + protected $version; public function __get($varname) { if (!property_exists($this, $varname)) { -- 2.39.5