diff --git a/modules/Vtiger/actions/ExportData.php b/modules/Vtiger/actions/ExportData.php index d43d99546e9d12c702e5eb45c09b0dc76fb21fe6..fedbe65d9bf1675763842b0d3597d5f06adae05d 100644 --- a/modules/Vtiger/actions/ExportData.php +++ b/modules/Vtiger/actions/ExportData.php @@ -170,21 +170,14 @@ class Vtiger_ExportData_Action extends Vtiger_Mass_Action { header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" ); header("Cache-Control: post-check=0, pre-check=0", false ); - $header = implode("\", \"", $headers); - $header = "\"" .$header; - $header .= "\"\r\n"; - echo $header; + $fp = fopen("php://output", "w"); + fputcsv($fp, $headers); foreach($entries as $row) { - // Escape double quotes in the value. - foreach ($row as $key => $value) { - $row[$key] = str_replace('"', '""', $value); - } - $line = implode("\",\"",$row); - $line = "\"" .$line; - $line .= "\"\r\n"; - echo $line; + fputcsv($fp, $row); } + + fclose($fp); } private $picklistValues;