Merge pull request #7109 from jitendrapurohit/CRM-9428
[civicrm-core.git] / CRM / Dedupe / Finder.php
index b541bf7be21002a6d7b086da60c7f21dee162474..3d083c76b3610faf466a159313e633284030ebcf 100644 (file)
@@ -292,8 +292,9 @@ class CRM_Dedupe_Finder {
     // the -digit to civicrm_address.location_type_id and -Primary to civicrm_address.is_primary
     foreach ($flat as $key => $value) {
       $matches = array();
-      if (preg_match('/(.*)-(\d+|Primary)$/', $key, $matches)) {
-        $flat[$matches[1]] = $value;
+      if (preg_match('/(.*)-(Primary-[\d+])$|(.*)-(\d+|Primary)$/', $key, $matches)) {
+        $return = array_values(array_filter($matches));
+        $flat[$return[1]] = $value;
         unset($flat[$key]);
       }
     }