From 84050c888fe3e38abfa283d9e2d27bcf8540069a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Apr 2019 18:04:18 +0200 Subject: [PATCH] Fix set of civility label --- htdocs/contact/class/contact.class.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index b81a8118569..d350c8b3ff3 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -204,7 +204,7 @@ class Contact extends CommonObject public function create($user) { global $conf, $langs; - + $error=0; $now=dol_now(); @@ -695,7 +695,7 @@ class Contact extends CommonObject public function fetch($id, $user = null, $ref_ext = '', $email = '') { global $langs; - + $langs->load("dict"); dol_syslog(get_class($this)."::fetch id=".$id, LOG_DEBUG); @@ -708,7 +708,7 @@ class Contact extends CommonObject $langs->load("companies"); - $sql = "SELECT c.rowid, c.entity, c.fk_soc, c.ref_ext, c.civility as civility_id, c.lastname, c.firstname,"; + $sql = "SELECT c.rowid, c.entity, c.fk_soc, c.ref_ext, c.civility as civility_code, c.lastname, c.firstname,"; $sql.= " c.address, c.statut, c.zip, c.town,"; $sql.= " c.fk_pays as country_id,"; $sql.= " c.fk_departement as state_id,"; @@ -750,10 +750,11 @@ class Contact extends CommonObject $this->entity = $obj->entity; $this->ref = $obj->rowid; $this->ref_ext = $obj->ref_ext; - $this->civility_id = $obj->civility_id; - $this->civility_code = $obj->civility_id; - $this->civility = $langs->trans("Civility".$obj->civility_id); - $this->lastname = $obj->lastname; + + $this->civility_code = $obj->civility_code; + $this->civility = $obj->civility_code?($langs->trans("Civility".$obj->civility_code) != ("Civility".$obj->civility_code) ? $langs->trans("Civility".$obj->civility_code) : $obj->civility_code):''; + + $this->lastname = $obj->lastname; $this->firstname = $obj->firstname; $this->address = $obj->address; $this->zip = $obj->zip;