Remove debug messages from PDF generation and validation
This commit is contained in:
parent
9aeb09cc5c
commit
2fefe384b7
@ -1260,28 +1260,17 @@ class DeclarationTVA
|
||||
// Check if PDF file exists in the VAT declarations validated directory
|
||||
$vat_declarations_dir = DOL_DATA_ROOT . '/declarationtva/validated/';
|
||||
|
||||
// Debug: Log the search
|
||||
error_log("hasValidatedDocument: Searching in " . $vat_declarations_dir . " for declaration " . $obj->declaration_number);
|
||||
|
||||
// Look for PDF files with the declaration ID (not declaration number)
|
||||
$pattern = $vat_declarations_dir . 'CA3_' . $declaration_id . '_*.pdf';
|
||||
$files = glob($pattern);
|
||||
|
||||
// Debug: Log the pattern and results
|
||||
error_log("hasValidatedDocument: Pattern: " . $pattern);
|
||||
error_log("hasValidatedDocument: Files found: " . print_r($files, true));
|
||||
|
||||
// If no files found with the exact pattern, try a more flexible search
|
||||
if (empty($files)) {
|
||||
$pattern = $vat_declarations_dir . 'CA3_*' . $declaration_id . '*.pdf';
|
||||
$files = glob($pattern);
|
||||
error_log("hasValidatedDocument: Flexible pattern: " . $pattern);
|
||||
error_log("hasValidatedDocument: Flexible files found: " . print_r($files, true));
|
||||
}
|
||||
|
||||
$result = !empty($files) && file_exists($files[0]);
|
||||
error_log("hasValidatedDocument: Final result: " . ($result ? 'true' : 'false'));
|
||||
return $result;
|
||||
return !empty($files) && file_exists($files[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -336,25 +336,16 @@ class DeclarationTVA_PDF
|
||||
// First generate the PDF using the same method as export
|
||||
$temp_pdf = $this->generateCA3PDF($declaration_id, $outputlangs);
|
||||
|
||||
if (!$temp_pdf) {
|
||||
$this->error = 'Failed to generate temporary PDF: ' . $this->error;
|
||||
return false;
|
||||
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 (!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;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user