Fix: If we exclude dirs, we must also clean array to avoid to count
them.
This commit is contained in:
parent
443f5ca03e
commit
a7e35a9308
@ -137,7 +137,7 @@ if (! dol_is_dir($upload_dir))
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<!-- TYPE='.$type.' -->'."\n";
|
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='';
|
||||||
$param.=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'');
|
$param.=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'');
|
||||||
@ -176,10 +176,8 @@ if ($type == 'directory')
|
|||||||
$relativepath='facture';
|
$relativepath='facture';
|
||||||
$upload_dir = $conf->fournisseur->dir_output.'/'.$relativepath;
|
$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);
|
$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;
|
$param.='&module='.$module;
|
||||||
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
|
$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);
|
$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
|
else if ($module == 'propal') // Auto area for customers orders
|
||||||
|
|||||||
@ -74,6 +74,7 @@ if ($modulepart == 'ecm')
|
|||||||
|
|
||||||
top_httphead();
|
top_httphead();
|
||||||
|
|
||||||
|
//print '<!-- selecteddir = '.$selecteddir.', openeddir = '.$openeddir.', modulepart='.$modulepart.' -->'."\n";
|
||||||
$userstatic=new User($db);
|
$userstatic=new User($db);
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
$ecmdirstatic = new EcmDirectory($db);
|
$ecmdirstatic = new EcmDirectory($db);
|
||||||
|
|||||||
@ -789,7 +789,7 @@ class FormFile
|
|||||||
$var=true;
|
$var=true;
|
||||||
foreach($filearray as $key => $file)
|
foreach($filearray as $key => $file)
|
||||||
{
|
{
|
||||||
if (!is_dir($file['name'])
|
if (!is_dir($file['name'])
|
||||||
&& $file['name'] != '.'
|
&& $file['name'] != '.'
|
||||||
&& $file['name'] != '..'
|
&& $file['name'] != '..'
|
||||||
&& $file['name'] != 'CVS'
|
&& $file['name'] != 'CVS'
|
||||||
@ -821,10 +821,10 @@ class FormFile
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//print 'Fetch '.$idorref.'<br>';
|
//print 'Fetch '.$id." - ".$ref.'<br>';
|
||||||
$result=$object_instance->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]=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
|
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";
|
print "</td></tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($filearray) == 0)
|
if (count($filearray) == 0)
|
||||||
{
|
{
|
||||||
print '<tr '.$bc[$var].'><td colspan="4">';
|
print '<tr '.$bc[$var].'><td colspan="4">';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user