Add debugging to validation PDF generation

This commit is contained in:
Frank Cools 2025-10-08 14:48:12 +02:00
parent 4400b83f9c
commit 1cb9837ae7

View File

@ -344,16 +344,25 @@ class DeclarationTVA_PDF
// First generate the PDF using the same method as export
$temp_pdf = $this->generateCA3PDF($declaration_id, $outputlangs);
if ($temp_pdf && file_exists($temp_pdf)) {
// Copy the generated PDF to the validation location
if (copy($temp_pdf, $filepath)) {
// Clean up the temporary file
unlink($temp_pdf);
return $filepath;
}
if (!$temp_pdf) {
$this->error = 'Failed to generate temporary PDF: ' . $this->error;
return false;
}
return false;
if (!file_exists($temp_pdf)) {
$this->error = 'Temporary PDF file does not exist: ' . $temp_pdf;
return false;
}
// Copy the generated PDF to the validation location
if (copy($temp_pdf, $filepath)) {
// Clean up the temporary file
unlink($temp_pdf);
return $filepath;
} else {
$this->error = 'Failed to copy PDF to validation location: ' . $filepath;
return false;
}
}
/**