CRM-15882 - ensure duplicate addresses are merged not overwritten
authorJamie McClelland <jm@mayfirst.org>
Wed, 28 Jan 2015 20:16:20 +0000 (15:16 -0500)
committerJamie McClelland <jm@mayfirst.org>
Wed, 28 Jan 2015 20:16:20 +0000 (15:16 -0500)
when doing batch merge - different addresses should be preserved or
a conflict should be generated.

----------------------------------------
* CRM-15882: batch merge overwrites addresses rather than try to preserve them
  https://issues.civicrm.org/jira/browse/CRM-15882

CRM/Dedupe/Merger.php

index c1a0226b913fc3df7d4e3a1177b0bb4a94b31821..0ac9cd1ad8f3316c9cedd3867dccf32efdef8fcf 100644 (file)
@@ -743,14 +743,14 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
         // Rule: resolve address conflict if any -
         if ($fieldName == 'address') {
           $mainNewLocTypeId = $migrationInfo['location'][$fieldName][$fieldCount]['locTypeId'];
-          if (!empty($migrationInfo['main_loc_address']) &&
-              array_key_exists("main_{$mainNewLocTypeId}", $migrationInfo['main_loc_address'])) {
+          if (!empty($migrationInfo['main_loc_block']) &&
+              array_key_exists("main_address{$mainNewLocTypeId}", $migrationInfo['main_loc_block'])) {
             // main loc already has some address for the loc-type. Its a overwrite situation.
 
             // look for next available loc-type
             $newTypeId = NULL;
             foreach ($allLocationTypes as $typeId => $typeLabel) {
-              if (!array_key_exists("main_{$typeId}", $migrationInfo['main_loc_address'])) {
+              if (!array_key_exists("main_address{$typeId}", $migrationInfo['main_loc_block'])) {
                 $newTypeId = $typeId;
               }
             }