FIX Bad link in ECM

This commit is contained in:
Laurent Destailleur 2017-08-04 13:45:20 +02:00
parent c107a77722
commit 5b7c144f95

View File

@ -835,9 +835,9 @@ class FormFile
$out=''; $out='';
$this->infofiles=array('nboffiles'=>0,'extensions'=>array(),'files'=>array()); $this->infofiles=array('nboffiles'=>0,'extensions'=>array(),'files'=>array());
//if (! empty($conf->dol_use_jmobile)) return ''; $filterforfilesearch = preg_quote(basename($modulesubdir),'/').'[^\-]+';
$file_list=dol_dir_list($filedir, 'files', 0, preg_quote(basename($modulesubdir),'/').'[^\-]+', '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files) $file_list=dol_dir_list($filedir, 'files', 0, $filterforfilesearch, '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files)
// For ajax treatment // For ajax treatment
$out.= '<!-- html.formfile::getDocumentsLink -->'."\n"; $out.= '<!-- html.formfile::getDocumentsLink -->'."\n";
@ -1488,20 +1488,23 @@ class FormFile
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
print '<!-- Line list_of_autoecmfiles '.$key.' -->'."\n"; print '<!-- Line list_of_autoecmfiles '.$key.' -->'."\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
if ($found > 0 && is_object($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) print $this->cache_objects[$modulepart.'_'.$id.'_'.$ref]->getNomUrl(1,'document'); if ($found > 0 && is_object($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) print $this->cache_objects[$modulepart.'_'.$id.'_'.$ref]->getNomUrl(1,'document');
else print $langs->trans("ObjectDeleted",($id?$id:$ref)); else print $langs->trans("ObjectDeleted",($id?$id:$ref));
$filename=dol_sanitizeFileName($ref); //$modulesubdir=dol_sanitizeFileName($ref);
$modulesubdir=dirname($relativefile);
//$filedir=$conf->$modulepart->dir_output . '/' . dol_sanitizeFileName($obj->ref); //$filedir=$conf->$modulepart->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$filedir=$file['path']; $filedir=$file['path'];
//$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; //$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
//print $formfile->getDocumentsLink($modulepart, $filename, $filedir); //print $formfile->getDocumentsLink($modulepart, $filename, $filedir);
print '</td>'; print '</td>';
// File
print '<td>'; print '<td>';
//print "XX".$file['name']; //$file['name'] must be utf8 //print "XX".$file['name']; //$file['name'] must be utf8
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart; print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
@ -1511,7 +1514,7 @@ class FormFile
print dol_trunc($file['name'],$maxlength,'middle'); print dol_trunc($file['name'],$maxlength,'middle');
print '</a>'; print '</a>';
print $this->getDocumentsLink($modulepart, $filename, $filedir); print $this->getDocumentsLink($modulepart, $modulesubdir, $filedir, '^'.preg_quote($file['name'],'/').'$');
print "</td>\n"; print "</td>\n";
print '<td align="right">'.dol_print_size($file['size'],1,1).'</td>'; print '<td align="right">'.dol_print_size($file['size'],1,1).'</td>';