diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php
index 0af202016df..7670e03d094 100644
--- a/htdocs/compta/paiement/rapport.php
+++ b/htdocs/compta/paiement/rapport.php
@@ -136,7 +136,6 @@ if ($year)
{
if (is_dir($dir.'/'.$year))
{
- $handle = opendir($dir.'/'.$year);
if ($found) print '
';
print '
';
@@ -147,22 +146,17 @@ if ($year)
print '
'.$langs->trans("Date").' | ';
print '';
- if (is_resource($handle))
- {
- while (($file = readdir($handle)) !== false)
- {
- if (preg_match('/^payment/i', $file))
- {
- $tfile = $dir.'/'.$year.'/'.$file;
- $relativepath = $year.'/'.$file;
- print '';
- print '| '.img_pdf().' '.$file.''.$formfile->showPreview($file, 'facture_paiement', $relativepath, 0).' | ';
- print ''.dol_print_size(dol_filesize($tfile)).' | ';
- print ''.dol_print_date(dol_filemtime($tfile), "dayhour").' | ';
- print '
';
- }
+ $files = (scandir($dir.'/'.$year));
+ foreach ($files as $f) {
+ $tfile = $dir.'/'.$year.'/'.$f;
+ $relativepath = $year.'/'.$f;
+ if (is_file($tfile)) {
+ print '';
+ print '| '.img_pdf().' '.$f.''.$formfile->showPreview($f, 'facture_paiement', $relativepath, 0).' | ';
+ print ''.dol_print_size(dol_filesize($tfile)).' | ';
+ print ''.dol_print_date(dol_filemtime($tfile), "dayhour").' | ';
+ print '
';
}
- closedir($handle);
}
print '';
}