diff --git a/core/class/declarationtva_pdf.class.php b/core/class/declarationtva_pdf.class.php index c5aa9e0..ac4d9d1 100644 --- a/core/class/declarationtva_pdf.class.php +++ b/core/class/declarationtva_pdf.class.php @@ -187,25 +187,17 @@ class DeclarationTVA_PDF // Get company information from Dolibarr's company configuration global $mysoc; - // 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 for export"); - $result = $this->fillFillablePDF($template_file, $output_path, $declaration, $ca3_data, $mysoc); - return $result ? $output_path : false; - } + // Both export and validation use the EXACT SAME method + // Check if we have a custom fillable template + $template_file = $this->getTemplatePath(); + if ($template_file && file_exists($template_file) && $this->isFillablePDF($template_file)) { + // Use fillable PDF template (same for both export and validation) + $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 for validation"); + // When no fillable template exists, use improved layout (same for both) $result = $this->generateImprovedPDF($output_path, $declaration, $ca3_data, $mysoc); - error_log("generateCompleteCA3PDF: generateImprovedPDF result=" . ($result ? 'true' : 'false')); return $result ? $output_path : false; } @@ -349,16 +341,8 @@ class DeclarationTVA_PDF $filepath = $month_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 - $result = $this->generateCompleteCA3PDF($declaration_id, $filepath, 'validation', $outputlangs); - - error_log("generateDetailedCA3PDF: Result=" . ($result ? $result : 'false')); - - return $result; + // Use the same method as export + return $this->generateCompleteCA3PDF($declaration_id, $filepath, 'validation', $outputlangs); } /**