uniformize code
This commit is contained in:
parent
1cdc3372e1
commit
832a8fa050
@ -840,8 +840,10 @@ class User extends CommonObject
|
||||
|
||||
// Positionne parametres
|
||||
$this->admin = 0;
|
||||
$this->nom = $contact->nom;
|
||||
$this->prenom = $contact->prenom;
|
||||
$this->nom = $contact->nom; // TODO deprecated
|
||||
$this->prenom = $contact->prenom; // TODO deprecated
|
||||
$this->lastname = $contact->nom;
|
||||
$this->firstname = $contact->prenom;
|
||||
$this->email = $contact->email;
|
||||
|
||||
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);
|
||||
|
||||
// Clean parameters
|
||||
$this->nom = trim($this->nom);
|
||||
$this->prenom = trim($this->prenom);
|
||||
$this->nom = trim($this->nom); // TODO deprecated
|
||||
$this->prenom = trim($this->prenom); // TODO deprecated
|
||||
$this->lastname = trim($this->lastname);
|
||||
$this->firstname = trim($this->firstname);
|
||||
$this->login = trim($this->login);
|
||||
$this->pass = trim($this->pass);
|
||||
$this->office_phone = trim($this->office_phone);
|
||||
@ -1042,8 +1046,8 @@ class User extends CommonObject
|
||||
|
||||
// Mise a jour autres infos
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET";
|
||||
$sql.= " name = '".$this->db->escape($this->nom)."'";
|
||||
$sql.= ", firstname = '".$this->db->escape($this->prenom)."'";
|
||||
$sql.= " name = '".$this->db->escape($this->lastname)."'";
|
||||
$sql.= ", firstname = '".$this->db->escape($this->firstname)."'";
|
||||
$sql.= ", login = '".$this->db->escape($this->login)."'";
|
||||
$sql.= ", admin = ".$this->admin;
|
||||
$sql.= ", office_phone = '".$this->db->escape($this->office_phone)."'";
|
||||
@ -1104,8 +1108,8 @@ class User extends CommonObject
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
$adh->prenom=$this->prenom;
|
||||
$adh->nom=$this->nom;
|
||||
$adh->prenom=$this->firstname;
|
||||
$adh->nom=$this->lastname;
|
||||
$adh->login=$this->login;
|
||||
$adh->pass=$this->pass;
|
||||
$adh->societe=(empty($adh->societe) && $this->societe_id ? $this->societe_id : $adh->societe);
|
||||
|
||||
@ -187,22 +187,22 @@ if ($_POST["action"] == 'add' && $canadduser)
|
||||
|
||||
if (! $message)
|
||||
{
|
||||
$edituser->nom = $_POST["nom"];
|
||||
$edituser->prenom = $_POST["prenom"];
|
||||
$edituser->login = $_POST["login"];
|
||||
$edituser->admin = $_POST["admin"];
|
||||
$edituser->office_phone = $_POST["office_phone"];
|
||||
$edituser->office_fax = $_POST["office_fax"];
|
||||
$edituser->user_mobile = $_POST["user_mobile"];
|
||||
$edituser->email = $_POST["email"];
|
||||
$edituser->webcal_login = $_POST["webcal_login"];
|
||||
$edituser->signature = $_POST["signature"];
|
||||
$edituser->phenix_login = $_POST["phenix_login"];
|
||||
$edituser->phenix_pass = $_POST["phenix_pass"];
|
||||
$edituser->note = $_POST["note"];
|
||||
$edituser->ldap_sid = $_POST["ldap_sid"];
|
||||
$edituser->lastname = $_POST["nom"];
|
||||
$edituser->firstname = $_POST["prenom"];
|
||||
$edituser->login = $_POST["login"];
|
||||
$edituser->admin = $_POST["admin"];
|
||||
$edituser->office_phone = $_POST["office_phone"];
|
||||
$edituser->office_fax = $_POST["office_fax"];
|
||||
$edituser->user_mobile = $_POST["user_mobile"];
|
||||
$edituser->email = $_POST["email"];
|
||||
$edituser->webcal_login = $_POST["webcal_login"];
|
||||
$edituser->signature = $_POST["signature"];
|
||||
$edituser->phenix_login = $_POST["phenix_login"];
|
||||
$edituser->phenix_pass = $_POST["phenix_pass"];
|
||||
$edituser->note = $_POST["note"];
|
||||
$edituser->ldap_sid = $_POST["ldap_sid"];
|
||||
// If multicompany is off, admin users must all be on entity 0.
|
||||
$edituser->entity = ( ! empty($_POST["admin"]) && (! empty($_POST["superadmin"]) || empty($_POST["entity"]) || empty($conf->multicompany->enabled)) ? 0 : $_POST["entity"]);
|
||||
$edituser->entity = ( ! empty($_POST["admin"]) && (! empty($_POST["superadmin"]) || empty($_POST["entity"]) || empty($conf->multicompany->enabled)) ? 0 : $_POST["entity"]);
|
||||
|
||||
$db->begin();
|
||||
|
||||
@ -284,21 +284,21 @@ if ($action == 'update' && ! $_POST["cancel"])
|
||||
|
||||
$edituser->oldcopy=dol_clone($edituser);
|
||||
|
||||
$edituser->nom = $_POST["nom"];
|
||||
$edituser->prenom = $_POST["prenom"];
|
||||
$edituser->login = $_POST["login"];
|
||||
$edituser->pass = $_POST["password"];
|
||||
$edituser->admin = $_POST["admin"];
|
||||
$edituser->office_phone = $_POST["office_phone"];
|
||||
$edituser->office_fax = $_POST["office_fax"];
|
||||
$edituser->user_mobile = $_POST["user_mobile"];
|
||||
$edituser->email = $_POST["email"];
|
||||
$edituser->signature = $_POST["signature"];
|
||||
$edituser->openid = $_POST["openid"];
|
||||
$edituser->webcal_login = $_POST["webcal_login"];
|
||||
$edituser->phenix_login = $_POST["phenix_login"];
|
||||
$edituser->phenix_pass = $_POST["phenix_pass"];
|
||||
$edituser->entity = ( (! empty($_POST["superadmin"]) && ! empty($_POST["admin"]) || empty($_POST["entity"])) ? 0 : $_POST["entity"]);
|
||||
$edituser->lastname = $_POST["nom"];
|
||||
$edituser->firstname = $_POST["prenom"];
|
||||
$edituser->login = $_POST["login"];
|
||||
$edituser->pass = $_POST["password"];
|
||||
$edituser->admin = $_POST["admin"];
|
||||
$edituser->office_phone = $_POST["office_phone"];
|
||||
$edituser->office_fax = $_POST["office_fax"];
|
||||
$edituser->user_mobile = $_POST["user_mobile"];
|
||||
$edituser->email = $_POST["email"];
|
||||
$edituser->signature = $_POST["signature"];
|
||||
$edituser->openid = $_POST["openid"];
|
||||
$edituser->webcal_login = $_POST["webcal_login"];
|
||||
$edituser->phenix_login = $_POST["phenix_login"];
|
||||
$edituser->phenix_pass = $_POST["phenix_pass"];
|
||||
$edituser->entity = ( (! empty($_POST["superadmin"]) && ! empty($_POST["admin"]) || empty($_POST["entity"])) ? 0 : $_POST["entity"]);
|
||||
if (GETPOST('deletephoto')) $edituser->photo='';
|
||||
if (! empty($_FILES['photo']['name'])) $edituser->photo = dol_sanitizeFileName($_FILES['photo']['name']);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user