Merge pull request #15354 from frederic34/patch-14
Update adherent.class.php
This commit is contained in:
commit
bf8de86091
@ -2404,6 +2404,7 @@ class Adherent extends CommonObject
|
|||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$info = array();
|
$info = array();
|
||||||
|
$socialnetworks = getArrayOfSocialNetworks();
|
||||||
$keymodified = false;
|
$keymodified = false;
|
||||||
|
|
||||||
// Object classes
|
// Object classes
|
||||||
@ -2418,8 +2419,13 @@ class Adherent extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Possible LDAP KEY (constname => varname)
|
// Possible LDAP KEY (constname => varname)
|
||||||
$ldapkey = array('LDAP_MEMBER_FIELD_FULLNAME' => 'fullname', 'LDAP_MEMBER_FIELD_NAME' => 'lastname', 'LDAP_MEMBER_FIELD_LOGIN' => 'login', 'LDAP_MEMBER_FIELD_LOGIN_SAMBA' => 'login',
|
$ldapkey = array(
|
||||||
'LDAP_MEMBER_FIELD_MAIL' => 'email');
|
'LDAP_MEMBER_FIELD_FULLNAME' => 'fullname',
|
||||||
|
'LDAP_MEMBER_FIELD_NAME' => 'lastname',
|
||||||
|
'LDAP_MEMBER_FIELD_LOGIN' => 'login',
|
||||||
|
'LDAP_MEMBER_FIELD_LOGIN_SAMBA' => 'login',
|
||||||
|
'LDAP_MEMBER_FIELD_MAIL' => 'email'
|
||||||
|
);
|
||||||
|
|
||||||
// Member
|
// Member
|
||||||
foreach ($ldapkey as $constname => $varname) {
|
foreach ($ldapkey as $constname => $varname) {
|
||||||
@ -2439,10 +2445,11 @@ class Adherent extends CommonObject
|
|||||||
if ($this->zip && !empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip;
|
if ($this->zip && !empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip;
|
||||||
if ($this->town && !empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town;
|
if ($this->town && !empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town;
|
||||||
if ($this->country_code && !empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code;
|
if ($this->country_code && !empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code;
|
||||||
if ($this->skype && !empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype;
|
foreach ($socialnetworks as $key => $value) {
|
||||||
if ($this->twitter && !empty($conf->global->LDAP_MEMBER_FIELD_TWITTER)) $info[$conf->global->LDAP_MEMBER_FIELD_TWITTER] = $this->twitter;
|
if ($this->socialnetworks[$value['label']] && !empty($conf->global->{'LDAP_MEMBER_FIELD_'.strtoupper($value['label'])})) {
|
||||||
if ($this->facebook && !empty($conf->global->LDAP_MEMBER_FIELD_FACEBOOK)) $info[$conf->global->LDAP_MEMBER_FIELD_FACEBOOK] = $this->facebook;
|
$info[$conf->global->{'LDAP_MEMBER_FIELD_'.strtoupper($value['label'])}] = $this->socialnetworks[$value['label']];
|
||||||
if ($this->linkedin && !empty($conf->global->LDAP_MEMBER_FIELD_LINKEDIN)) $info[$conf->global->LDAP_MEMBER_FIELD_LINKEDIN] = $this->linkedin;
|
}
|
||||||
|
}
|
||||||
if ($this->phone && !empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone;
|
if ($this->phone && !empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone;
|
||||||
if ($this->phone_perso && !empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso;
|
if ($this->phone_perso && !empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso;
|
||||||
if ($this->phone_mobile && !empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile;
|
if ($this->phone_mobile && !empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile;
|
||||||
@ -2455,8 +2462,12 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
// When password is modified
|
// When password is modified
|
||||||
if (!empty($this->pass)) {
|
if (!empty($this->pass)) {
|
||||||
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
|
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) {
|
||||||
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption)
|
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
|
||||||
|
}
|
||||||
|
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) {
|
||||||
|
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption)
|
||||||
|
}
|
||||||
} // Set LDAP password if possible
|
} // Set LDAP password if possible
|
||||||
elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') { // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password
|
elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') { // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password
|
||||||
if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) {
|
if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) {
|
||||||
|
|||||||
@ -96,6 +96,30 @@ class User extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $socialnetworks;
|
public $socialnetworks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string skype account
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public $skype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string twitter account
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public $twitter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string facebook account
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public $facebook;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string linkedin account
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public $linkedin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string job position
|
* @var string job position
|
||||||
*/
|
*/
|
||||||
@ -2653,6 +2677,9 @@ class User extends CommonObject
|
|||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$info = array();
|
$info = array();
|
||||||
|
|
||||||
|
$socialnetworks = getArrayOfSocialNetworks();
|
||||||
|
|
||||||
$keymodified = false;
|
$keymodified = false;
|
||||||
|
|
||||||
// Object classes
|
// Object classes
|
||||||
@ -2672,10 +2699,6 @@ class User extends CommonObject
|
|||||||
'LDAP_FIELD_FAX' => 'office_fax',
|
'LDAP_FIELD_FAX' => 'office_fax',
|
||||||
'LDAP_FIELD_MAIL' => 'email',
|
'LDAP_FIELD_MAIL' => 'email',
|
||||||
'LDAP_FIELD_SID' => 'ldap_sid',
|
'LDAP_FIELD_SID' => 'ldap_sid',
|
||||||
'LDAP_FIELD_SKYPE' => 'skype',
|
|
||||||
'LDAP_FIELD_TWITTER' => 'twitter',
|
|
||||||
'LDAP_FIELD_FACEBOOK' => 'facebook',
|
|
||||||
'LDAP_FIELD_LINKEDIN' => 'linkedin'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Champs
|
// Champs
|
||||||
@ -2691,6 +2714,11 @@ class User extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
foreach ($socialnetworks as $key => $value) {
|
||||||
|
if ($this->socialnetworks[$value['label']] && !empty($conf->global->{'LDAP_FIELD_'.strtoupper($value['label'])})) {
|
||||||
|
$info[$conf->global->{'LDAP_FIELD_'.strtoupper($value['label'])}] = $this->socialnetworks[$value['label']];
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($this->address && !empty($conf->global->LDAP_FIELD_ADDRESS)) {
|
if ($this->address && !empty($conf->global->LDAP_FIELD_ADDRESS)) {
|
||||||
$info[$conf->global->LDAP_FIELD_ADDRESS] = $this->address;
|
$info[$conf->global->LDAP_FIELD_ADDRESS] = $this->address;
|
||||||
}
|
}
|
||||||
@ -2959,6 +2987,8 @@ class User extends CommonObject
|
|||||||
// TODO: Voir pourquoi le update met à jour avec toutes les valeurs vide (global $user écrase ?)
|
// TODO: Voir pourquoi le update met à jour avec toutes les valeurs vide (global $user écrase ?)
|
||||||
global $user, $conf;
|
global $user, $conf;
|
||||||
|
|
||||||
|
$socialnetworks = getArrayOfSocialNetworks();
|
||||||
|
|
||||||
$this->firstname = $ldapuser->{$conf->global->LDAP_FIELD_FIRSTNAME};
|
$this->firstname = $ldapuser->{$conf->global->LDAP_FIELD_FIRSTNAME};
|
||||||
$this->lastname = $ldapuser->{$conf->global->LDAP_FIELD_NAME};
|
$this->lastname = $ldapuser->{$conf->global->LDAP_FIELD_NAME};
|
||||||
$this->login = $ldapuser->{$conf->global->LDAP_FIELD_LOGIN};
|
$this->login = $ldapuser->{$conf->global->LDAP_FIELD_LOGIN};
|
||||||
@ -2969,10 +2999,9 @@ class User extends CommonObject
|
|||||||
$this->user_mobile = $ldapuser->{$conf->global->LDAP_FIELD_MOBILE};
|
$this->user_mobile = $ldapuser->{$conf->global->LDAP_FIELD_MOBILE};
|
||||||
$this->office_fax = $ldapuser->{$conf->global->LDAP_FIELD_FAX};
|
$this->office_fax = $ldapuser->{$conf->global->LDAP_FIELD_FAX};
|
||||||
$this->email = $ldapuser->{$conf->global->LDAP_FIELD_MAIL};
|
$this->email = $ldapuser->{$conf->global->LDAP_FIELD_MAIL};
|
||||||
$this->skype = $ldapuser->{$conf->global->LDAP_FIELD_SKYPE};
|
foreach ($socialnetworks as $key => $value) {
|
||||||
$this->twitter = $ldapuser->{$conf->global->LDAP_FIELD_TWITTER};
|
$this->socialnetworks[$value['label']] = $ldapuser{$conf->global->{'LDAP_FIELD_'.strtoupper($value['label'])}};
|
||||||
$this->facebook = $ldapuser->{$conf->global->LDAP_FIELD_FACEBOOK};
|
}
|
||||||
$this->linkedin = $ldapuser->{$conf->global->LDAP_FIELD_LINKEDIN};
|
|
||||||
$this->ldap_sid = $ldapuser->{$conf->global->LDAP_FIELD_SID};
|
$this->ldap_sid = $ldapuser->{$conf->global->LDAP_FIELD_SID};
|
||||||
|
|
||||||
$this->job = $ldapuser->{$conf->global->LDAP_FIELD_TITLE};
|
$this->job = $ldapuser->{$conf->global->LDAP_FIELD_TITLE};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user