Skip to content
Snippets Groups Projects
Commit f4114c3e authored by Pradeep Nayak's avatar Pradeep Nayak
Browse files

-- Fixed formatting and code fix for CRM-12694, removed mime_content_type...

-- Fixed formatting and code fix for CRM-12694, removed mime_content_type since we have only 2 export format CSV and IIF and both have text/plain mime_content_type

----------------------------------------
* CRM-12694: Eliminate/replace call to function mime_content_type()
  http://issues.civicrm.org/jira/browse/CRM-12694
parent 00bdb555
Branches
Tags
No related merge requests found
......@@ -74,7 +74,7 @@ class CRM_Financial_BAO_ExportFormat {
case 'iif':
$tplFile = $this->getTemplateFileName();
$out = self::getTemplate()->fetch( $tplFile );
$out = self::getTemplate()->fetch($tplFile);
$fileName = $this->putFile($out);
self::createActivityExport($this->_batchIds, $fileName);
break;
......@@ -121,26 +121,26 @@ class CRM_Financial_BAO_ExportFormat {
$config = CRM_Core_Config::singleton();
//zip files if more than one.
if (count($this->_downloadFile)>1) {
$zip = $config->customFileUploadDir.'Financial_Transactions_'.date('YmdHis').'.zip';
$zip = $config->customFileUploadDir . 'Financial_Transactions_' . date('YmdHis') . '.zip';
$result = $this->createZip($this->_downloadFile, $zip, TRUE);
if ($result) {
header('Content-Type: application/zip');
header('Content-Disposition: attachment; filename='.CRM_Utils_File::cleanFileName(basename($zip)));
header('Content-Disposition: attachment; filename=' . CRM_Utils_File::cleanFileName(basename($zip)));
header('Content-Length: ' . filesize($zip));
ob_clean();
flush();
readfile($config->customFileUploadDir.CRM_Utils_File::cleanFileName(basename($zip)));
readfile($config->customFileUploadDir . CRM_Utils_File::cleanFileName(basename($zip)));
unlink($zip); //delete the zip to avoid clutter.
CRM_Utils_System::civiExit();
}
}
else {
header('Content-Type: '.mime_content_type($this->_downloadFile[0]));
header('Content-Disposition: attachment; filename='.CRM_Utils_File::cleanFileName(basename($this->_downloadFile[0])));
header('Content-Type: text/plain');
header('Content-Disposition: attachment; filename=' . CRM_Utils_File::cleanFileName(basename($this->_downloadFile[0])));
header('Content-Length: ' . filesize($this->_downloadFile[0]));
ob_clean();
flush();
readfile($config->customFileUploadDir.CRM_Utils_File::cleanFileName(basename($this->_downloadFile[0])));
readfile($config->customFileUploadDir . CRM_Utils_File::cleanFileName(basename($this->_downloadFile[0])));
CRM_Utils_System::civiExit();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment