From 79e3a562faaba801d45a0026b695af73cc06b113 Mon Sep 17 00:00:00 2001 From: Frank Cools Date: Wed, 8 Oct 2025 14:04:13 +0200 Subject: [PATCH] Add debug logging for validation PDF generation --- core/class/declarationtva_pdf.class.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/core/class/declarationtva_pdf.class.php b/core/class/declarationtva_pdf.class.php index 9d30a5d..bbca44b 100644 --- a/core/class/declarationtva_pdf.class.php +++ b/core/class/declarationtva_pdf.class.php @@ -187,18 +187,25 @@ class DeclarationTVA_PDF // Get company information from Dolibarr's company configuration global $mysoc; + // Debug logging + error_log("generateCompleteCA3PDF: Status=" . $status); + // For export, check if we have a custom fillable template if ($status === 'export') { + error_log("generateCompleteCA3PDF: Status is export, checking for fillable template"); $template_file = $this->getTemplatePath(); if ($template_file && file_exists($template_file) && $this->isFillablePDF($template_file)) { // Use fillable PDF template for export + error_log("generateCompleteCA3PDF: Using fillable PDF template"); $result = $this->fillFillablePDF($template_file, $output_path, $declaration, $ca3_data, $mysoc); return $result ? $output_path : false; } } // For validation or when no fillable template exists, use improved layout + error_log("generateCompleteCA3PDF: Using improved layout"); $result = $this->generateImprovedPDF($output_path, $declaration, $ca3_data, $mysoc); + error_log("generateCompleteCA3PDF: generateImprovedPDF result=" . ($result ? 'true' : 'false')); return $result ? $output_path : false; } @@ -334,8 +341,16 @@ class DeclarationTVA_PDF $filepath = $vat_declarations_dir . $filename; + // Debug logging + error_log("generateDetailedCA3PDF: Calling generateCompleteCA3PDF with status='validation'"); + error_log("generateDetailedCA3PDF: Output path=" . $filepath); + // Use the new unified method for validation - return $this->generateCompleteCA3PDF($declaration_id, $filepath, 'validation', $outputlangs); + $result = $this->generateCompleteCA3PDF($declaration_id, $filepath, 'validation', $outputlangs); + + error_log("generateDetailedCA3PDF: Result=" . ($result ? $result : 'false')); + + return $result; } /**