//build header only once
$setHeader = FALSE;
- // add payment related information
- if ($paymentFields) {
- $paymentData = CRM_Utils_Array::value($row[$paymentTableId], $paymentDetails);
- if (!is_array($paymentData) || empty($paymentData)) {
- $paymentData = $nullContributionDetails;
+ // If specific payment fields have been selected for export, payment
+ // data will already be in $row. Otherwise, add payment related
+ // information, if appropriate.
+ if (!$selectedPaymentFields) {
+ if ($paymentFields) {
+ $paymentData = CRM_Utils_Array::value($row[$paymentTableId], $paymentDetails);
+ if (!is_array($paymentData) || empty($paymentData)) {
+ $paymentData = $nullContributionDetails;
+ }
+ $row = array_merge($row, $paymentData);
}
- $row = array_merge($row, $paymentData);
- }
elseif (!empty($paymentDetails)) {
- $row = array_merge($row, $nullContributionDetails);
+ $row = array_merge($row, $nullContributionDetails);
+ }
}
//remove organization name for individuals if it is set for current employer