New: early development of multi-company module
This commit is contained in:
parent
94a5df6a2d
commit
8f1d865b91
@ -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)
|
||||
{
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user