Add debug logging for validation PDF generation

This commit is contained in:
Frank Cools 2025-10-08 14:04:13 +02:00
parent a64b60a412
commit 79e3a562fa

View File

@ -187,18 +187,25 @@ class DeclarationTVA_PDF
// Get company information from Dolibarr's company configuration // Get company information from Dolibarr's company configuration
global $mysoc; global $mysoc;
// Debug logging
error_log("generateCompleteCA3PDF: Status=" . $status);
// For export, check if we have a custom fillable template // For export, check if we have a custom fillable template
if ($status === 'export') { if ($status === 'export') {
error_log("generateCompleteCA3PDF: Status is export, checking for fillable template");
$template_file = $this->getTemplatePath(); $template_file = $this->getTemplatePath();
if ($template_file && file_exists($template_file) && $this->isFillablePDF($template_file)) { if ($template_file && file_exists($template_file) && $this->isFillablePDF($template_file)) {
// Use fillable PDF template for export // Use fillable PDF template for export
error_log("generateCompleteCA3PDF: Using fillable PDF template");
$result = $this->fillFillablePDF($template_file, $output_path, $declaration, $ca3_data, $mysoc); $result = $this->fillFillablePDF($template_file, $output_path, $declaration, $ca3_data, $mysoc);
return $result ? $output_path : false; return $result ? $output_path : false;
} }
} }
// For validation or when no fillable template exists, use improved layout // For validation or when no fillable template exists, use improved layout
error_log("generateCompleteCA3PDF: Using improved layout");
$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'));
return $result ? $output_path : false; return $result ? $output_path : false;
} }
@ -334,8 +341,16 @@ class DeclarationTVA_PDF
$filepath = $vat_declarations_dir . $filename; $filepath = $vat_declarations_dir . $filename;
// Debug logging
error_log("generateDetailedCA3PDF: Calling generateCompleteCA3PDF with status='validation'");
error_log("generateDetailedCA3PDF: Output path=" . $filepath);
// Use the new unified method for validation // Use the new unified method for validation
return $this->generateCompleteCA3PDF($declaration_id, $filepath, 'validation', $outputlangs); $result = $this->generateCompleteCA3PDF($declaration_id, $filepath, 'validation', $outputlangs);
error_log("generateDetailedCA3PDF: Result=" . ($result ? $result : 'false'));
return $result;
} }
/** /**