diff --git a/core/class/declarationtva.class.php b/core/class/declarationtva.class.php index 6dd1596..24a8868 100644 --- a/core/class/declarationtva.class.php +++ b/core/class/declarationtva.class.php @@ -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]; }