Fix CRM-12013.
authorAllen Shaw <allen@nswebsolutions.com>
Tue, 12 Mar 2013 06:03:13 +0000 (01:03 -0500)
committerAllen Shaw <allen@nswebsolutions.com>
Tue, 12 Mar 2013 06:03:13 +0000 (01:03 -0500)
CRM/Export/BAO/Export.php

index f3963e4e1afa6dd6326fe77bb875811763ee3599..c3e7d57393a6eb753b7f5bdfb682e8753039bf90 100644 (file)
@@ -996,16 +996,20 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c
         //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