From ed96de8f8b432cff81acb06fbfd2b08ccfd14620 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Dec 2011 00:24:26 +0100 Subject: [PATCH] Fix: Sort files on name --- htdocs/imports/import.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 06d0e588628..bc9cc5b8da4 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -512,17 +512,17 @@ if ($step == 3 && $datatoimport) print "\n"; // Search available imports - $dir = $conf->import->dir_temp; - $handle=@opendir(dol_osencode($dir)); - if (is_resource($handle)) + $filearray=dol_dir_list($conf->import->dir_temp,'files',0,'','','name',SORT_DESC); + if (count($filearray) > 0) { - //print ''; - //print ''; + $dir=$conf->import->dir_temp; // Search available files to import $i=0; - while (($file = readdir($handle))!==false) + foreach ($filearray as $key => $val) { + $file=$val['name']; + // readdir return value in ISO and we want UTF8 in memory if (! utf8_check($file)) $file=utf8_encode($file); @@ -555,7 +555,6 @@ if ($step == 3 && $datatoimport) print ''; print ''; } - //print '
'; } print '';