A protection to avoid situation loosing all admin accounts

This commit is contained in:
Laurent Destailleur 2016-01-22 11:54:14 +01:00
parent cbd01bae49
commit 50b0019ead

View File

@ -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');