From bf36f008977eccb183d69efbf6be11dbc4fae975 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Mar 2018 17:48:58 +0100 Subject: [PATCH] Update html.formfile.class.php --- htdocs/core/class/html.formfile.class.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index b7b94e7e644..bd9571fee3b 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -851,9 +851,16 @@ class FormFile $this->infofiles=array('nboffiles'=>0,'extensions'=>array(),'files'=>array()); // Get object entity - preg_match('/\/([0-9]+)\/[^\/]+\/'.preg_quote($modulesubdir).'$/', $filedir, $regs); - $entity = ((! empty($regs[1]) && $regs[1] > 1) ? $regs[1] : $conf->entity); - + if (empty($conf->multicompany->enabled)) + { + $entity = $conf->entity; + } + else + { + preg_match('/\/([0-9]+)\/[^\/]+\/'.preg_quote($modulesubdir).'$/', $filedir, $regs); + $entity = ((! empty($regs[1]) && $regs[1] > 1) ? $regs[1] : $conf->entity); + } + $filterforfilesearch = preg_quote(basename($modulesubdir),'/').'[^\-]+'; $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)