diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 27a1ac03af4..a29b4d53ddf 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -774,7 +774,7 @@ class FormFile print ''; print ''; $sortref="fullname"; - if ($modulepart == 'invoice_supplier') $sortref=''; // No sort for supplier invoices as path name is not + if ($modulepart == 'invoice_supplier') $sortref='level1name'; print_liste_field_titre($langs->trans("Ref"),$url,$sortref,"",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Size"),$url,"size","",$param,'align="right"',$sortfield,$sortorder); diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index e76705a1690..3e726a67c60 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -135,8 +135,11 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil if (! $filter || preg_match('/'.$filter.'/i',$file)) // We do not search key $filter into $path, only into $file { + preg_match('/([^\/]+)\/[^\/]+$/',$path.'/'.$file,$reg); + $level1name=(isset($reg[1])?$reg[1]:''); $file_list[] = array( "name" => $file, + "level1name" => $level1name, "fullname" => $path.'/'.$file, "date" => $filedate, "size" => $filesize, @@ -159,8 +162,11 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil if (! $filter || preg_match('/'.$filter.'/i',$file)) // We do not search key $filter into $path, only into $file { + preg_match('/([^\/]+)\/[^\/]+$/',$path.'/'.$file,$reg); + $level1name=(isset($reg[1])?$reg[1]:''); $file_list[] = array( "name" => $file, + "level1name" => $level1name, "fullname" => $path.'/'.$file, "date" => $filedate, "size" => $filesize,