From 8957a299906807e31523f635a8be4990f7de5ef3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Feb 2020 06:28:04 +0100 Subject: [PATCH] FIX #12973 --- dev/dolibarr_changes.txt | 43 +++++++++++++++++++++- htdocs/includes/tecnickcom/tcpdf/tcpdf.php | 6 ++- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index 51eeef8af31..107f561eca6 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -63,10 +63,49 @@ with if (isset($this->imagekeys)) { foreach($this->imagekeys as $file) { -// unlink($file); + // DOL CHANGE If we keep this, source image files are physically destroyed + // unlink($file); } } +* Replace in tcpdf.php + + $preserve = array( + 'file_id', + 'internal_encoding', + 'state', + 'bufferlen', + 'buffer', + 'cached_files', + +with + + $preserve = array( + 'file_id', + 'internal_encoding', + 'state', + 'bufferlen', + 'buffer', + 'cached_files', + // @CHANGE DOL + 'imagekeys', + +* Replace in tcpdf.php + + if (!@TCPDF_STATIC::file_exists($file)) { + return false; + } + +with + + if (!@TCPDF_STATIC::file_exists($file)) { + // DOL CHANGE If we keep this, the image is not visible on pages after the first one. + //var_dump($file.' '.(!@TCPDF_STATIC::file_exists($file))); + //return false; + } + + + * In tecnickcom/tcpdf/include/tcpdf_static, in function fopenLocal, replace if (strpos($filename, '://') === false) { @@ -102,7 +141,7 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php + protected $default_monospaced_font = 'freemono'; - + TCPDI: ------ diff --git a/htdocs/includes/tecnickcom/tcpdf/tcpdf.php b/htdocs/includes/tecnickcom/tcpdf/tcpdf.php index aa66879f7a1..dd20e957d5b 100644 --- a/htdocs/includes/tecnickcom/tcpdf/tcpdf.php +++ b/htdocs/includes/tecnickcom/tcpdf/tcpdf.php @@ -6878,7 +6878,9 @@ class TCPDF { } // check if file exist and it is valid if (!@TCPDF_STATIC::file_exists($file)) { - return false; + // DOL CHANGE If we keep this, the image is not visible on pages after the first one. + //var_dump($file.' '.(!@TCPDF_STATIC::file_exists($file))); + //return false; } if (($imsize = @getimagesize($file)) === FALSE) { if (in_array($file, $this->imagekeys)) { @@ -7810,6 +7812,8 @@ class TCPDF { 'bufferlen', 'buffer', 'cached_files', +// @CHANGE DOL +// 'imagekeys', 'sign', 'signature_data', 'signature_max_length',