CRM-16256: Skip empty fields on dedupe
authorJKingsnorth <john@johnkingsnorth.co.uk>
Wed, 8 Apr 2015 13:57:10 +0000 (14:57 +0100)
committerJKingsnorth <john@johnkingsnorth.co.uk>
Wed, 8 Apr 2015 13:57:10 +0000 (14:57 +0100)
CRM/Dedupe/BAO/Rule.php

index c268422f460ee4b791f5a558a30f32bf8f397787..8ce162446b6f14f51592b6e9eb1116e788e12000 100644 (file)
@@ -150,6 +150,7 @@ class CRM_Dedupe_BAO_Rule extends CRM_Dedupe_DAO_Rule {
       if ($this->rule_length) {
         $where[] = "SUBSTR(t1.{$this->rule_field}, 1, {$this->rule_length}) = SUBSTR('$str', 1, {$this->rule_length})";
         $where[] = "t1.{$this->rule_field} IS NOT NULL";
+        $where[] = "t1.{$this->rule_field} <> ''";
       }
       else {
         $where[] = "t1.{$this->rule_field} = '$str'";
@@ -168,6 +169,7 @@ class CRM_Dedupe_BAO_Rule extends CRM_Dedupe_DAO_Rule {
     if (!$this->params) {
       $where[] = "t1.$id < t2.$id";
       $where[] = "t1.{$this->rule_field} IS NOT NULL";
+      $where[] = "t1.{$this->rule_field} <> ''";
     }
     if ($this->contactIds) {
       $cids = array();