Fix validation to use exact same method as export (fillPDFTemplate)

This commit is contained in:
Frank Cools 2025-10-08 14:17:35 +02:00
parent bc0b23441f
commit 7095c8611a

View File

@ -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;
}