Update contact.class.php

This commit is contained in:
ptibogxiv 2019-04-11 17:03:07 +02:00 committed by GitHub
parent 013b8a61ec
commit 1f017d4d06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,7 +81,7 @@ class Contact extends CommonObject
public $civility_id; // In fact we store civility_code public $civility_id; // In fact we store civility_code
public $civility_code; public $civility_code;
public $civility_label; public $civility;
public $address; public $address;
public $zip; public $zip;
public $town; public $town;
@ -697,6 +697,8 @@ class Contact extends CommonObject
{ {
global $langs; global $langs;
$langs->load("dict");
dol_syslog(get_class($this)."::fetch id=".$id, LOG_DEBUG); dol_syslog(get_class($this)."::fetch id=".$id, LOG_DEBUG);
if (empty($id) && empty($ref_ext)) if (empty($id) && empty($ref_ext))
@ -718,14 +720,12 @@ class Contact extends CommonObject
$sql.= " c.import_key,"; $sql.= " c.import_key,";
$sql.= " c.datec as date_creation, c.tms as date_modification,"; $sql.= " c.datec as date_creation, c.tms as date_modification,";
$sql.= " co.label as country, co.code as country_code,"; $sql.= " co.label as country, co.code as country_code,";
$sql.= " ci.label as civility,";
$sql.= " d.nom as state, d.code_departement as state_code,"; $sql.= " d.nom as state, d.code_departement as state_code,";
$sql.= " u.rowid as user_id, u.login as user_login,"; $sql.= " u.rowid as user_id, u.login as user_login,";
$sql.= " s.nom as socname, s.address as socaddress, s.zip as soccp, s.town as soccity, s.default_lang as socdefault_lang"; $sql.= " s.nom as socname, s.address as socaddress, s.zip as soccp, s.town as soccity, s.default_lang as socdefault_lang";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON c.fk_pays = co.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON c.fk_pays = co.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON c.fk_departement = d.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON c.fk_departement = d.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_civility as ci ON c.civility = ci.code";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON c.rowid = u.fk_socpeople"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON c.rowid = u.fk_socpeople";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid";
if ($id) $sql.= " WHERE c.rowid = ". $id; if ($id) $sql.= " WHERE c.rowid = ". $id;
@ -752,8 +752,8 @@ class Contact extends CommonObject
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->ref_ext = $obj->ref_ext; $this->ref_ext = $obj->ref_ext;
$this->civility_id = $obj->civility_id; $this->civility_id = $obj->civility_id;
$this->civility_code = $obj->civility_code; $this->civility_code = $obj->civility_id;
$this->civility = $obj->civility; $this->civility = $langs->trans("Civility".$obj->civility_id);
$this->lastname = $obj->lastname; $this->lastname = $obj->lastname;
$this->firstname = $obj->firstname; $this->firstname = $obj->firstname;
$this->address = $obj->address; $this->address = $obj->address;