diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php
index 7212ea38f5bbb907ebf3506097d920b699752045..3008884a59e2e2245aecf8737f5daa6714cb2b7f 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;