diff --git a/htdocs/public/cron/cron_run_jobs.php b/htdocs/public/cron/cron_run_jobs.php
index 3ca058acb8af611e9a06a537b883711564835bc1..725aea8825debc814d212d3162c1539cddc4da63 100644
--- a/htdocs/public/cron/cron_run_jobs.php
+++ b/htdocs/public/cron/cron_run_jobs.php
@@ -1,7 +1,8 @@
 <?php
-/* Copyright (C) 2012      Nicolas Villa aka Boyquotes http://informetic.fr
- * Copyright (C) 2013      Florian Henry <forian.henry@open-cocnept.pro>
- * Copyright (C) 2013-2015 Laurent Destailleur <eldy@users.sourceforge.net>
+/* Copyright (C) 2012		Nicolas Villa aka Boyquotes http://informetic.fr
+ * Copyright (C) 2013		Florian Henry		<forian.henry@open-cocnept.pro>
+ * Copyright (C) 2013-2015	Laurent Destailleur	<eldy@users.sourceforge.net>
+ * Copyright (C) 2017		Regis Houssin		<regis.houssin@capnetworks.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -30,6 +31,11 @@ if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
 if (! defined('NOLOGIN'))   define('NOLOGIN','1');
 //if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN','1');
 
+// For MultiCompany module.
+// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
+$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
+if (is_numeric($entity)) define("DOLENTITY", $entity);
+
 // librarie core
 // Dolibarr environment
 $res = @include("../../main.inc.php"); // From htdocs directory