From 56618539cc69709b7ddc604b3e2164a4f39e7fd2 Mon Sep 17 00:00:00 2001 From: Luciano Spiegel Date: Mon, 17 Feb 2020 17:23:43 +0100 Subject: [PATCH] dev/core#1595 fix issue when using dedupe rule with custom field --- CRM/Dedupe/BAO/Rule.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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'"; }