From dd5023c433d4b080f5739d9c9f1bd2253c1075ad Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 29 Apr 2009 19:51:07 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20on=20r=E9cup=E8re=20les=20constantes=20d?= =?UTF-8?q?e=20r=E9pertoires=20cr=E9=E9=20=E0=20partir=20de=20l'activation?= =?UTF-8?q?=20des=20modules=20Fix:=20les=20r=E9pertoiresde=20documents=20d?= =?UTF-8?q?es=20entit=E9es=20seront=20dans=20:=20/documents/1/=20pour=20l'?= =?UTF-8?q?entit=E9=201=20/documents/2/=20pour=20l'entit=E9=202=20etc..?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/core/conf.class.php | 18 +++++++++++++++--- .../includes/modules/DolibarrModules.class.php | 2 +- htdocs/lib/functions.lib.php | 5 +++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/htdocs/core/conf.class.php b/htdocs/core/conf.class.php index b4654a74862..51557965a23 100644 --- a/htdocs/core/conf.class.php +++ b/htdocs/core/conf.class.php @@ -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; diff --git a/htdocs/includes/modules/DolibarrModules.class.php b/htdocs/includes/modules/DolibarrModules.class.php index 430d9dfb402..b3c69f927d2 100644 --- a/htdocs/includes/modules/DolibarrModules.class.php +++ b/htdocs/includes/modules/DolibarrModules.class.php @@ -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)) { diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 4e180fc19a2..b8f49649818 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -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+");