From 255e1fdedf8d8577a6ab5ce96c847abdf4af37c4 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 1 Apr 2011 09:50:30 +0000 Subject: [PATCH] Fix: add function for switch to another entity --- htdocs/main.inc.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index b325197ca61..1ae6580d628 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -768,10 +768,23 @@ else $heightforframes=48; +// Switch to another entity +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 - /** * Show HTML header HTML + BODY + Top menu + left menu + DIV * @param head Add optionnal head lines