diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 4459dfc3fc01207319b0850ff762ce0304630cce..0a03e47fca44df4a8a075db05d58a89e852249c4 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -262,6 +262,10 @@ class User extends CommonObject $this->fk_member = $obj->fk_member; $this->fk_user = $obj->fk_user; + // Protection when module multicompany was set, admin was set to first entity and the module disabled, + // then this admin user must be admin for all entities. + if (empty($conf->multicompany->enabled) && $this->admin && $this->entity == 1) $this->entity = 0; + // Retreive all extrafield for thirdparty // fetch optionals attributes and labels require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');