Simplify: Both export and validation use the exact same PDF generation method
This commit is contained in:
parent
16a6198dff
commit
bc0b23441f
@ -187,25 +187,17 @@ 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
|
// Both export and validation use the EXACT SAME method
|
||||||
error_log("generateCompleteCA3PDF: Status=" . $status);
|
// Check if we have a custom fillable template
|
||||||
|
$template_file = $this->getTemplatePath();
|
||||||
// For export, check if we have a custom fillable template
|
if ($template_file && file_exists($template_file) && $this->isFillablePDF($template_file)) {
|
||||||
if ($status === 'export') {
|
// Use fillable PDF template (same for both export and validation)
|
||||||
error_log("generateCompleteCA3PDF: Status is export, checking for fillable template");
|
$result = $this->fillFillablePDF($template_file, $output_path, $declaration, $ca3_data, $mysoc);
|
||||||
$template_file = $this->getTemplatePath();
|
return $result ? $output_path : false;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// For validation or when no fillable template exists, use improved layout
|
// When no fillable template exists, use improved layout (same for both)
|
||||||
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'));
|
|
||||||
return $result ? $output_path : false;
|
return $result ? $output_path : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,16 +341,8 @@ class DeclarationTVA_PDF
|
|||||||
|
|
||||||
$filepath = $month_dir . $filename;
|
$filepath = $month_dir . $filename;
|
||||||
|
|
||||||
// Debug logging
|
// Use the same method as export
|
||||||
error_log("generateDetailedCA3PDF: Calling generateCompleteCA3PDF with status='validation'");
|
return $this->generateCompleteCA3PDF($declaration_id, $filepath, 'validation', $outputlangs);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user