diff --git a/scripts/user/sync_groups_ldap2dolibarr.php b/scripts/user/sync_groups_ldap2dolibarr.php old mode 100755 new mode 100644 index 959facd625a1e..acd9b804a892c --- a/scripts/user/sync_groups_ldap2dolibarr.php +++ b/scripts/user/sync_groups_ldap2dolibarr.php @@ -143,9 +143,9 @@ 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 old mode 100755 new mode 100644 index 3112669087947..b8afd7af582e1 --- a/scripts/user/sync_users_ldap2dolibarr.php +++ b/scripts/user/sync_users_ldap2dolibarr.php @@ -202,30 +202,30 @@ } // 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; @@ -237,7 +237,7 @@ * 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;