Merge pull request #32853 from frederic34/patch-11

more fields in liste_contacts
This commit is contained in:
Laurent Destailleur 2025-02-02 01:57:26 +01:00 committed by GitHub
commit eb406b8065
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1500,14 +1500,14 @@ abstract class CommonObject
$sql = "SELECT ec.rowid, ec.statut as statuslink, ec.fk_socpeople as id, ec.fk_c_type_contact"; // This field contains id of llx_socpeople or id of llx_user
if ($source == 'internal') {
$sql .= ", '-1' as socid, t.statut as statuscontact, t.login, t.photo, t.gender";
$sql .= ", '-1' as socid, t.statut as statuscontact, t.login, t.photo, t.gender, t.fk_country as country_id";
}
if ($source == 'external' || $source == 'thirdparty') {
$sql .= ", t.fk_soc as socid, t.statut as statuscontact";
$sql .= ", t.fk_soc as socid, t.statut as statuscontact, t.fk_pays as country_id";
}
$sql .= ", t.civility as civility, t.lastname as lastname, t.firstname, t.email";
$sql .= ", t.civility as civility, t.lastname as lastname, t.firstname, t.email, t.address, t.zip, t.town";
if (empty($arrayoftcids)) {
$sql .= ", tc.source, tc.element, tc.code, tc.libelle as type_label";
$sql .= ", tc.source, tc.element, tc.code, tc.libelle as type_label, co.label as country";
}
$sql .= " FROM";
if (empty($arrayoftcids)) {
@ -1516,9 +1516,11 @@ abstract class CommonObject
$sql .= " ".$this->db->prefix()."element_contact as ec";
if ($source == 'internal') { // internal contact (user)
$sql .= " LEFT JOIN ".$this->db->prefix()."user as t on ec.fk_socpeople = t.rowid";
$sql .= " LEFT JOIN ".$this->db->prefix()."c_country as co ON co.rowid = t.fk_country";
}
if ($source == 'external' || $source == 'thirdparty') { // external contact (socpeople)
$sql .= " LEFT JOIN ".$this->db->prefix()."socpeople as t on ec.fk_socpeople = t.rowid";
$sql .= " LEFT JOIN ".$this->db->prefix()."c_country as co ON co.rowid = t.fk_pays";
}
$sql .= " WHERE ec.element_id = ".((int) $this->id);
if (empty($arrayoftcids)) {
@ -1566,6 +1568,11 @@ abstract class CommonObject
'lastname' => $obj->lastname,
'firstname' => $obj->firstname,
'email' => $obj->email,
'address' => $obj->address,
'zip' => $obj->zip,
'town' => $obj->town,
'country_id' => $obj->country_id,
'country' => $obj->country,
'login' => (empty($obj->login) ? '' : $obj->login),
'photo' => (empty($obj->photo) ? '' : $obj->photo),
'gender' => (empty($obj->gender) ? '' : $obj->gender),