diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index 1bb8a29ad5a..af621b7a53a 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -395,10 +395,10 @@ abstract class ActionsContactCardCommon if ($action == 'create_user') { - // Full firstname and name separated with a dot : firstname.name + // Full firstname and lastname separated with a dot : firstname.lastname include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; - $login=dol_buildlogin($this->object->nom, $this->object->prenom); + $login=dol_buildlogin($this->object->lastname, $this->object->firstname); $generated_password=getRandomPassword(''); $password=$generated_password; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 17e646b5a8d..9c5ff1a2a6f 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -42,7 +42,6 @@ class Contact extends CommonObject var $name; // TODO deprecated var $nom; // TODO deprecated var $firstname; - var $prenom; // TODO deprecated var $address; var $cp; // TODO deprecated var $zip; @@ -110,7 +109,7 @@ class Contact extends CommonObject $this->db->begin(); // Clean parameters - $this->lastname=$this->lastname?trim($this->lastname):$this->name; + $this->lastname=$this->lastname?trim($this->lastname):$this->lastname; $this->firstname=trim($this->firstname); if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname=ucwords($this->lastname); if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname=ucwords($this->firstname); @@ -120,7 +119,7 @@ class Contact extends CommonObject $sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople ("; $sql.= " datec"; $sql.= ", fk_soc"; - $sql.= ", name"; + $sql.= ", lastname"; $sql.= ", firstname"; $sql.= ", fk_user_creat"; $sql.= ", priv"; @@ -216,7 +215,7 @@ class Contact extends CommonObject $this->id = $id; // Clean parameters - $this->lastname=trim($this->lastname)?trim($this->lastname):trim($this->name); + $this->lastname=trim($this->lastname)?trim($this->lastname):trim($this->lastname); $this->firstname=trim($this->firstname); $this->email=trim($this->email); $this->phone_pro=trim($this->phone_pro); @@ -234,7 +233,7 @@ class Contact extends CommonObject if ($this->socid > 0) $sql .= " fk_soc='".$this->db->escape($this->socid)."',"; else if ($this->socid == -1) $sql .= " fk_soc=null,"; $sql .= " civilite='".$this->db->escape($this->civilite_id)."'"; - $sql .= ", name='".$this->db->escape($this->lastname)."'"; + $sql .= ", lastname='".$this->db->escape($this->lastname)."'"; $sql .= ", firstname='".$this->db->escape($this->firstname)."'"; $sql .= ", address='".$this->db->escape($this->address)."'"; $sql .= ", cp='".$this->db->escape($this->zip)."'"; @@ -482,7 +481,7 @@ class Contact extends CommonObject $langs->load("companies"); - $sql = "SELECT c.rowid, c.fk_soc, c.civilite as civilite_id, c.name as lastname, c.firstname,"; + $sql = "SELECT c.rowid, c.fk_soc, c.civilite as civilite_id, c.lastname, c.firstname,"; $sql.= " c.address, c.cp as zip, c.town as town,"; $sql.= " c.fk_pays as country_id,"; $sql.= " c.fk_departement,"; @@ -513,11 +512,7 @@ class Contact extends CommonObject $this->ref = $obj->rowid; $this->civilite_id = $obj->civilite_id; $this->lastname = $obj->lastname; - $this->name = $obj->lastname; // TODO deprecated $this->firstname = $obj->firstname; - $this->nom = $obj->lastname; // TODO deprecated - $this->prenom = $obj->firstname; // TODO deprecated - $this->address = $obj->address; $this->cp = $obj->zip; // TODO deprecated $this->zip = $obj->zip; @@ -683,7 +678,7 @@ class Contact extends CommonObject $error=0; - $this->old_name = $obj->name; + $this->old_lastname = $obj->lastname; $this->old_firstname = $obj->firstname; $this->db->begin(); @@ -853,7 +848,7 @@ class Contact extends CommonObject /** * Return name of contact with link (and eventually picto) - * Use $this->id, $this->name, $this->firstname, this->civilite_id + * Use $this->id, $this->lastname, $this->firstname, this->civilite_id * * @param int $withpicto Include picto with link * @param string $option Where the link point to diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index 3f38d9439a9..8eadd64e931 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -58,6 +58,7 @@ alter table llx_mailing_cibles CHANGE COLUMN prenom firstname varchar(50); alter table llx_user CHANGE COLUMN name lastname varchar(50); alter table llx_entrepot CHANGE COLUMN ville town text; alter table llx_societe CHANGE COLUMN ville town text; +alter table llx_socpeople CHANGE COLUMN name lastname varchar(50); alter table llx_socpeople CHANGE COLUMN ville town text; alter table llx_bank_account CHANGE COLUMN adresse_proprio owner_address text;