From 0027e1a8bab69def93a8fe18d96f126974d442f9 Mon Sep 17 00:00:00 2001 From: Bahfir Abbes Date: Thu, 24 Dec 2015 20:25:54 +0100 Subject: [PATCH] Include local constants files and fetch their values to the corresponding database constants Modules may declare their file constants in a file named as : "module name"_consts.php and located in the module root folder. They may also assign a correspondence between file constants they define and their equivalent database constants in a table named $file2bddconsts defined in their constants file. To get this two functions the module need to add its name to the list of modules in LOCAL_CONSTS_FILES. --- htdocs/core/class/conf.class.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 7adcd79d364..6f9363d8248 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -205,6 +205,16 @@ class Conf $db->free($resql); } + // Include local constants files and fetch their values to the corresponding database constants + if(! empty($this->global->LOCAL_CONSTS_FILES)) { + $filesList = explode(":", $this->global->LOCAL_CONSTS_FILES); + foreach ($filesList as $file) { + include_once DOL_DOCUMENT_ROOT . "/$file/{$file}_consts.php"; + foreach ($file2bddconsts as $key=>$value) { + $conf->global->$key=constant($value); + } + } + } //var_dump($this->modules); //var_dump($this->modules_parts['theme']);