diff --git a/htdocs/core/conf.class.php b/htdocs/core/conf.class.php index 21c39a04d72..90d10e5442d 100644 --- a/htdocs/core/conf.class.php +++ b/htdocs/core/conf.class.php @@ -106,11 +106,21 @@ class Conf //print 'xxx'.$params[0].'-'.$value; } // If this is constant for module directories - if (eregi('^MAIN_MODULE_([A-Z_]+)_DIR_([A-Z_]+)$',$key,$reg) && $value) + if (eregi('^MAIN_MODULE_([A-Z_]+)_DIR_',$key,$reg) && $value) { $module=strtolower($reg[1]); - $dir_name="dir_".strtolower($reg[2]); - $this->$module->$dir_name = $value; // We put only dir name. We will add DOL_DATA_ROOT later + // If with submodule name + if (eregi('_DIR_([A-Z_]+)?_([A-Z]+)$',$key,$reg)) + { + $dir_name = "dir_".strtolower($reg[2]); + $submodule = strtolower($reg[1]); + $this->$module->$submodule->$dir_name = $value; + } + else if (eregi('_DIR_([A-Z]+)$',$key,$reg)) + { + $dir_name = "dir_".strtolower($reg[1]); + $this->$module->$dir_name = $value; // We put only dir name. We will add DOL_DATA_ROOT later + } } // If this is a module constant if (eregi('^MAIN_MODULE_([A-Z]+)$',$key,$reg) && $value) diff --git a/htdocs/includes/modules/DolibarrModules.class.php b/htdocs/includes/modules/DolibarrModules.class.php index 1fa81f39c52..abcb47f8851 100644 --- a/htdocs/includes/modules/DolibarrModules.class.php +++ b/htdocs/includes/modules/DolibarrModules.class.php @@ -968,9 +968,17 @@ class DolibarrModules { foreach ($this->dirs as $key => $value) { - $name = $this->const_name."_DIR_".strtoupper($this->dirs[$key][0]); - $dir = $this->dirs[$key][1]; - $const = empty($this->dirs[$key][2])?'':$this->dirs[$key][2]; + $constname = $this->const_name."_DIR_"; + $dir = $this->dirs[$key][1]; + $const = empty($this->dirs[$key][2])?'':$this->dirs[$key][2]; // Create constante in llx_const + $subname = empty($this->dirs[$key][3])?'':strtoupper($this->dirs[$key][3]); // Add submodule name (ex: $conf->module->submodule->dir_output) + $forcename = empty($this->dirs[$key][4])?'':strtoupper($this->dirs[$key][4]); // Change the module name if different + + if ($forcename) $constname = $forcename."_DIR_"; + if ($subname) $constname = $constname.$subname."_"; + + $name = $constname.strtoupper($this->dirs[$key][0]); + // Define directory full path if (empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $fulldir = DOL_DATA_ROOT.$dir; diff --git a/htdocs/includes/modules/modFournisseur.class.php b/htdocs/includes/modules/modFournisseur.class.php index 6ad8e2af2de..1d68c0993f9 100644 --- a/htdocs/includes/modules/modFournisseur.class.php +++ b/htdocs/includes/modules/modFournisseur.class.php @@ -72,20 +72,28 @@ class modFournisseur extends DolibarrModules $this->dirs[$r][1] = "/fournisseur/temp"; $r++; - $this->dirs[$r][0] = "commande"; + $this->dirs[$r][0] = "output"; $this->dirs[$r][1] = "/fournisseur/commande"; + $this->dirs[$r][2] = 1; + $this->dirs[$r][3] = "commande"; $r++; - $this->dirs[$r][0] = "commande_temp"; + $this->dirs[$r][0] = "temp"; $this->dirs[$r][1] = "/fournisseur/commande/temp"; + $this->dirs[$r][2] = 1; + $this->dirs[$r][3] = "commande"; $r++; - $this->dirs[$r][0] = "facture"; + $this->dirs[$r][0] = "output"; $this->dirs[$r][1] = "/fournisseur/facture"; + $this->dirs[$r][2] = 1; + $this->dirs[$r][3] = "facture"; $r++; - $this->dirs[$r][0] = "commande_temp"; + $this->dirs[$r][0] = "temp"; $this->dirs[$r][1] = "/fournisseur/facture/temp"; + $this->dirs[$r][2] = 1; + $this->dirs[$r][3] = "facture"; // Dependances