Move code wrangling to the start
authoreileen <emcnaughton@wikimedia.org>
Wed, 10 Jul 2019 12:50:37 +0000 (00:50 +1200)
committereileen <emcnaughton@wikimedia.org>
Fri, 12 Jul 2019 00:38:29 +0000 (12:38 +1200)
CRM/Export/BAO/Export.php

index 06ab07ed990293d6bc28374ef584161a6ed16c79..e08727f3273d9a6dc20453981eea0b7f3ce12ff4 100644 (file)
@@ -187,18 +187,18 @@ class CRM_Export_BAO_Export {
 INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_contact gc WHERE gc.group_id = {$exportParams['additional_group']} ON DUPLICATE KEY UPDATE {$componentTable}.contact_id = gc.contact_id"
       );
     }
-
-    $processor = new CRM_Export_BAO_ExportProcessor($exportMode, $fields, $queryOperator, $mergeSameHousehold, $isPostalOnly, $mergeSameAddress);
-    if ($moreReturnProperties) {
-      $processor->setAdditionalRequestedReturnProperties($moreReturnProperties);
-    }
-    $paymentTableId = $processor->getPaymentTableID();
-
     // rectify params to what proximity search expects if there is a value for prox_distance
     // CRM-7021
+    // @todo - move this back to the calling functions
     if (!empty($params)) {
       CRM_Contact_BAO_ProximityQuery::fixInputParams($params);
     }
+    // @todo everything from this line up should go back to the calling functions.
+    $processor = new CRM_Export_BAO_ExportProcessor($exportMode, $fields, $queryOperator, $mergeSameHousehold, $isPostalOnly, $mergeSameAddress);
+    if ($moreReturnProperties) {
+      $processor->setAdditionalRequestedReturnProperties($moreReturnProperties);
+    }
+    $paymentTableId = $processor->getPaymentTableID();
 
     list($query, $select, $from, $where, $having) = $processor->runQuery($params, $order);