Skip to content

Commit

Permalink
Undefined stdClass property warnings fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir D committed Oct 9, 2024
1 parent 8c74ff6 commit a885cce
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions scripts/user/sync_groups_ldap2dolibarr.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
34 changes: 17 additions & 17 deletions scripts/user/sync_users_ldap2dolibarr.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit a885cce

Please sign in to comment.