diff --git a/core/class/declarationtva_pdf.class.php b/core/class/declarationtva_pdf.class.php index fc5a9d5..01d4fb0 100644 --- a/core/class/declarationtva_pdf.class.php +++ b/core/class/declarationtva_pdf.class.php @@ -190,20 +190,18 @@ class DeclarationTVA_PDF // 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; - } + // Both export and validation should use the same logic + error_log("generateCompleteCA3PDF: Status is " . $status . ", checking for fillable template"); + $template_file = $this->getTemplatePath(); + if ($template_file && file_exists($template_file) && $this->isFillablePDF($template_file)) { + // Use fillable PDF template for both export and validation + 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"); + // When no fillable template exists, use improved layout for both + error_log("generateCompleteCA3PDF: No fillable template found, 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;