From ec321d26d658c8a6d5840be2d81c37ca08ee8576 Mon Sep 17 00:00:00 2001 From: Adrien RENARD Date: Sat, 27 Jan 2024 01:31:22 +0100 Subject: [PATCH] =?UTF-8?q?Debug=20g=C3=A9n=C3=A9ration=20PDF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/.gitignore | 3 ++- functions/functions_contrats.php | 15 ++++++--------- functions/functions_legumes.php | 14 +++++--------- functions/functions_livraisons.php | 17 +++++++---------- 4 files changed, 20 insertions(+), 29 deletions(-) diff --git a/conf/.gitignore b/conf/.gitignore index 1df6460..d15718b 100644 --- a/conf/.gitignore +++ b/conf/.gitignore @@ -2,4 +2,5 @@ * # But not these files... !.gitignore -!*.php \ No newline at end of file +!*.php +!*.sql \ No newline at end of file diff --git a/functions/functions_contrats.php b/functions/functions_contrats.php index 89460b8..463e943 100644 --- a/functions/functions_contrats.php +++ b/functions/functions_contrats.php @@ -286,15 +286,13 @@ function eraseContrat($id) { //////////////////////////////////////////////////////////////////////// function printContratsList($list) { - $GLOBALS['smarty'] -> assign('logo', PUBLIC_HTML_ADMIN.'img/logo.png'); + $GLOBALS['smarty'] -> assign('logo', "file://".PUBLIC_HTML_ADMIN_PATH."/img/logo.png"); $GLOBALS['smarty'] -> assign('date', formatDate('', '', 'print_date')); $GLOBALS['smarty'] -> assign('time', formatDate('', '', 'print_time')); - - $cssFiles = array( - PUBLIC_HTML_ADMIN.'css/bootstrap_print_light.css', - PUBLIC_HTML_ADMIN.'css/print.css' - ); - $GLOBALS['smarty'] -> assign('cssFiles',$cssFiles); + $GLOBALS['smarty'] -> assign('cssFiles',array( + "file://".PUBLIC_HTML_ADMIN_PATH."css/bootstrap_print_light.css", + "file://".PUBLIC_HTML_ADMIN_PATH."css/print.css" + )); // LIST $pList = array(); @@ -343,9 +341,8 @@ function printContratsList($list) { $GLOBALS['smarty'] -> assign('list',$pList); $html = $GLOBALS['smarty']->fetch("contrats/contrats_list_print.tpl"); -// die($html); - $dompdf = new Dompdf\Dompdf(); + $dompdf = new Dompdf\Dompdf(["chroot" => ROOT_DIR_PATH]); $dompdf->loadHtml($html); $dompdf->setPaper('A4', "portrait"); $options = $dompdf->getOptions(); diff --git a/functions/functions_legumes.php b/functions/functions_legumes.php index c7d0691..89025da 100644 --- a/functions/functions_legumes.php +++ b/functions/functions_legumes.php @@ -370,19 +370,15 @@ function eraseLegumeTarif($id) { //////////////////////////////////////////////////////////////////////// function printLegumesList() { - $root_url = "file://".ROOT_DIR_PATH."public_html_admin"; - $GLOBALS['smarty'] -> assign('logo', "$root_url/img/logo.png"); + $GLOBALS['smarty'] -> assign('logo', "file://".PUBLIC_HTML_ADMIN_PATH."/img/logo.png"); $GLOBALS['smarty'] -> assign('date', formatDate('', '', 'print_date')); $GLOBALS['smarty'] -> assign('time', formatDate('', '', 'print_time')); - - $cssFiles = array( - "$root_url/css/bootstrap_print_light.css", - "$root_url/css/print.css", - ); - $GLOBALS['smarty'] -> assign('cssFiles',$cssFiles); + $GLOBALS['smarty'] -> assign('cssFiles',array( + "file://".PUBLIC_HTML_ADMIN_PATH."css/bootstrap_print_light.css", + "file://".PUBLIC_HTML_ADMIN_PATH."css/print.css" + )); $html = $GLOBALS['smarty']->fetch("legumes/legumes_list_print.tpl"); - //die($html); $dompdf = new Dompdf\Dompdf(["chroot" => ROOT_DIR_PATH]); $dompdf->loadHtml($html); diff --git a/functions/functions_livraisons.php b/functions/functions_livraisons.php index b390238..1ffe1ea 100644 --- a/functions/functions_livraisons.php +++ b/functions/functions_livraisons.php @@ -687,20 +687,17 @@ function clearLivraisonLegumes($livraison) { //////////////////////////////////////////////////////////////////////// function exportLivraisonTemplateToPDF($templateFile, $outputFileName, $orientation='portrait') { - $GLOBALS['smarty'] -> assign('logo', PUBLIC_HTML_ADMIN.'img/logo.png'); - - $cssFiles = array( - PUBLIC_HTML_ADMIN.'css/bootstrap_print_light.css', - PUBLIC_HTML_ADMIN.'css/print.css', - PUBLIC_HTML_ADMIN.'css/livraisons.css' - ); - $GLOBALS['smarty'] -> assign('cssFiles',$cssFiles); + $GLOBALS['smarty'] -> assign('logo', "file://".PUBLIC_HTML_ADMIN_PATH."/img/logo.png"); + $GLOBALS['smarty'] -> assign('cssFiles',array( + "file://".PUBLIC_HTML_ADMIN_PATH."css/bootstrap_print_light.css", + "file://".PUBLIC_HTML_ADMIN_PATH."css/print.css", + "file://".PUBLIC_HTML_ADMIN_PATH."css/livraisons.css" + )); $GLOBALS['smarty'] -> assign('orientation',$orientation); $html = $GLOBALS['smarty']->fetch($templateFile); -// die($html); - $dompdf = new Dompdf\Dompdf(); + $dompdf = new Dompdf\Dompdf(["chroot" => ROOT_DIR_PATH]); $dompdf->loadHtml($html); $dompdf->setPaper('A4', $orientation); $options = $dompdf->getOptions();