Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#1595 fix issue when using dedupe rule with custom field #16570

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CRM/Dedupe/BAO/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'";
}
Expand Down