Merge pull request #15590 from alifrumin/subjecthelp
[civicrm-core.git] / CRM / Export / BAO / Export.php
index 22ef1aede73aa4d41c64428d60f4a714c170cb3b..1541cb9e8eca698f46805ad3cf27aad6134fb435 100644 (file)
@@ -115,6 +115,7 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c
     }
     $processor->setComponentTable($componentTable);
     $processor->setComponentClause($componentClause);
+    $processor->setIds($ids);
 
     list($query, $queryString) = $processor->runQuery($params, $order);
 
@@ -127,6 +128,9 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c
 
     if ($processor->isMergeSameAddress()) {
       foreach (array_keys($processor->getAdditionalFieldsForSameAddressMerge()) as $field) {
+        if ($field === 'id') {
+          $field = 'civicrm_primary_id';
+        }
         $processor->setColumnAsCalculationOnly($field);
       }
     }