Skip to content

Commit

Permalink
Fix: add all phones if create user from contact
Browse files Browse the repository at this point in the history
  • Loading branch information
hregis committed Jan 13, 2012
1 parent b069d6d commit 8ccc7ac
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions htdocs/user/class/user.class.php
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit 8ccc7ac

Please sign in to comment.