Skip to content
Snippets Groups Projects
Commit 40e3e919 authored by Florian Azizian's avatar Florian Azizian
Browse files

FIX #5451 encode export contact

parent 4c1ae87d
No related branches found
No related tags found
No related merge requests found
......@@ -58,18 +58,18 @@ for ($i_export=0;$i_export<count($tab_export);$i_export++){
for ($j_export=0;$j_export<$nb_colum;$j_export++){
if($tab_export[$i_export][$j_export]['column'] <> _ID){
if ($i_export==0) {
array_push($list_header, mb_strtoupper(utf8_decode($tab_export[$i_export][$j_export]['column'])));
array_push($list_header, mb_strtoupper($tab_export[$i_export][$j_export]['column'], 'UTF-8'));
}
if($tab_export[$i_export][$j_export]['column'] == _CONTACT_TYPE){
array_push($list_row, utf8_decode($contact->get_label_contact(($tab_export[$i_export][$j_export]['value']),$_SESSION['tablename']['contact_types'])));
array_push($list_row, $contact->get_label_contact(($tab_export[$i_export][$j_export]['value']),$_SESSION['tablename']['contact_types']));
} else if($tab_export[$i_export][$j_export]['column'] == _IS_CORPORATE_PERSON){
if($tab_export[$i_export][$j_export]['value'] == 'Y'){
array_push($list_row, utf8_decode(_YES));
array_push($list_row, _YES);
} else {
array_push($list_row, utf8_decode(_NO));
array_push($list_row, _NO);
}
} else {
array_push($list_row, utf8_decode($tab_export[$i_export][$j_export]['value']));
array_push($list_row, $tab_export[$i_export][$j_export]['value']);
}
}
}
......@@ -79,37 +79,37 @@ for ($i_export=0;$i_export<count($tab_export);$i_export++){
if ($stmt->rowCount()>0) {
while($address = $stmt->fetchObject()){
if ($i_export==0) {
array_push($list_header, mb_strtoupper(utf8_decode(html_entity_decode(_CONTACT_PURPOSE))));
array_push($list_header, mb_strtoupper(utf8_decode(html_entity_decode(_SERVICE))));
array_push($list_header, mb_strtoupper(utf8_decode(html_entity_decode(_FIRSTNAME))));
array_push($list_header, mb_strtoupper(utf8_decode(_LASTNAME)));
array_push($list_header, mb_strtoupper(utf8_decode(html_entity_decode(_TITLE2))));
array_push($list_header, mb_strtoupper(utf8_decode(_FUNCTION)));
array_push($list_header, mb_strtoupper(utf8_decode(_OCCUPANCY)));
array_push($list_header, mb_strtoupper(utf8_decode(html_entity_decode(_NUM))));
array_push($list_header, mb_strtoupper(utf8_decode(_STREET)));
array_push($list_header, mb_strtoupper(utf8_decode(html_entity_decode(_COMPLEMENT))));
array_push($list_header, mb_strtoupper(utf8_decode(_TOWN)));
array_push($list_header, mb_strtoupper(utf8_decode(_COUNTRY)));
array_push($list_header, mb_strtoupper(utf8_decode(html_entity_decode(_PHONE))));
array_push($list_header, mb_strtoupper(utf8_decode(_MAIL)));
array_push($list_header, mb_strtoupper(html_entity_decode(_CONTACT_PURPOSE), 'UTF-8'));
array_push($list_header, mb_strtoupper(html_entity_decode(_SERVICE), 'UTF-8'));
array_push($list_header, mb_strtoupper(html_entity_decode(_FIRSTNAME), 'UTF-8'));
array_push($list_header, mb_strtoupper(_LASTNAME, 'UTF-8'));
array_push($list_header, mb_strtoupper(html_entity_decode(_TITLE2), 'UTF-8'));
array_push($list_header, mb_strtoupper(_FUNCTION, 'UTF-8'));
array_push($list_header, mb_strtoupper(_OCCUPANCY, 'UTF-8'));
array_push($list_header, mb_strtoupper(html_entity_decode(_NUM), 'UTF-8'));
array_push($list_header, mb_strtoupper(_STREET, 'UTF-8'));
array_push($list_header, mb_strtoupper(html_entity_decode(_COMPLEMENT), 'UTF-8'));
array_push($list_header, mb_strtoupper(_TOWN, 'UTF-8'));
array_push($list_header, mb_strtoupper(_COUNTRY, 'UTF-8'));
array_push($list_header, mb_strtoupper(html_entity_decode(_PHONE), 'UTF-8'));
array_push($list_header, mb_strtoupper(_MAIL, 'UTF-8'));
}
$list_address = $list_row;
array_push($list_address, utf8_decode($contact->get_label_contact($address->contact_purpose_id,$_SESSION['tablename']['contact_purposes'])));
array_push($list_address, utf8_decode($address->departement));
array_push($list_address, utf8_decode($address->firstname));
array_push($list_address, utf8_decode($address->lastname));
array_push($list_address, utf8_decode($business->get_label_title($address->title)));
array_push($list_address, utf8_decode($address->function));
array_push($list_address, utf8_decode($address->occupancy));
array_push($list_address, utf8_decode($address->address_num));
array_push($list_address, utf8_decode($address->address_street));
array_push($list_address, utf8_decode($address->address_complement));
array_push($list_address, utf8_decode($address->address_town));
array_push($list_address, utf8_decode($address->address_country));
array_push($list_address, utf8_decode($address->phone));
array_push($list_address, utf8_decode($address->email));
array_push($list_address, $contact->get_label_contact($address->contact_purpose_id,$_SESSION['tablename']['contact_purposes']));
array_push($list_address, $address->departement);
array_push($list_address, $address->firstname);
array_push($list_address, $address->lastname);
array_push($list_address, $business->get_label_title($address->title));
array_push($list_address, $address->function);
array_push($list_address, $address->occupancy);
array_push($list_address, $address->address_num);
array_push($list_address, $address->address_street);
array_push($list_address, $address->address_complement);
array_push($list_address, $address->address_town);
array_push($list_address, $address->address_country);
array_push($list_address, $address->phone);
array_push($list_address, $address->email);
if ($i_export==0 && $header_done == false) {
fputcsv($fp, $list_header, ';', '"');
......@@ -132,7 +132,7 @@ fclose($fp);
header('Pragma: public');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Type: application/vnd.ms-excel');
header('Content-Type: application/vnd.ms-excel; charset=utf-8');
header('Content-Disposition: inline; filename=contact_list'.$_SESSION['user']['UserId'].'.csv;');
readfile($_SESSION['config']['tmppath'].'contact_list'.$_SESSION['user']['UserId'].'.csv');
exit;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment