+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2017 |
+ | Copyright CiviCRM LLC (c) 2004-2018 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2017
+ * @copyright CiviCRM LLC (c) 2004-2018
*/
/**
$batch['item_count'] = CRM_Utils_Array::value('item_count', $value);
$batch['type'] = CRM_Utils_Array::value('batch_type', $value);
if (!empty($value['total'])) {
- $batch['total'] = CRM_Utils_Money::format($value['total']);
+ // CRM-21205
+ $batch['total'] = CRM_Utils_Money::format($value['total'], $value['currency']);
}
// Compare totals with actuals
'Batch',
$values['id']
);
+ // CRM-21205
+ $values['currency'] = CRM_Core_DAO::singleValueQuery("
+ SELECT GROUP_CONCAT(DISTINCT ft.currency)
+ FROM civicrm_batch batch
+ JOIN civicrm_entity_batch eb
+ ON batch.id = eb.batch_id
+ JOIN civicrm_financial_trxn ft
+ ON eb.entity_id = ft.id
+ WHERE batch.id = %1
+ GROUP BY batch.id
+ ", array(1 => array($values['id'], 'Positive')));
$results[$values['id']] = $values;
}
* 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;
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(