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
error_log("generateCompleteCA3PDF: Status=" . $status);
// Both export and validation should use the same logic
error_log("generateCompleteCA3PDF: Status is " . $status . ", checking for fillable template");
// 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 both export and validation
error_log("generateCompleteCA3PDF: Using fillable PDF template");
// Use fillable PDF template for export
error_log("generateCompleteCA3PDF: Using fillable PDF template for export");
$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
error_log("generateCompleteCA3PDF: No fillable template found, using improved layout");
// For validation or when no fillable template exists, use improved layout
error_log("generateCompleteCA3PDF: Using improved layout for validation");
$result = $this->generateImprovedPDF($output_path, $declaration, $ca3_data, $mysoc);
error_log("generateCompleteCA3PDF: generateImprovedPDF result=" . ($result ? 'true' : 'false'));
return $result ? $output_path : false;
@ -1394,8 +1396,7 @@ class DeclarationTVA_PDF
// Create a temporary detailed PDF
$temp_detailed_path = tempnam(sys_get_temp_dir(), 'ca3_detailed_') . '.pdf';
// Use the improved layout for detailed pages
$result = $this->generateImprovedPDF($temp_detailed_path, $declaration, $ca3_data, $mysoc);
$result = $this->generateDetailedPDF($temp_detailed_path, $declaration, $ca3_data, $mysoc);
if (!$result) {
return false;