diff --git a/CRM/Dedupe/BAO/Rule.php b/CRM/Dedupe/BAO/Rule.php index 73048c846c61..e2f19d57e310 100644 --- a/CRM/Dedupe/BAO/Rule.php +++ b/CRM/Dedupe/BAO/Rule.php @@ -62,14 +62,16 @@ public function sql() { $where = []; $on = ["SUBSTR(t1.{$this->rule_field}, 1, {$this->rule_length}) = SUBSTR(t2.{$this->rule_field}, 1, {$this->rule_length})"]; $entity = CRM_Core_DAO_AllCoreTables::getBriefName(CRM_Core_DAO_AllCoreTables::getClassForTable($this->rule_table)); - $fields = civicrm_api3($entity, 'getfields', ['action' => 'create'])['values']; + if (isset($entity)) { + $fields = civicrm_api3($entity, 'getfields', ['action' => 'create'])['values']; + } $innerJoinClauses = [ "t1.{$this->rule_field} IS NOT NULL", "t2.{$this->rule_field} IS NOT NULL", "t1.{$this->rule_field} = t2.{$this->rule_field}", ]; - if ($fields[$this->rule_field]['type'] === CRM_Utils_Type::T_DATE) { + if (isset($fields[$this->rule_field]['type']) && ($fields[$this->rule_field]['type'] === CRM_Utils_Type::T_DATE)) { $innerJoinClauses[] = "t1.{$this->rule_field} > '1000-01-01'"; $innerJoinClauses[] = "t2.{$this->rule_field} > '1000-01-01'"; }