uniformize code

This commit is contained in:
Regis Houssin 2011-09-03 17:28:10 +00:00
parent 1cdc3372e1
commit 832a8fa050
2 changed files with 42 additions and 38 deletions

View File

@ -840,8 +840,10 @@ class User extends CommonObject
// Positionne parametres // Positionne parametres
$this->admin = 0; $this->admin = 0;
$this->nom = $contact->nom; $this->nom = $contact->nom; // TODO deprecated
$this->prenom = $contact->prenom; $this->prenom = $contact->prenom; // TODO deprecated
$this->lastname = $contact->nom;
$this->firstname = $contact->prenom;
$this->email = $contact->email; $this->email = $contact->email;
if (empty($login)) $login=strtolower(substr($contact->prenom, 0, 4)) . strtolower(substr($contact->nom, 0, 4)); if (empty($login)) $login=strtolower(substr($contact->prenom, 0, 4)) . strtolower(substr($contact->nom, 0, 4));
@ -1011,8 +1013,10 @@ class User extends CommonObject
dol_syslog("User::update notrigger=".$notrigger.", nosyncmember=".$nosyncmember.", nosyncmemberpass=".$nosyncmemberpass); dol_syslog("User::update notrigger=".$notrigger.", nosyncmember=".$nosyncmember.", nosyncmemberpass=".$nosyncmemberpass);
// Clean parameters // Clean parameters
$this->nom = trim($this->nom); $this->nom = trim($this->nom); // TODO deprecated
$this->prenom = trim($this->prenom); $this->prenom = trim($this->prenom); // TODO deprecated
$this->lastname = trim($this->lastname);
$this->firstname = trim($this->firstname);
$this->login = trim($this->login); $this->login = trim($this->login);
$this->pass = trim($this->pass); $this->pass = trim($this->pass);
$this->office_phone = trim($this->office_phone); $this->office_phone = trim($this->office_phone);
@ -1042,8 +1046,8 @@ class User extends CommonObject
// Mise a jour autres infos // Mise a jour autres infos
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."user SET";
$sql.= " name = '".$this->db->escape($this->nom)."'"; $sql.= " name = '".$this->db->escape($this->lastname)."'";
$sql.= ", firstname = '".$this->db->escape($this->prenom)."'"; $sql.= ", firstname = '".$this->db->escape($this->firstname)."'";
$sql.= ", login = '".$this->db->escape($this->login)."'"; $sql.= ", login = '".$this->db->escape($this->login)."'";
$sql.= ", admin = ".$this->admin; $sql.= ", admin = ".$this->admin;
$sql.= ", office_phone = '".$this->db->escape($this->office_phone)."'"; $sql.= ", office_phone = '".$this->db->escape($this->office_phone)."'";
@ -1104,8 +1108,8 @@ class User extends CommonObject
if ($result >= 0) if ($result >= 0)
{ {
$adh->prenom=$this->prenom; $adh->prenom=$this->firstname;
$adh->nom=$this->nom; $adh->nom=$this->lastname;
$adh->login=$this->login; $adh->login=$this->login;
$adh->pass=$this->pass; $adh->pass=$this->pass;
$adh->societe=(empty($adh->societe) && $this->societe_id ? $this->societe_id : $adh->societe); $adh->societe=(empty($adh->societe) && $this->societe_id ? $this->societe_id : $adh->societe);

View File

@ -187,8 +187,8 @@ if ($_POST["action"] == 'add' && $canadduser)
if (! $message) if (! $message)
{ {
$edituser->nom = $_POST["nom"]; $edituser->lastname = $_POST["nom"];
$edituser->prenom = $_POST["prenom"]; $edituser->firstname = $_POST["prenom"];
$edituser->login = $_POST["login"]; $edituser->login = $_POST["login"];
$edituser->admin = $_POST["admin"]; $edituser->admin = $_POST["admin"];
$edituser->office_phone = $_POST["office_phone"]; $edituser->office_phone = $_POST["office_phone"];
@ -284,8 +284,8 @@ if ($action == 'update' && ! $_POST["cancel"])
$edituser->oldcopy=dol_clone($edituser); $edituser->oldcopy=dol_clone($edituser);
$edituser->nom = $_POST["nom"]; $edituser->lastname = $_POST["nom"];
$edituser->prenom = $_POST["prenom"]; $edituser->firstname = $_POST["prenom"];
$edituser->login = $_POST["login"]; $edituser->login = $_POST["login"];
$edituser->pass = $_POST["password"]; $edituser->pass = $_POST["password"];
$edituser->admin = $_POST["admin"]; $edituser->admin = $_POST["admin"];