Make validation use same PDF generation as export (fillable template)

This commit is contained in:
Frank Cools 2025-10-08 14:06:59 +02:00
parent 5d97dfbad2
commit 555d688f17

View File

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