diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 7f5c2887e8b..b2bb2a5f8fa 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -449,6 +449,15 @@ class FormFile
$titletoshow = ($title == 'none' ? '' : $title);
}
+ $submodulepart = $modulepart;
+
+ // modulepart = 'nameofmodule' or 'nameofmodule:NameOfObject'
+ $tmp = explode(':', $modulepart);
+ if (!empty($tmp[1])) {
+ $modulepart = $tmp[0];
+ $submodulepart = $tmp[1];
+ }
+
// Show table
if ($genallowed) {
$modellist = array();
@@ -648,15 +657,6 @@ class FormFile
$modellist = ModelePDFUserGroup::liste_modeles($this->db);
}
} else {
- $submodulepart = $modulepart;
-
- // modulepart = 'nameofmodule' or 'nameofmodule:NameOfObject'
- $tmp = explode(':', $modulepart);
- if (!empty($tmp[1])) {
- $modulepart = $tmp[0];
- $submodulepart = $tmp[1];
- }
-
// For normalized standard modules
$file = dol_buildpath('/core/modules/'.$modulepart.'/modules_'.strtolower($submodulepart).'.php', 0);
if (file_exists($file)) {