diff --git a/CRM/Batch/BAO/Batch.php b/CRM/Batch/BAO/Batch.php index 6dda28ebb5f0..26ad0aaf64e2 100644 --- a/CRM/Batch/BAO/Batch.php +++ b/CRM/Batch/BAO/Batch.php @@ -574,8 +574,10 @@ public static function displayTotals($actual, $expected) { * Associated array of batch ids. * @param string $exportFormat * Export format. + * @param bool $downloadFile + * Download export file?. */ - public static function exportFinancialBatch($batchIds, $exportFormat) { + public static function exportFinancialBatch($batchIds, $exportFormat, $downloadFile) { if (empty($batchIds)) { CRM_Core_Error::fatal(ts('No batches were selected.')); return; @@ -594,6 +596,7 @@ public static function exportFinancialBatch($batchIds, $exportFormat) { else { CRM_Core_Error::fatal("Could not locate exporter: $exporterClass"); } + $exporter->_isDownloadFile = $downloadFile; foreach ($batchIds as $batchId) { $export[$batchId] = $exporter->generateExportQuery($batchId); } diff --git a/CRM/Financial/BAO/ExportFormat.php b/CRM/Financial/BAO/ExportFormat.php index 438efb682f60..5b67e48631ee 100644 --- a/CRM/Financial/BAO/ExportFormat.php +++ b/CRM/Financial/BAO/ExportFormat.php @@ -141,6 +141,9 @@ public static function format($s, $type = 'string') { } public function initiateDownload() { + if (!$this->_isDownloadFile) { + return NULL; + } $config = CRM_Core_Config::singleton(); // zip files if more than one. if (count($this->_downloadFile) > 1) { diff --git a/CRM/Financial/Form/Export.php b/CRM/Financial/Form/Export.php index 7267d0469c16..7b070b8ec4a2 100644 --- a/CRM/Financial/Form/Export.php +++ b/CRM/Financial/Form/Export.php @@ -60,6 +60,11 @@ class CRM_Financial_Form_Export extends CRM_Core_Form { */ protected $_exportFormat; + /** + * Download export File. + */ + protected $_downloadFile = TRUE; + /** * Build all the data structures needed to build the form. */ @@ -175,7 +180,7 @@ public function postProcess() { CRM_Batch_BAO_Batch::create($batchParams, $ids, 'financialBatch'); } - CRM_Batch_BAO_Batch::exportFinancialBatch($batchIds, $this->_exportFormat); + CRM_Batch_BAO_Batch::exportFinancialBatch($batchIds, $this->_exportFormat, $this->_downloadFile); } }