diff --git a/core/class/declarationtva_pdf.class.php b/core/class/declarationtva_pdf.class.php index 81f76cc..bc95f50 100644 --- a/core/class/declarationtva_pdf.class.php +++ b/core/class/declarationtva_pdf.class.php @@ -340,8 +340,20 @@ class DeclarationTVA_PDF $filepath = $month_dir . $filename; - // Use the same method as export - return $this->generateCompleteCA3PDF($declaration_id, $filepath, 'validation', $outputlangs); + // Use the exact same method as export but with the correct output path + // 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; + } + } + + return false; } /**