diff --git a/plugins/admin/systems/class_glpiAccount.inc b/plugins/admin/systems/class_glpiAccount.inc
index 353bf8e3fdf74250df6f0b08b8ac1baf18b9e098..94e703c4998e369642d665d91e96f982ce2af250 100644 (file)
if(!in_array($id,$users)){
/* If this user doesn't exists in glpi db, we must create him */
- $atr = $ldap->fetch($ldap->cat($id));
+ $ldap->cat($id, array('cn', 'mail', 'telephoneNumber'));
+ $atr = $ldap->fetch();
$tmp = array();
$use = array( "cn" =>"name",
"mail" =>"email",
Assign name ... to smarty, if set
*/
if(isset($users[$this->contact_num])){
- $tr = $ldap->fetch($ldap->cat($users[$this->contact_num]));
+ $ldap->cat($users[$this->contact_num], array('givenName', 'sn', 'uid'));
+ $tr = $ldap->fetch();
$str = "";
if(isset($tr['givenName'][0])){ $str .= $tr['givenName'][0]." "; }
if(isset($tr['sn'][0])) { $str .= $tr['sn'][0]." "; }
Assign name ... to smarty, if set
*/
if(isset($users[$this->tech_num])){
- $tr = $ldap->fetch($ldap->cat($users[$this->tech_num]));
+ $tr = $ldap->cat($users[$this->tech_num], array('givenName', 'sn', 'uid'));
+ $tr = $ldap->fetch();
$str = "";
if(isset($tr['givenName'][0])){ $str .= $tr['givenName'][0]." "; }
if(isset($tr['sn'][0])) { $str .= $tr['sn'][0]." "; }
function remove_from_parent()
{
- $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
- if($this->initialy_was_account){
- $this->handle->removeComputerInformations($this->dn);
+ if(!$this->initialy_was_account){
+ return;
+ }
+ if(function_exists("mysql_pconnect")){
+ $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
+ if($this->initialy_was_account){
+ $this->handle->removeComputerInformations($this->dn);
+ }
+ }else{
+ print_red(_("Can't remove glpi account, while mysql extension is missing."));
}
}
$attrs['name'] = $this->dn;
unset($attrs['ID']);
$this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
+
+ /* check if we have to update, add */
if($this->initialy_was_account&&$this->is_account){
- $this->handle->updateComputerInformations($attrs,$this->dn);
+ $this->handle->updateComputerInformations($attrs,$this->orig_dn);
}elseif($this->is_account){
$this->handle->addComputerInformations($attrs,$this->dn);
}