From 24d7e4f24da7aeb6edc1ff51eb9c19a94af2ce44 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 15 Jan 2026 15:37:33 +0100 Subject: [PATCH] Debug v23 - PDF generation error if additional PDF name not set --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 4 ++-- .../core/modules/commande/doc/pdf_eratosthene.modules.php | 4 ++-- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 4 ++-- htdocs/core/modules/facture/doc/pdf_octopus.modules.php | 8 ++++---- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 8 +++++--- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 4 ++-- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 4 ++-- 7 files changed, 19 insertions(+), 17 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index ff5809fc96c..b09f929a222 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -641,8 +641,8 @@ class pdf_einstein extends ModelePDFCommandes } // Add terms to sale - if (getDolGlobalString("MAIN_INFO_ORDER_TERMSOFSALE") && getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_ORDER')) { - $termsofsalefilename = getDolGlobalString('MAIN_INFO_ORDER_TERMSOFSALE'); + $termsofsalefilename = getDolGlobalString('MAIN_INFO_ORDER_TERMSOFSALE'); + if (getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_ORDER') && $termsofsalefilename) { $termsofsale = $conf->order->dir_output.'/'.$termsofsalefilename; if (!empty($conf->order->multidir_output[$conf->entity])) { $termsofsale = $conf->order->multidir_output[$conf->entity].'/'.$termsofsalefilename; diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 634fb8b3788..64ffa01425f 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -912,8 +912,8 @@ class pdf_eratosthene extends ModelePDFCommandes } // Add terms to sale - if (getDolGlobalString("MAIN_INFO_ORDER_TERMSOFSALE") && getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_ORDER')) { - $termsofsalefilename = getDolGlobalString('MAIN_INFO_ORDER_TERMSOFSALE'); + $termsofsalefilename = getDolGlobalString('MAIN_INFO_ORDER_TERMSOFSALE'); + if (getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_ORDER') && $termsofsalefilename) { $termsofsale = $conf->order->dir_output.'/'.$termsofsalefilename; if (!empty($conf->order->multidir_output[$conf->entity])) { $termsofsale = $conf->order->multidir_output[$conf->entity].'/'.$termsofsalefilename; diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 680fef9806a..1d17784cf00 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -916,8 +916,8 @@ class pdf_crabe extends ModelePDFFactures } // Add terms to sale - if (getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_INVOICE')) { - $termsofsalefilename = getDolGlobalString('MAIN_INFO_INVOICE_TERMSOFSALE'); + $termsofsalefilename = getDolGlobalString('MAIN_INFO_INVOICE_TERMSOFSALE'); + if (getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_INVOICE') && $termsofsalefilename) { $termsofsale = $conf->invoice->dir_output.'/'.$termsofsalefilename; if (!empty($conf->invoice->multidir_output[$object->entity ?? $conf->entity])) { $termsofsale = $conf->invoice->multidir_output[$object->entity ?? $conf->entity].'/'.$termsofsalefilename; diff --git a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php index 71e3a6dba65..a45b513c47b 100644 --- a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php @@ -1190,8 +1190,8 @@ class pdf_octopus extends ModelePDFFactures $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } // Add terms to sale - if (getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_INVOICE')) { - $termsofsalefilename = getDolGlobalString('MAIN_INFO_INVOICE_TERMSOFSALE'); + $termsofsalefilename = getDolGlobalString('MAIN_INFO_INVOICE_TERMSOFSALE'); + if (getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_INVOICE') && $termsofsalefilename) { $termsofsale = $conf->invoice->dir_output.'/'.$termsofsalefilename; if (!empty($conf->invoice->multidir_output[$object->entity ?? $conf->entity])) { $termsofsale = $conf->invoice->multidir_output[$object->entity ?? $conf->entity].'/'.$termsofsalefilename; @@ -1220,8 +1220,8 @@ class pdf_octopus extends ModelePDFFactures } // Add terms to sale - if (getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_INVOICE')) { - $termsofsalefilename = getDolGlobalString('MAIN_INFO_INVOICE_TERMSOFSALE'); + $termsofsalefilename = getDolGlobalString('MAIN_INFO_INVOICE_TERMSOFSALE'); + if (getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_INVOICE') && $termsofsalefilename) { $termsofsale = $conf->invoice->dir_output.'/'.$termsofsalefilename; if (!empty($conf->invoice->multidir_output[$object->entity ?? $conf->entity])) { $termsofsale = $conf->invoice->multidir_output[$object->entity ?? $conf->entity].'/'.$termsofsalefilename; diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index cc2ffaafb47..3d3df464103 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1107,13 +1107,15 @@ class pdf_sponge extends ModelePDFFactures if (method_exists($pdf, 'AliasNbPages')) { $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } + // Add terms to sale - if (getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_INVOICE')) { - $termsofsalefilename = getDolGlobalString('MAIN_INFO_INVOICE_TERMSOFSALE'); + $termsofsalefilename = getDolGlobalString('MAIN_INFO_INVOICE_TERMSOFSALE'); + if (getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_INVOICE') && $termsofsalefilename) { $termsofsale = $conf->invoice->dir_output.'/'.$termsofsalefilename; if (!empty($conf->invoice->multidir_output[$object->entity ?? $conf->entity])) { $termsofsale = $conf->invoice->multidir_output[$object->entity ?? $conf->entity].'/'.$termsofsalefilename; } + if (file_exists($termsofsale) && is_readable($termsofsale)) { $pagecount = $pdf->setSourceFile($termsofsale); for ($i = 1; $i <= $pagecount; $i++) { @@ -1498,7 +1500,7 @@ class pdf_sponge extends ModelePDFFactures } // Show payments conditions - if ($object->type != 2 && ($object->cond_reglement_code || $object->cond_reglement)) { + if ($object->type != 2 && $object->cond_reglement_code) { $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentConditions").':'; diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 75e673327d8..f1dbdcd4d13 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -771,8 +771,8 @@ class pdf_azur extends ModelePDFPropales } // Add terms to sale - if (getDolGlobalString('MAIN_INFO_PROPAL_TERMSOFSALE') && getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_PROPAL')) { - $termsofsalefilename = getDolGlobalString('MAIN_INFO_PROPAL_TERMSOFSALE'); + $termsofsalefilename = getDolGlobalString('MAIN_INFO_PROPAL_TERMSOFSALE'); + if (getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_PROPAL') && $termsofsalefilename) { $termsofsale = $conf->propal->dir_output.'/'.$termsofsalefilename; if (!empty($conf->propal->multidir_output[$object->entity ?? $conf->entity])) { $termsofsale = $conf->propal->multidir_output[$object->entity ?? $conf->entity].'/'.$termsofsalefilename; diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index afd66458274..b68ed8f77ce 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -942,8 +942,8 @@ class pdf_cyan extends ModelePDFPropales } // Add terms to sale - if (getDolGlobalString('MAIN_INFO_PROPAL_TERMSOFSALE') && getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_PROPAL')) { - $termsofsalefilename = getDolGlobalString('MAIN_INFO_PROPAL_TERMSOFSALE'); + $termsofsalefilename = getDolGlobalString('MAIN_INFO_PROPAL_TERMSOFSALE'); + if (getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_PROPAL') && $termsofsalefilename) { $termsofsale = $conf->propal->dir_output.'/'.$termsofsalefilename; if (!empty($conf->propal->multidir_output[$object->entity ?? $conf->entity])) { $termsofsale = $conf->propal->multidir_output[$object->entity ?? $conf->entity].'/'.$termsofsalefilename;