Restore export to use fillable template, validation uses improved layout

This commit is contained in:
Frank Cools 2025-10-08 14:10:29 +02:00
parent 57a8017b2e
commit 16a6198dff

View File

@ -190,18 +190,20 @@ class DeclarationTVA_PDF
// Debug logging // Debug logging
error_log("generateCompleteCA3PDF: Status=" . $status); error_log("generateCompleteCA3PDF: Status=" . $status);
// Both export and validation should use the same logic // For export, check if we have a custom fillable template
error_log("generateCompleteCA3PDF: Status is " . $status . ", checking for fillable template"); if ($status === 'export') {
$template_file = $this->getTemplatePath(); error_log("generateCompleteCA3PDF: Status is export, checking for fillable template");
if ($template_file && file_exists($template_file) && $this->isFillablePDF($template_file)) { $template_file = $this->getTemplatePath();
// Use fillable PDF template for both export and validation if ($template_file && file_exists($template_file) && $this->isFillablePDF($template_file)) {
error_log("generateCompleteCA3PDF: Using fillable PDF template"); // Use fillable PDF template for export
$result = $this->fillFillablePDF($template_file, $output_path, $declaration, $ca3_data, $mysoc); error_log("generateCompleteCA3PDF: Using fillable PDF template for export");
return $result ? $output_path : false; $result = $this->fillFillablePDF($template_file, $output_path, $declaration, $ca3_data, $mysoc);
return $result ? $output_path : false;
}
} }
// When no fillable template exists, use improved layout for both // For validation or when no fillable template exists, use improved layout
error_log("generateCompleteCA3PDF: No fillable template found, using improved layout"); error_log("generateCompleteCA3PDF: Using improved layout for validation");
$result = $this->generateImprovedPDF($output_path, $declaration, $ca3_data, $mysoc); $result = $this->generateImprovedPDF($output_path, $declaration, $ca3_data, $mysoc);
error_log("generateCompleteCA3PDF: generateImprovedPDF result=" . ($result ? 'true' : 'false')); error_log("generateCompleteCA3PDF: generateImprovedPDF result=" . ($result ? 'true' : 'false'));
return $result ? $output_path : false; return $result ? $output_path : false;
@ -1394,8 +1396,7 @@ class DeclarationTVA_PDF
// Create a temporary detailed PDF // Create a temporary detailed PDF
$temp_detailed_path = tempnam(sys_get_temp_dir(), 'ca3_detailed_') . '.pdf'; $temp_detailed_path = tempnam(sys_get_temp_dir(), 'ca3_detailed_') . '.pdf';
// Use the improved layout for detailed pages $result = $this->generateDetailedPDF($temp_detailed_path, $declaration, $ca3_data, $mysoc);
$result = $this->generateImprovedPDF($temp_detailed_path, $declaration, $ca3_data, $mysoc);
if (!$result) { if (!$result) {
return false; return false;