diff --git a/htdocs/core/conf.class.php b/htdocs/core/conf.class.php index 9184e2a5556..223df365100 100644 --- a/htdocs/core/conf.class.php +++ b/htdocs/core/conf.class.php @@ -65,8 +65,6 @@ class Conf */ function setValues($db) { - global $conf; - dol_syslog("Conf::setValues"); // Par defaut, a oui @@ -75,12 +73,10 @@ class Conf // Load entity cookie $entityCookieName = "DOLENTITYID_dolibarr"; if (!$_COOKIE[$entityCookieName]){ - $conf->entity = 1; + $this->entity = 1; }else{ - $conf->entity = $_COOKIE[$entityCookieName]; + $this->entity = $_COOKIE[$entityCookieName]; } - - //$conf->entity = $conf->entity ? $conf->entity : 1; /* * Definition de toutes les Constantes globales d'environnement @@ -88,7 +84,7 @@ class Conf * - En $this->global->key=value */ $sql = "SELECT name, value, entity FROM ".MAIN_DB_PREFIX."const "; - $sql.= " WHERE entity = ".$conf->entity; + $sql.= " WHERE entity = ".$this->entity; $result = $db->query($sql); if ($result) { diff --git a/htdocs/includes/modules/DolibarrModules.class.php b/htdocs/includes/modules/DolibarrModules.class.php index 493fdc9300a..b4de67b9a5d 100644 --- a/htdocs/includes/modules/DolibarrModules.class.php +++ b/htdocs/includes/modules/DolibarrModules.class.php @@ -389,18 +389,18 @@ class DolibarrModules */ function _active() { + global $conf; + $err = 0; - //TODO : define entity id - $entity = 1; $sql = "DELETE FROM ".MAIN_DB_PREFIX."const "; $sql.= "WHERE name = '".$this->const_name."' "; - $sql.= "AND entity = ".$entity; + $sql.= "AND entity = ".$conf->entity; dol_syslog("DolibarrModules::_active sql=".$sql, LOG_DEBUG); $this->db->query($sql); $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible,entity) VALUES"; - $sql.= " ('".$this->const_name."','1',0,".$entity.")"; + $sql.= " ('".$this->const_name."','1',0,".$conf->entity.")"; dol_syslog("DolibarrModules::_active sql=".$sql, LOG_DEBUG); if (!$this->db->query($sql)) { @@ -417,13 +417,13 @@ class DolibarrModules **/ function _unactive() { + global $conf; + $err = 0; - //TODO : define entity id - $entity = 1; $sql = "DELETE FROM ".MAIN_DB_PREFIX."const "; $sql.= "WHERE name = '".$this->const_name."'"; - $sql.= "AND entity = ".$entity; + $sql.= "AND entity = ".$conf->entity; dol_syslog("DolibarrModules::_unactive sql=".$sql); $this->db->query($sql);