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; global $mysoc;
// Both export and validation use the EXACT SAME method // 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(); $template_file = $this->getTemplatePath();
if ($template_file && file_exists($template_file) && $this->isFillablePDF($template_file)) { if (!$template_file) {
// Use fillable PDF template (same for both export and validation) $this->error = 'CA-3 template not found';
$result = $this->fillFillablePDF($template_file, $output_path, $declaration, $ca3_data, $mysoc); return false;
return $result ? $output_path : false;
} }
// When no fillable template exists, use improved layout (same for both) // Use the same fillPDFTemplate method that export uses
$result = $this->generateImprovedPDF($output_path, $declaration, $ca3_data, $mysoc); $result = $this->fillPDFTemplate($template_file, $output_path, $declaration, $ca3_data, $mysoc);
return $result ? $output_path : false; return $result ? $output_path : false;
} }