From 6c2b1f5244a066f8b37436931942e5eb60d5f44a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 1 Apr 2011 09:54:49 +0000 Subject: [PATCH] Fix: add function for switch to another entity --- htdocs/main.inc.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 03e7aabb78b45..1719e8c55f082 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -752,6 +752,23 @@ function analyse_sql_and_script(&$var,$get) $heightforframes=48; +// Switch to another entity +if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY)) +{ + if (GETPOST('action') == 'switchentity' && $user->admin && ! $user->entity) + { + require_once("../class/actions_multicompany.class.php"); + + $mc = new ActionsMulticompany($db); + + if($mc->switchEntity(GETPOST('entity_id')) > 0) + { + Header("Location: ".DOL_URL_ROOT.'/'); + exit; + } + } +} + // Functions