diff --git a/core/class/declarationtva_pdf.class.php b/core/class/declarationtva_pdf.class.php index ac4d9d1..81f76cc 100644 --- a/core/class/declarationtva_pdf.class.php +++ b/core/class/declarationtva_pdf.class.php @@ -188,16 +188,15 @@ class DeclarationTVA_PDF global $mysoc; // Both export and validation use the EXACT SAME method - // Check if we have a custom fillable template + // Use the same logic as the original export method $template_file = $this->getTemplatePath(); - if ($template_file && file_exists($template_file) && $this->isFillablePDF($template_file)) { - // Use fillable PDF template (same for both export and validation) - $result = $this->fillFillablePDF($template_file, $output_path, $declaration, $ca3_data, $mysoc); - return $result ? $output_path : false; + if (!$template_file) { + $this->error = 'CA-3 template not found'; + return false; } - // When no fillable template exists, use improved layout (same for both) - $result = $this->generateImprovedPDF($output_path, $declaration, $ca3_data, $mysoc); + // Use the same fillPDFTemplate method that export uses + $result = $this->fillPDFTemplate($template_file, $output_path, $declaration, $ca3_data, $mysoc); return $result ? $output_path : false; }