From 39621c013749d86749cffecabb8220114d72172b Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Wed, 3 Jul 2019 13:05:51 +0000 Subject: [PATCH] fix #2857 @1.5 --- inc/ws/Controlleur/class.ws.services.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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; } -- 2.39.5