From c1aa50189801d441a780d09ea59599b9f8fb0af8 Mon Sep 17 00:00:00 2001 From: Frank Cools Date: Mon, 6 Oct 2025 17:54:53 +0200 Subject: [PATCH] Fix PDF generation to include CA-3 form with details - Changed generateDetailedCA3PDF to call generateCA3PDF instead of generateDetailedPDF - generateCA3PDF creates complete PDF with CA-3 form + detailed breakdown pages - generateDetailedPDF only creates detailed pages without the CA-3 form - Now generates complete PDF with both CA-3 form and account details - Copies generated PDF to correct validated directory location --- core/class/declarationtva_pdf.class.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/core/class/declarationtva_pdf.class.php b/core/class/declarationtva_pdf.class.php index dccf87d..4d96379 100644 --- a/core/class/declarationtva_pdf.class.php +++ b/core/class/declarationtva_pdf.class.php @@ -193,8 +193,20 @@ class DeclarationTVA_PDF $filepath = $vat_declarations_dir . $filename; - // Generate detailed PDF with breakdown pages - $result = $this->generateDetailedPDF($filepath, $declaration, $ca3_data, $company); + // Generate complete PDF with CA-3 form and detailed breakdown pages + $result = $this->generateCA3PDF($declaration_id); + + if ($result && file_exists($result)) { + // Copy the generated PDF to our target location + if (copy($result, $filepath)) { + // Clean up the temporary file + unlink($result); + $result = true; + } else { + $this->error = "Failed to copy PDF to target location"; + $result = false; + } + } if ($result) { // Verify file was actually created