Fix: on rcupre les constantes de rpertoires cr partir de l'activation des modules

Fix: les rpertoiresde documents des entites 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,9 +66,15 @@ class Conf
*/
function setValues($db)
{
global $conf;
dol_syslog("Conf::setValues");
$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
@ -104,6 +110,13 @@ class Conf
$this->tabs_modules[$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 (eregi('^MAIN_MODULE_([A-Z]+)$',$key,$reg) && $value)
{
@ -139,9 +152,8 @@ class Conf
// Load translation object with current language
if (empty($this->global->MAIN_LANG_DEFAULT)) $this->global->MAIN_LANG_DEFAULT="en_US";
$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;
// Other global parameters
$this->users->dir_output=$rootfordata."/users";
// For backward compatibility
$this->comptaexpert->enabled=defined("MAIN_MODULE_COMPTABILITE_EXPERT")?MAIN_MODULE_COMPTABILITE_EXPERT:0;

View File

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

View File

@ -185,6 +185,11 @@ function dol_syslog($message, $level=LOG_INFO)
{
$filelog=SYSLOG_FILE;
$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+");
else $file=fopen($filelog,"a+");