diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php
index c71d1a7d26d..e6de71740ae 100644
--- a/htdocs/compta/paiement/rapport.php
+++ b/htdocs/compta/paiement/rapport.php
@@ -39,6 +39,7 @@ if (!$user->admin && $user->societe_id > 0)
$year = $_GET["year"];
+if (! $year) { $year=date("Y"); }
require("../../includes/modules/rapport/pdf_paiement.class.php");
@@ -63,9 +64,10 @@ llxHeader();
* Affichage liste des paiements
*
*/
-print_titre("Rapport paiements");
+print_titre("Rapport paiements".($year?" $year":""));
-print '
';
+
clearstatcache();
-$handle=opendir($dir);
-while (($file = readdir($handle))!==false)
-{
- if (is_dir($dir.$file) && substr($file, 0, 1) <> '.')
+if (is_dir($dir)) {
+ $handle=opendir($dir);
+ while (($file = readdir($handle))!==false)
{
- print ''.$file.' ';
+ if (is_dir($dir.$file) && substr($file, 0, 1) <> '.')
+ {
+ print ''.$file.' ';
+ }
}
}
if ($year)
{
- $handle=opendir($dir.'/'.$year);
- print '
';
- print '';
- print '| Rapport | '.$langs->trans("Size").' | '.$langs->trans("Date").' |
';
- $var=true;
- while (($file = readdir($handle))!==false)
- {
- if (substr($file, 0, 8) == 'paiement')
- {
- $var=!$var;
- $tfile = $dir . '/'.$year.'/'.$file;
- $relativepath = $year.'/'.$file;
- print "".'| '.img_pdf().' '.$file.' | ';
- print ''.filesize($tfile). ' bytes | ';
- print ''.strftime("%d %b %Y %H:%M:%S",filemtime($tfile)).' |
';
- }
+ if (is_dir($dir.'/'.$year)) {
+ $handle=opendir($dir.'/'.$year);
+ print '
';
+ print '';
+ print '| Rapport | '.$langs->trans("Size").' | '.$langs->trans("Date").' |
';
+ $var=true;
+ while (($file = readdir($handle))!==false)
+ {
+ if (substr($file, 0, 8) == 'paiement')
+ {
+ $var=!$var;
+ $tfile = $dir . '/'.$year.'/'.$file;
+ $relativepath = $year.'/'.$file;
+ print "".'| '.img_pdf().' '.$file.' | ';
+ print ''.filesize($tfile). ' bytes | ';
+ print ''.strftime("%d %b %Y %H:%M:%S",filemtime($tfile)).' |
';
+ }
+ }
+ print '
';
}
- print '
';
}
$db->close();