From 7d6dd61c67dfe1bb6af2805cc6905c4fc77d2924 Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 11 Jul 2019 00:46:36 +1200 Subject: [PATCH] Minor code relocation n --- CRM/Export/BAO/Export.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/CRM/Export/BAO/Export.php b/CRM/Export/BAO/Export.php index 4b5e3232f0..9b3022555d 100644 --- a/CRM/Export/BAO/Export.php +++ b/CRM/Export/BAO/Export.php @@ -182,20 +182,22 @@ class CRM_Export_BAO_Export { $mappedFields[] = CRM_Core_BAO_Mapping::getMappingParams([], $field); } + if (!$selectAll && $componentTable && !empty($exportParams['additional_group'])) { + // If an Additional Group is selected, then all contacts in that group are + // added to the export set (filtering out duplicates). + // Really - the calling function could do this ... just saying + // @todo take a whip to the calling function. + CRM_Core_DAO::executeQuery(" +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, $mappedFields, $queryOperator, $mergeSameHousehold, $isPostalOnly, $mergeSameAddress); if ($moreReturnProperties) { $processor->setAdditionalRequestedReturnProperties($moreReturnProperties); } $paymentTableId = $processor->getPaymentTableID(); - if (!$selectAll && $componentTable && !empty($exportParams['additional_group'])) { - // If an Additional Group is selected, then all contacts in that group are - // added to the export set (filtering out duplicates). - $query = " -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"; - CRM_Core_DAO::executeQuery($query); - } - if ($processor->getRequestedFields() && $processor->isPostalableOnly() ) { -- 2.25.1