Commit f3d529fc authored by Pradeep Nayak's avatar Pradeep Nayak

CRM-20614 Don't download export file until asked

----------------------------------------
* CRM-20614: Donot Download Export file for Financial Batch
  https://issues.civicrm.org/jira/browse/CRM-20614
parent 7d5fc448
......@@ -576,8 +576,10 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch {
* 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;
......@@ -597,6 +599,7 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch {
CRM_Core_Error::fatal("Could not locate exporter: $exporterClass");
}
$export = array();
$exporter->_isDownloadFile = $downloadFile;
foreach ($batchIds as $batchId) {
// export only batches whose status is set to Exported.
$result = civicrm_api3('Batch', 'getcount', array(
......
......@@ -141,6 +141,9 @@ abstract class CRM_Financial_BAO_ExportFormat {
}
public function initiateDownload() {
if (!$this->_isDownloadFile) {
return NULL;
}
$config = CRM_Core_Config::singleton();
// zip files if more than one.
if (count($this->_downloadFile) > 1) {
......
......@@ -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 @@ class CRM_Financial_Form_Export extends CRM_Core_Form {
CRM_Batch_BAO_Batch::create($batchParams);
}
CRM_Batch_BAO_Batch::exportFinancialBatch($batchIds, $this->_exportFormat);
CRM_Batch_BAO_Batch::exportFinancialBatch($batchIds, $this->_exportFormat, $this->_downloadFile);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment