CRM-17564: Dedupe rule doesnt appear to be working correctly
authoryashodha <yashodha.chaku@webaccessglobal.com>
Tue, 17 Nov 2015 09:54:03 +0000 (15:24 +0530)
committeryashodha <yashodha.chaku@webaccessglobal.com>
Tue, 17 Nov 2015 09:54:03 +0000 (15:24 +0530)
----------------------------------------
* CRM-17564: Dedupe rule doesnt appear to be working correctly...
  https://issues.civicrm.org/jira/browse/CRM-17564

CRM/Dedupe/Finder.php

index 2268bf865df9c5ea731e223b561e19ed2ec34e0b..f6615c12c809939f0489f2aad2630456a7c3c4f6 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]);
       }
     }