diff --git a/scripts/user/sync_groups_ldap2dolibarr.php b/scripts/user/sync_groups_ldap2dolibarr.php index 9a91d90ede5..f70e3620879 100755 --- a/scripts/user/sync_groups_ldap2dolibarr.php +++ b/scripts/user/sync_groups_ldap2dolibarr.php @@ -142,9 +142,9 @@ if ($result >= 0) { foreach ($ldaprecords as $key => $ldapgroup) { $group = new UserGroup($db); $group->fetch('', $ldapgroup[getDolGlobalString('LDAP_KEY_GROUPS')]); - $group->name = $ldapgroup[getDolGlobalString('LDAP_GROUP_FIELD_FULLNAME')]; + $group->name = $ldapgroup[getDolGlobalString('LDAP_GROUP_FIELD_FULLNAME')] ?? null; $group->nom = $group->name; // For backward compatibility - $group->note = $ldapgroup[getDolGlobalString('LDAP_GROUP_FIELD_DESCRIPTION')]; + $group->note = $ldapgroup[getDolGlobalString('LDAP_GROUP_FIELD_DESCRIPTION')] ?? null; $group->entity = $conf->entity; // print_r($ldapgroup); diff --git a/scripts/user/sync_users_ldap2dolibarr.php b/scripts/user/sync_users_ldap2dolibarr.php index 40a88d6bad0..46d836ae28f 100755 --- a/scripts/user/sync_users_ldap2dolibarr.php +++ b/scripts/user/sync_users_ldap2dolibarr.php @@ -201,30 +201,30 @@ if ($result >= 0) { } // Propriete membre - $fuser->firstname = $ldapuser[getDolGlobalString('LDAP_FIELD_FIRSTNAME')]; - $fuser->lastname = $ldapuser[getDolGlobalString('LDAP_FIELD_NAME')]; - $fuser->login = $ldapuser[getDolGlobalString('LDAP_FIELD_LOGIN')]; - $fuser->pass = $ldapuser[getDolGlobalString('LDAP_FIELD_PASSWORD')]; - $fuser->pass_indatabase_crypted = $ldapuser[getDolGlobalString('LDAP_FIELD_PASSWORD_CRYPTED')]; + $fuser->firstname = $ldapuser[getDolGlobalString('LDAP_FIELD_FIRSTNAME')] ?? null; + $fuser->lastname = $ldapuser[getDolGlobalString('LDAP_FIELD_NAME')] ?? null; + $fuser->login = $ldapuser[getDolGlobalString('LDAP_FIELD_LOGIN')] ?? null; + $fuser->pass = $ldapuser[getDolGlobalString('LDAP_FIELD_PASSWORD')] ?? null; + $fuser->pass_indatabase_crypted = $ldapuser[getDolGlobalString('LDAP_FIELD_PASSWORD_CRYPTED')] ?? null; // $user->societe; /* - * $fuser->address=$ldapuser[getDolGlobalString('LDAP_FIELD_ADDRESS')]; - * $fuser->zip=$ldapuser[getDolGlobalString('LDAP_FIELD_ZIP')]; - * $fuser->town=$ldapuser[getDolGlobalString('LDAP_FIELD_TOWN')]; - * $fuser->country=$ldapuser[getDolGlobalString('LDAP_FIELD_COUNTRY')]; + * $fuser->address=$ldapuser[getDolGlobalString('LDAP_FIELD_ADDRESS')] ?? null; + * $fuser->zip=$ldapuser[getDolGlobalString('LDAP_FIELD_ZIP')] ?? null; + * $fuser->town=$ldapuser[getDolGlobalString('LDAP_FIELD_TOWN')] ?? null; + * $fuser->country=$ldapuser[getDolGlobalString('LDAP_FIELD_COUNTRY')] ?? null; * $fuser->country_id=$countries[$hashlib2rowid[strtolower($fuser->country)]]['rowid']; * $fuser->country_code=$countries[$hashlib2rowid[strtolower($fuser->country)]]['code']; */ - $fuser->office_phone = $ldapuser[getDolGlobalString('LDAP_FIELD_PHONE')]; - $fuser->user_mobile = $ldapuser[getDolGlobalString('LDAP_FIELD_MOBILE')]; - $fuser->office_fax = $ldapuser[getDolGlobalString('LDAP_FIELD_FAX')]; - $fuser->email = $ldapuser[getDolGlobalString('LDAP_FIELD_MAIL')]; - $fuser->ldap_sid = $ldapuser[getDolGlobalString('LDAP_FIELD_SID')]; + $fuser->office_phone = $ldapuser[getDolGlobalString('LDAP_FIELD_PHONE')] ?? null; + $fuser->user_mobile = $ldapuser[getDolGlobalString('LDAP_FIELD_MOBILE')] ?? null; + $fuser->office_fax = $ldapuser[getDolGlobalString('LDAP_FIELD_FAX')] ?? null; + $fuser->email = $ldapuser[getDolGlobalString('LDAP_FIELD_MAIL')] ?? null; + $fuser->ldap_sid = $ldapuser[getDolGlobalString('LDAP_FIELD_SID')] ?? null; - $fuser->job = $ldapuser[getDolGlobalString('LDAP_FIELD_TITLE')]; - $fuser->note = $ldapuser[getDolGlobalString('LDAP_FIELD_DESCRIPTION')]; + $fuser->job = $ldapuser[getDolGlobalString('LDAP_FIELD_TITLE')] ?? null; + $fuser->note = $ldapuser[getDolGlobalString('LDAP_FIELD_DESCRIPTION')] ?? null; $fuser->admin = 0; $fuser->socid = 0; $fuser->contact_id = 0; @@ -236,7 +236,7 @@ if ($result >= 0) { * if (isset($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_STATUS')])) { * $fuser->datec=dol_stringtotime($ldapuser[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE]); * $fuser->datevalid=dol_stringtotime($ldapuser[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE]); - * $fuser->statut=$ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_STATUS')]; + * $fuser->statut=$ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_STATUS')] ?? null; * } */ // if ($fuser->statut > 1) $fuser->statut=1;