diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 61c6ff3b310..71a23cac044 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1674,7 +1674,8 @@ class FormFile dol_include_once($hookmanager->resArray['classpath']); if (array_key_exists('classname', $hookmanager->resArray) && !empty($hookmanager->resArray['classname'])) { if (class_exists($hookmanager->resArray['classname'])) { - $object_instance = new ${$hookmanager->resArray['classname']}($this->db); + $tmpclassname = $hookmanager->resArray['classname']; + $object_instance = new $tmpclassname($this->db); } } } @@ -1813,9 +1814,11 @@ class FormFile print ''; // File + // Check if document source has external module part, if it the case use it for module part on document.php + preg_match('/^[^@]*@([^@]*)$/', $modulepart.'@expertisemedical', $modulesuffix); print ''; //print "XX".$file['name']; //$file['name'] must be utf8 - print 'getDocumentsLink($modulepart, $modulesubdir, $filedir, '^'.preg_quote($file['name'],'/').'$'); - print $this->showPreview($file, $modulepart, $file['relativename']); + print $this->showPreview($file, (empty($modulesuffix) ? $modulepart : $modulesuffix[1]), $file['relativename']); print "\n";