Add: can defined submodule name (ex: $conf->module->submodule->dir_output)
Add: can change the module name if different (ex: $conf->newmodulename->dir_output)
This commit is contained in:
parent
ff5b05c1cf
commit
ad8bed51ef
@ -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)
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user