From: vincent@cubedesigners.com Date: Wed, 3 Jul 2019 13:05:51 +0000 (+0000) Subject: fix #2857 @1.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=39621c013749d86749cffecabb8220114d72172b;p=cubeextranet.git fix #2857 @1.5 --- diff --git a/inc/ws/Controlleur/class.ws.services.php b/inc/ws/Controlleur/class.ws.services.php index 976fc3ae4..2c74f16ad 100644 --- a/inc/ws/Controlleur/class.ws.services.php +++ b/inc/ws/Controlleur/class.ws.services.php @@ -427,15 +427,16 @@ class wsServices extends cubeFlashGateway return array('url' => $destURL, 'file' => $destFile); } - public function getPDFComplexBaseDocument($book) + public function getPDFComplexBaseDocument($book, $force = false) { global $core; - switch ($book->parametres->bookmarkUsePDF) { + $mode = $force ? $force : $book->parametres->bookmarkUsePDF; + switch ($mode) { case 'download': - return WS_BOOKS . '/working/' . $book->book_id . '/' . $book->parametres->pdfReplace; + $res = WS_BOOKS . '/working/' . $book->book_id . '/' . $book->parametres->pdfReplace; break; case 'thumbnails': - return WS_BOOKS . '/working/' . $book->book_id . '/' . $book->parametres->pdfThumbnails; + $res = WS_BOOKS . '/working/' . $book->book_id . '/' . $book->parametres->pdfThumbnails; break; case 'pages': default: @@ -445,9 +446,12 @@ class wsServices extends cubeFlashGateway $pages = $daoBook->getPagesOfBook($book->book_id); $daoBook->compilePDF($book, $pages); } - return $normal; + $res = $normal; break; } + if (!file_exists($res) || is_dir($res)) { + return $this->getPDFComplexBaseDocument($book, 'pages'); + } return $res; }