dev/core#2272 Fix a DB error when merging contacts into the same household on contact...
authorSeamus Lee <seamuslee001@gmail.com>
Wed, 23 Dec 2020 20:26:49 +0000 (07:26 +1100)
committerSeamus Lee <seamuslee001@gmail.com>
Wed, 23 Dec 2020 20:26:49 +0000 (07:26 +1100)
CRM/Export/BAO/Export.php

index 575aa9af24cd371605850266ca71f8e0ec607566..3f0f57a3fc22b1e4d9b58684cf738e2417a49b68 100644 (file)
@@ -438,7 +438,11 @@ VALUES $sqlValueString
 
       $relationshipJoin = $relationshipClause = '';
       if (!$selectAll && $componentTable) {
-        $relationshipJoin = " INNER JOIN {$componentTable} ctTable ON ctTable.contact_id = {$contactA}";
+        $field = 'contact_id';
+        if ($componentTable === 'civicrm_contact') {
+          $field = 'id';
+        }
+        $relationshipJoin = " INNER JOIN {$componentTable} ctTable ON ctTable.$field = {$contactA}";
       }
       elseif (!empty($relIDs)) {
         $relID = implode(',', $relIDs);