Fix: on récupère les constantes de répertoires créé à partir de l'activation des modules

Fix: les répertoiresde documents des entitées seront dans :
/documents/1/ pour l'entité 1
/documents/2/ pour l'entité 2
etc..
This commit is contained in:
Regis Houssin 2009-04-29 19:51:07 +00:00
parent 5a2542d711
commit dd5023c433
3 changed files with 21 additions and 4 deletions

View File

@ -66,10 +66,16 @@ class Conf
*/ */
function setValues($db) function setValues($db)
{ {
global $conf;
dol_syslog("Conf::setValues"); dol_syslog("Conf::setValues");
$this->global->PRODUIT_CONFIRM_DELETE_LINE=1; // Par defaut, a oui $this->global->PRODUIT_CONFIRM_DELETE_LINE=1; // Par defaut, a oui
$rootfordata = DOL_DATA_ROOT;
// If multicompany module is enabled, we redefine the root of data
if (! empty($conf->multicompany) && ! empty($conf->entity)) $rootfordata.='/'.$conf->entity;
/* /*
* Definition de toutes les Constantes globales d'environnement * Definition de toutes les Constantes globales d'environnement
* - En constante php (TODO a virer) * - En constante php (TODO a virer)
@ -103,6 +109,13 @@ class Conf
$params=split(':',$value,2); $params=split(':',$value,2);
$this->tabs_modules[$params[0]][]=$value; $this->tabs_modules[$params[0]][]=$value;
//print 'xxx'.$params[0].'-'.$value; //print 'xxx'.$params[0].'-'.$value;
}
// If this is constant for module directories
if (eregi('^MAIN_MODULE_([A-Z_]+)_DIR_([A-Z_]+)$',$key,$reg) && $value)
{
$module=strtolower($reg[1]);
$dir_name="dir_".strtolower($reg[2]);
$this->$module->$dir_name = $rootfordata.$this->entity.$value;
} }
// If this is a module constant // If this is a module constant
if (eregi('^MAIN_MODULE_([A-Z]+)$',$key,$reg) && $value) if (eregi('^MAIN_MODULE_([A-Z]+)$',$key,$reg) && $value)
@ -139,9 +152,8 @@ class Conf
// Load translation object with current language // Load translation object with current language
if (empty($this->global->MAIN_LANG_DEFAULT)) $this->global->MAIN_LANG_DEFAULT="en_US"; if (empty($this->global->MAIN_LANG_DEFAULT)) $this->global->MAIN_LANG_DEFAULT="en_US";
$rootfordata = DOL_DATA_ROOT; // Other global parameters
// If multicompany module is enabled, we redefine the root of data $this->users->dir_output=$rootfordata."/users";
if (! empty($conf->multicompany) && ! empty($conf->entity)) $rootfordata.='/'.$conf->entity;
// For backward compatibility // For backward compatibility
$this->comptaexpert->enabled=defined("MAIN_MODULE_COMPTABILITE_EXPERT")?MAIN_MODULE_COMPTABILITE_EXPERT:0; $this->comptaexpert->enabled=defined("MAIN_MODULE_COMPTABILITE_EXPERT")?MAIN_MODULE_COMPTABILITE_EXPERT:0;

View File

@ -992,7 +992,7 @@ class DolibarrModules
if ($resql) if ($resql)
{ {
// On defini l'entite // On defini l'entite
$dir = DOL_DATA_ROOT."/entity_".$conf->entity.$dir; $dir = DOL_DATA_ROOT."/".$conf->entity.$dir;
if ($dir && ! file_exists($dir)) if ($dir && ! file_exists($dir))
{ {

View File

@ -185,6 +185,11 @@ function dol_syslog($message, $level=LOG_INFO)
{ {
$filelog=SYSLOG_FILE; $filelog=SYSLOG_FILE;
$filelog=eregi_replace('DOL_DATA_ROOT',DOL_DATA_ROOT,$filelog); $filelog=eregi_replace('DOL_DATA_ROOT',DOL_DATA_ROOT,$filelog);
// Check if syslog module use the default path
if (!eregi('(^[A-Za-z0-9_\-\\/:]+[\\/]+)([A-Za-z0-9_\-]+[.]?[A-Za-z0-9]+)?$', SYSLOG_FILE) && $conf->syslog->dir_output)
{
$filelog = $conf->syslog->dir_output."/".$filelog;
}
if (defined("SYSLOG_FILE_NO_ERROR")) $file=@fopen($filelog,"a+"); if (defined("SYSLOG_FILE_NO_ERROR")) $file=@fopen($filelog,"a+");
else $file=fopen($filelog,"a+"); else $file=fopen($filelog,"a+");