Add debugging to hasValidatedDocument method
This commit is contained in:
parent
e82ec53a37
commit
3da20373ce
@ -1260,17 +1260,28 @@ 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 number
|
||||
$pattern = $vat_declarations_dir . 'CA3_' . $obj->declaration_number . '_*.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_*' . $obj->declaration_number . '*.pdf';
|
||||
$files = glob($pattern);
|
||||
error_log("hasValidatedDocument: Flexible pattern: " . $pattern);
|
||||
error_log("hasValidatedDocument: Flexible files found: " . print_r($files, true));
|
||||
}
|
||||
|
||||
return !empty($files) && file_exists($files[0]);
|
||||
$result = !empty($files) && file_exists($files[0]);
|
||||
error_log("hasValidatedDocument: Final result: " . ($result ? 'true' : 'false'));
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user