From 8ccc7acf285bbcf4937e1f8287d56aa43a1842eb Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 13 Jan 2012 11:25:48 +0100 Subject: [PATCH] Fix: add all phones if create user from contact --- htdocs/user/class/user.class.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index bcb7bdd191340..b1caeaba7815a 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -853,12 +853,15 @@ function create_from_contact($contact,$login='',$password='') $error=0; // Positionne parametres - $this->admin = 0; - $this->nom = $contact->nom; // TODO deprecated - $this->prenom = $contact->prenom; // TODO deprecated - $this->lastname = $contact->nom; - $this->firstname = $contact->prenom; - $this->email = $contact->email; + $this->admin = 0; + $this->nom = $contact->nom; // TODO deprecated + $this->prenom = $contact->prenom; // TODO deprecated + $this->lastname = $contact->nom; + $this->firstname = $contact->prenom; + $this->email = $contact->email; + $this->office_phone = $contact->phone_pro; + $this->office_fax = $contact->fax; + $this->user_mobile = $contact->phone_mobile; if (empty($login)) $login=strtolower(substr($contact->prenom, 0, 4)) . strtolower(substr($contact->nom, 0, 4)); $this->login = $login; @@ -871,6 +874,9 @@ function create_from_contact($contact,$login='',$password='') { $sql = "UPDATE ".MAIN_DB_PREFIX."user"; $sql.= " SET fk_socpeople=".$contact->id; + $sql.= ", office_phone = '".$this->db->escape($this->office_phone)."'"; + $sql.= ", office_fax = '".$this->db->escape($this->office_fax)."'"; + $sql.= ", user_mobile = '".$this->db->escape($this->user_mobile)."'"; if ($contact->socid) $sql.=", fk_societe=".$contact->socid; $sql.= " WHERE rowid=".$this->id; $resql=$this->db->query($sql);