Merge pull request #23454 from colemanw/searchKitGrandTotals
[civicrm-core.git] / CRM / Dedupe / Merger.php
index 147dd905182019f428170bbb2e466b53b324be71..5c4df7f318135f5854d0d16aa94e306b32fcb47b 100644 (file)
@@ -607,7 +607,7 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
     foreach ($sqls as $sql) {
       CRM_Core_DAO::executeQuery($sql, [], TRUE, NULL, TRUE);
     }
-    CRM_Dedupe_Merger::addMembershipToRealtedContacts($mainId);
+    CRM_Dedupe_Merger::addMembershipToRelatedContacts($mainId);
   }
 
   /**
@@ -1917,7 +1917,7 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
    * @throws \CRM_Core_Exception
    * @throws \CiviCRM_API3_Exception
    */
-  public static function addMembershipToRealtedContacts($contactID) {
+  public static function addMembershipToRelatedContacts($contactID) {
     $dao = new CRM_Member_DAO_Membership();
     $dao->contact_id = $contactID;
     $dao->is_test = 0;
@@ -2750,6 +2750,7 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
 
         // Add this value to the table rows
         $rows["move_location_{$blockName}_{$count}"]['other'] = $displayValue;
+        $rows["move_location_{$blockName}_{$count}"]['location_entity'] = $blockName;
 
         // CRM-17556 Only display 'main' contact value if it's the same location + type
         // Look it up from main values...
@@ -2777,7 +2778,6 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
               // Set this value as the default against the 'other' contact value
               $rows["move_location_{$blockName}_{$count}"]['main'] = $mainValueCheck[$blockInfo['displayField']];
               $rows["move_location_{$blockName}_{$count}"]['main_is_primary'] = $mainValueCheck['is_primary'] ?? 0;
-              $rows["move_location_{$blockName}_{$count}"]['location_entity'] = $blockName;
               $mainContactBlockId = $mainValueCheck['id'];
               break;
             }