From ba1b3804d18ac97b3defd9f7593c91e34818eef5 Mon Sep 17 00:00:00 2001 From: "kevin.dezaphi" <kevin.dezaphi@maarch.org> Date: Tue, 30 Oct 2018 17:55:12 +0100 Subject: [PATCH] FIX #8696 add phisical contact in multi in process page --- apps/maarch_entreprise/actions/process.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/apps/maarch_entreprise/actions/process.php b/apps/maarch_entreprise/actions/process.php index 9a0dfdb198f..4865afca94c 100755 --- a/apps/maarch_entreprise/actions/process.php +++ b/apps/maarch_entreprise/actions/process.php @@ -158,10 +158,10 @@ function get_form_txt($values, $path_manage_action, $id_action, $table, $module, } //Load multicontacts - $query = 'SELECT c.firstname, c.lastname, c.society, c.contact_id, c.ca_id '; + $query = 'SELECT c.firstname, c.lastname, c.society, c.contact_id, c.ca_id, c.contact_firstname, c.contact_lastname, c.is_corporate_person '; $query .= 'FROM view_contacts c, contacts_res cres '; $query .= "WHERE cres.coll_id = 'letterbox_coll' AND cres.res_id = ? AND cast (c.contact_id as varchar(128)) = cres.contact_id AND c.ca_id = cres.address_id "; - $query .= 'GROUP BY c.firstname, c.lastname, c.society, c.contact_id, c.ca_id'; + $query .= 'GROUP BY c.firstname, c.lastname, c.society, c.contact_id, c.ca_id, c.contact_firstname, c.contact_lastname, c.is_corporate_person'; $stmt = $db->query($query, array($res_id)); $nbContacts = 0; @@ -169,16 +169,24 @@ function get_form_txt($values, $path_manage_action, $id_action, $table, $module, $frameContacts = '{'; while ($res = $stmt->fetchObject()) { $nbContacts = $nbContacts + 1; - $firstname = str_replace("'", "\'", $res->firstname); - $firstname = str_replace('"', ' ', $firstname); - $lastname = str_replace("'", "\'", $res->lastname); - $lastname = str_replace('"', ' ', $lastname); + if ($res->is_corporate_person == 'Y') { + $firstname = str_replace("'", "\'", $res->firstname); + $firstname = str_replace('"', ' ', $firstname); + $lastname = str_replace("'", "\'", $res->lastname); + $lastname = str_replace('"', ' ', $lastname); + } else { + $firstname = str_replace("'", "\'", $res->contact_firstname); + $firstname = str_replace('"', ' ', $firstname); + $lastname = str_replace("'", "\'", $res->contact_lastname); + $lastname = str_replace('"', ' ', $lastname); + } $society = str_replace("'", "\'", $res->society); $society = str_replace('"', ' ', $society); $frameContacts .= "'contact ".$nbContacts."' : '" .functions::xssafe($firstname).' '.functions::xssafe($lastname) .' '.functions::xssafe($society)." (contact)', "; } + $query = 'select u.firstname, u.lastname, u.user_id '; $query .= 'from users u, contacts_res cres '; $query .= "where cres.coll_id = 'letterbox_coll' AND cres.res_id = ? AND cast (u.user_id as varchar(128)) = cres.contact_id "; -- GitLab