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);