Fix PDF file pattern matching in document detection
- Updated hasValidatedDocument() to use flexible file pattern matching - Updated getValidatedPDFPath() with same flexible pattern - First tries exact pattern: CA3_[declaration_number]_*.pdf - Falls back to flexible pattern: CA3_*[declaration_number]*.pdf - Should now detect PDFs with complex filenames like CA3_CA3-2025-05-20251002184011_2025-10-06.pdf - Declaration list should now show green PDF icons for validated declarations
This commit is contained in:
parent
43ffed32bb
commit
b90d5e9199
@ -1270,6 +1270,12 @@ class DeclarationTVA
|
||||
$pattern = $month_dir . 'CA3_' . $obj->declaration_number . '_*.pdf';
|
||||
$files = glob($pattern);
|
||||
|
||||
// If no files found with the exact pattern, try a more flexible search
|
||||
if (empty($files)) {
|
||||
$pattern = $month_dir . 'CA3_*' . $obj->declaration_number . '*.pdf';
|
||||
$files = glob($pattern);
|
||||
}
|
||||
|
||||
return !empty($files) && file_exists($files[0]);
|
||||
}
|
||||
|
||||
@ -1306,6 +1312,12 @@ class DeclarationTVA
|
||||
$pattern = $month_dir . 'CA3_' . $obj->declaration_number . '_*.pdf';
|
||||
$files = glob($pattern);
|
||||
|
||||
// If no files found with the exact pattern, try a more flexible search
|
||||
if (empty($files)) {
|
||||
$pattern = $month_dir . 'CA3_*' . $obj->declaration_number . '*.pdf';
|
||||
$files = glob($pattern);
|
||||
}
|
||||
|
||||
if (!empty($files) && file_exists($files[0])) {
|
||||
return $files[0];
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user