diff --git a/CRM/Dedupe/Merger.php b/CRM/Dedupe/Merger.php index c0ec0698a55c..798ef7823393 100644 --- a/CRM/Dedupe/Merger.php +++ b/CRM/Dedupe/Merger.php @@ -1609,6 +1609,7 @@ public static function moveAllBelongings($mainId, $otherId, $migrationInfo, $che return FALSE; } + $contactType = $migrationInfo['main_details']['contact_type']; $relTables = CRM_Dedupe_Merger::relTables(); $submittedCustomFields = $moveTables = $tableOperations = $removeTables = []; @@ -1680,9 +1681,9 @@ public static function moveAllBelongings($mainId, $otherId, $migrationInfo, $che // fix custom fields so they're edible by createProfileContact() $treeCache = []; - if (!array_key_exists($migrationInfo['main_details']['contact_type'], $treeCache)) { - $treeCache[$migrationInfo['main_details']['contact_type']] = CRM_Core_BAO_CustomGroup::getTree( - $migrationInfo['main_details']['contact_type'], + if (!array_key_exists($contactType, $treeCache)) { + $treeCache[$contactType] = CRM_Core_BAO_CustomGroup::getTree( + $contactType, NULL, NULL, -1, @@ -1696,7 +1697,7 @@ public static function moveAllBelongings($mainId, $otherId, $migrationInfo, $che } $cFields = []; - foreach ($treeCache[$migrationInfo['main_details']['contact_type']] as $key => $group) { + foreach ($treeCache[$contactType] as $key => $group) { if (!isset($group['fields'])) { continue; }