Merge pull request #7109 from jitendrapurohit/CRM-9428
[civicrm-core.git] / CRM / Dedupe / Finder.php
index 723f416db021ddac878ad451bd537b3d2eb09f7c..3d083c76b3610faf466a159313e633284030ebcf 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.6                                                |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
@@ -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]);
       }
     }