Fix: add all phones if create user from contact

This commit is contained in:
Regis Houssin
2012-01-13 11:25:48 +01:00
parent b069d6d2f1
commit 8ccc7acf28

View File

@@ -853,12 +853,15 @@ class User extends CommonObject
$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 @@ class User extends CommonObject
{
$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);