Fix show table of pdf payments repports in file order
Use scandir() rather opendir() and readdir() to get a sorted list of files.
This commit is contained in:
parent
5348f13a60
commit
9727768192
@ -136,7 +136,6 @@ if ($year)
|
|||||||
{
|
{
|
||||||
if (is_dir($dir.'/'.$year))
|
if (is_dir($dir.'/'.$year))
|
||||||
{
|
{
|
||||||
$handle = opendir($dir.'/'.$year);
|
|
||||||
|
|
||||||
if ($found) print '<br>';
|
if ($found) print '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -147,22 +146,17 @@ if ($year)
|
|||||||
print '<td class="right">'.$langs->trans("Date").'</td>';
|
print '<td class="right">'.$langs->trans("Date").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
if (is_resource($handle))
|
$files = (scandir($dir.'/'.$year));
|
||||||
{
|
foreach ($files as $f) {
|
||||||
while (($file = readdir($handle)) !== false)
|
$tfile = $dir.'/'.$year.'/'.$f;
|
||||||
{
|
$relativepath = $year.'/'.$f;
|
||||||
if (preg_match('/^payment/i', $file))
|
if (is_file($tfile)) {
|
||||||
{
|
print '<tr class="oddeven">';
|
||||||
$tfile = $dir.'/'.$year.'/'.$file;
|
print '<td><a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart=facture_paiement&file='.urlencode($relativepath).'">'.img_pdf().' '.$f.'</a>'.$formfile->showPreview($f, 'facture_paiement', $relativepath, 0).'</td>';
|
||||||
$relativepath = $year.'/'.$file;
|
print '<td class="right">'.dol_print_size(dol_filesize($tfile)).'</td>';
|
||||||
print '<tr class="oddeven">';
|
print '<td class="right">'.dol_print_date(dol_filemtime($tfile), "dayhour").'</td>';
|
||||||
print '<td><a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart=facture_paiement&file='.urlencode($relativepath).'">'.img_pdf().' '.$file.'</a>'.$formfile->showPreview($file, 'facture_paiement', $relativepath, 0).'</td>';
|
print '</tr>';
|
||||||
print '<td class="right">'.dol_print_size(dol_filesize($tfile)).'</td>';
|
|
||||||
print '<td class="right">'.dol_print_date(dol_filemtime($tfile), "dayhour").'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
closedir($handle);
|
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user