From ce3b8e5cc8622b1b7a8573e75ca22a0096deef7d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 25 Apr 2013 15:49:27 +0200 Subject: [PATCH 1/2] Fix: broken features with multicompany --- htdocs/master.inc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 7212ea38f5b..3008884a59e 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -143,7 +143,10 @@ if (! defined('NOREQUIREDB')) { $conf->entity = DOLENTITY; } - // TODO Multicompany Remove this. + else if (!empty($_COOKIE['DOLENTITY'])) // For other application with MultiCompany module + { + $conf->entity = $_COOKIE['DOLENTITY']; + } else if (! empty($conf->multicompany->force_entity) && is_int($conf->multicompany->force_entity)) // To force entity in login page { $conf->entity = $conf->multicompany->force_entity; From 4f600b6465f0cb5e56612311c61730648e5864a1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 25 Apr 2013 15:52:33 +0200 Subject: [PATCH 2/2] Fix: use $conf->entity if defined --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index a756661e603..f4dd627c3b6 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -377,7 +377,7 @@ if (! defined('NOLOGIN')) $usertotest = (! empty($_COOKIE['login_dolibarr']) ? $_COOKIE['login_dolibarr'] : GETPOST("username","alpha",2)); $passwordtotest = (! empty($_COOKIE['password_dolibarr']) ? $_COOKIE['password_dolibarr'] : GETPOST('password')); - $entitytotest = (GETPOST('entity','int') ? GETPOST('entity','int') : 1); + $entitytotest = (GETPOST('entity','int') ? GETPOST('entity','int') : (!empty($conf->entity) ? $conf->entity : 1)); // Validation of login/pass/entity // If ok, the variable login will be returned