From a7e35a930814e8cc6bfb9c095e6d27035f44881b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Oct 2012 20:02:09 +0200 Subject: [PATCH] Fix: If we exclude dirs, we must also clean array to avoid to count them. --- htdocs/core/ajax/ajaxdirpreview.php | 4 +--- htdocs/core/ajax/ajaxdirtree.php | 1 + htdocs/core/class/html.formfile.class.php | 7 ++++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 11e42602f03..37f54fb780a 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -137,7 +137,7 @@ if (! dol_is_dir($upload_dir)) } print ''."\n"; -print ''."\n"; +print ''."\n"; $param=''; $param.=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:''); @@ -176,10 +176,8 @@ if ($type == 'directory') $relativepath='facture'; $upload_dir = $conf->fournisseur->dir_output.'/'.$relativepath; $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); - $param.='&module='.$module; $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound"))); - $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url); } else if ($module == 'propal') // Auto area for customers orders diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index 012da1f25a6..4ca70302e0a 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -74,6 +74,7 @@ if ($modulepart == 'ecm') top_httphead(); +//print ''."\n"; $userstatic=new User($db); $form=new Form($db); $ecmdirstatic = new EcmDirectory($db); diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index b67e05defc7..f9eb554a945 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -789,7 +789,7 @@ class FormFile $var=true; foreach($filearray as $key => $file) { - if (!is_dir($file['name']) + if (!is_dir($file['name']) && $file['name'] != '.' && $file['name'] != '..' && $file['name'] != 'CVS' @@ -821,10 +821,10 @@ class FormFile } else { - //print 'Fetch '.$idorref.'
'; + //print 'Fetch '.$id." - ".$ref.'
'; $result=$object_instance->fetch($id,$ref); if ($result > 0) { $found=1; $this->cache_objects[$modulepart.'_'.$id.'_'.$ref]=dol_clone($object_instance); } // Save object into a cache - if ($result == 0) { $found=1; $this->cache_objects[$modulepart.'_'.$id.'_'.$ref]='notfound'; } + if ($result == 0) { $found=1; $this->cache_objects[$modulepart.'_'.$id.'_'.$ref]='notfound'; unset($filearray[$key]); } } if (! $found > 0 || ! is_object($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) continue; // We do not show orphelins files @@ -856,6 +856,7 @@ class FormFile print "\n"; } } + if (count($filearray) == 0) { print '';