Skip to content

Commit

Permalink
Merge pull request #10394 from JMAConsulting/DonotExport
Browse files Browse the repository at this point in the history
CRM-20615 Export only those batches whose status is exported
  • Loading branch information
colemanw authored Aug 9, 2017
2 parents 3c6447b + f091b03 commit 4568166
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion CRM/Batch/BAO/Batch.php
Original file line number Diff line number Diff line change
Expand Up @@ -577,10 +577,21 @@ public static function exportFinancialBatch($batchIds, $exportFormat) {
else {
CRM_Core_Error::fatal("Could not locate exporter: $exporterClass");
}
$export = array();
foreach ($batchIds as $batchId) {
// export only batches whose status is set to Exported.
$result = civicrm_api3('Batch', 'getcount', array(
'id' => $batchId,
'status_id' => "Exported",
));
if (!$result) {
continue;
}
$export[$batchId] = $exporter->generateExportQuery($batchId);
}
$exporter->makeExport($export);
if ($export) {
$exporter->makeExport($export);
}
}

/**
Expand Down

0 comments on commit 4568166

Please sign in to comment.