From 50b0019ead204107919fec379b2dbf45c7aedea2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Jan 2016 11:54:14 +0100 Subject: [PATCH] A protection to avoid situation loosing all admin accounts --- htdocs/user/class/user.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 4459dfc3fc0..0a03e47fca4 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');