From 0cfb959d3dbddd09760c3f88344b87dbb3dfb350 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 18 Apr 2011 17:31:10 +0000 Subject: [PATCH] Fix: verify if multicompany is enabled and entity is active --- htdocs/core/class/conf.class.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 2e85b519308..f7c569a783b 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -112,6 +112,7 @@ class Conf if ($result) { $numr = $db->num_rows($result); + $multicompany_sharing=array(); $i = 0; while ($i < $numr) @@ -187,15 +188,26 @@ class Conf // Sharings between entities else if ($value && preg_match('/^MULTICOMPANY_([A-Z_]+)_SHARING$/',$key,$reg)) { - dol_include_once('/multicompany/class/actions_multicompany.class.php'); - $mc = new ActionsMulticompany($db); $module=strtolower($reg[1]); - $mc->getEntitySharing($module); - $this->entities[$module]=$mc->entities; + $multicompany_sharing[$module]=$value; } } $i++; } + + $i = 0; + + // Sharings between entities + if ($this->multicompany->enabled) + { + dol_include_once('/multicompany/class/actions_multicompany.class.php'); + $mc = new ActionsMulticompany($db); + + foreach($multicompany_sharing as $key => $value) + { + $this->entities[$key]=$mc->check_entity($value); + } + } } $db->free($result); //var_dump($this->modules);