From 2f72bbca5ab19a6e39700207f18f50a7b2efda60 Mon Sep 17 00:00:00 2001
From: Regis Houssin <regis.houssin@capnetworks.com>
Date: Thu, 25 Apr 2013 15:47:41 +0200
Subject: [PATCH] Fix: broken features with multicompany

---
 htdocs/master.inc.php | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php
index 0dc12c468c8..01e112652b8 100644
--- a/htdocs/master.inc.php
+++ b/htdocs/master.inc.php
@@ -141,6 +141,10 @@ if (! defined('NOREQUIREDB'))
 	{
 		$conf->entity = DOLENTITY;
 	}
+	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;
-- 
GitLab