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)
|
function setValues($db)
|
||||||
{
|
{
|
||||||
global $conf;
|
|
||||||
|
|
||||||
dol_syslog("Conf::setValues");
|
dol_syslog("Conf::setValues");
|
||||||
|
|
||||||
// Par defaut, a oui
|
// Par defaut, a oui
|
||||||
@ -75,20 +73,18 @@ class Conf
|
|||||||
// Load entity cookie
|
// Load entity cookie
|
||||||
$entityCookieName = "DOLENTITYID_dolibarr";
|
$entityCookieName = "DOLENTITYID_dolibarr";
|
||||||
if (!$_COOKIE[$entityCookieName]){
|
if (!$_COOKIE[$entityCookieName]){
|
||||||
$conf->entity = 1;
|
$this->entity = 1;
|
||||||
}else{
|
}else{
|
||||||
$conf->entity = $_COOKIE[$entityCookieName];
|
$this->entity = $_COOKIE[$entityCookieName];
|
||||||
}
|
}
|
||||||
|
|
||||||
//$conf->entity = $conf->entity ? $conf->entity : 1;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Definition de toutes les Constantes globales d'environnement
|
* Definition de toutes les Constantes globales d'environnement
|
||||||
* - En constante php (TODO a virer)
|
* - En constante php (TODO a virer)
|
||||||
* - En $this->global->key=value
|
* - En $this->global->key=value
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT name, value, entity FROM ".MAIN_DB_PREFIX."const ";
|
$sql = "SELECT name, value, entity FROM ".MAIN_DB_PREFIX."const ";
|
||||||
$sql.= " WHERE entity = ".$conf->entity;
|
$sql.= " WHERE entity = ".$this->entity;
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -389,18 +389,18 @@ class DolibarrModules
|
|||||||
*/
|
*/
|
||||||
function _active()
|
function _active()
|
||||||
{
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
$err = 0;
|
$err = 0;
|
||||||
//TODO : define entity id
|
|
||||||
$entity = 1;
|
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const ";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const ";
|
||||||
$sql.= "WHERE name = '".$this->const_name."' ";
|
$sql.= "WHERE name = '".$this->const_name."' ";
|
||||||
$sql.= "AND entity = ".$entity;
|
$sql.= "AND entity = ".$conf->entity;
|
||||||
dol_syslog("DolibarrModules::_active sql=".$sql, LOG_DEBUG);
|
dol_syslog("DolibarrModules::_active sql=".$sql, LOG_DEBUG);
|
||||||
$this->db->query($sql);
|
$this->db->query($sql);
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible,entity) VALUES";
|
$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);
|
dol_syslog("DolibarrModules::_active sql=".$sql, LOG_DEBUG);
|
||||||
if (!$this->db->query($sql))
|
if (!$this->db->query($sql))
|
||||||
{
|
{
|
||||||
@ -417,13 +417,13 @@ class DolibarrModules
|
|||||||
**/
|
**/
|
||||||
function _unactive()
|
function _unactive()
|
||||||
{
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
$err = 0;
|
$err = 0;
|
||||||
//TODO : define entity id
|
|
||||||
$entity = 1;
|
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const ";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const ";
|
||||||
$sql.= "WHERE name = '".$this->const_name."'";
|
$sql.= "WHERE name = '".$this->const_name."'";
|
||||||
$sql.= "AND entity = ".$entity;
|
$sql.= "AND entity = ".$conf->entity;
|
||||||
dol_syslog("DolibarrModules::_unactive sql=".$sql);
|
dol_syslog("DolibarrModules::_unactive sql=".$sql);
|
||||||
$this->db->query($sql);
|
$this->db->query($sql);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user