diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 1ae6580d628..36a5c4e9620 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -769,16 +769,19 @@ else $heightforframes=48; // Switch to another entity -if (GETPOST('action') == 'switchentity' && $user->admin && ! $user->entity) +if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY)) { - require_once("../class/actions_multicompany.class.php"); - - $mc = new ActionsMulticompany($db); - - if($mc->switchEntity(GETPOST('entity_id')) > 0) + if (GETPOST('action') == 'switchentity' && $user->admin && ! $user->entity) { - Header("Location: ".DOL_URL_ROOT.'/'); - exit; + require_once("../class/actions_multicompany.class.php"); + + $mc = new ActionsMulticompany($db); + + if($mc->switchEntity(GETPOST('entity_id')) > 0) + { + Header("Location: ".DOL_URL_ROOT.'/'); + exit; + } } }