Fix: If we exclude dirs, we must also clean array to avoid to count

them.
This commit is contained in:
Laurent Destailleur 2012-10-27 20:02:09 +02:00
parent 443f5ca03e
commit a7e35a9308
3 changed files with 6 additions and 6 deletions

View File

@ -137,7 +137,7 @@ if (! dol_is_dir($upload_dir))
}
print '<!-- TYPE='.$type.' -->'."\n";
print '<!-- Page called with mode='.(isset($mode)?$mode:'').' url='.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
print '<!-- Page called with mode='.(isset($mode)?$mode:'').' type='.$type.' module='.$module.' url='.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\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

View File

@ -74,6 +74,7 @@ if ($modulepart == 'ecm')
top_httphead();
//print '<!-- selecteddir = '.$selecteddir.', openeddir = '.$openeddir.', modulepart='.$modulepart.' -->'."\n";
$userstatic=new User($db);
$form=new Form($db);
$ecmdirstatic = new EcmDirectory($db);

View File

@ -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.'<br>';
//print 'Fetch '.$id." - ".$ref.'<br>';
$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 "</td></tr>\n";
}
}
if (count($filearray) == 0)
{
print '<tr '.$bc[$var].'><td colspan="4">';