Details
-
Type: Bug
-
Status: Won't Do
-
Priority: Minor
-
Resolution: Won't Do
-
Affects Version/s: 4.4.6
-
Fix Version/s: Unscheduled
-
Component/s: None
-
Labels:None
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:None
Description
The logic for determining if a new contact should be created, or an existing contact updated from a event registration is hard-coded to only consider email address alone. CiviCRM is IGNORING the configuration for the dedup rule for "Individual Unsupervised". The result of this is that existing contacts are being incorrectly updated with data from an event registration simply because the email address of the participant matches an existing contact.
I developed a temporary fix in my environment by changing the file
"CRM/Dedupe/BAO/QueryBuilder/IndividualUnsupervised.php"
I changed the function named "record". This function seems hard-coded to only check on email address alone. (it ignores the rule configuration in the database.)
The SQL from that function is:
SELECT contact.id as id1, {$rg->threshold} as weight
FROM civicrm_contact as contact
JOIN civicrm_email as email ON email.contact_id=contact.id
WHERE contact_type = 'Individual'
AND email = %1
My updated version of the function:
$civicrm_email = CRM_Utils_Array::value('civicrm_email', $rg->params, array());
$params = array(
1 => array(CRM_Utils_Array::value('email', $civicrm_email, ''), 'String'),
);
$tmp_civicrm_contact_data = CRM_Utils_Array::value('civicrm_contact', $rg->params, array());
$tmp_first_name = CRM_Utils_Array::value('first_name', $tmp_civicrm_contact_data, array());
$tmp_last_name = CRM_Utils_Array::value('last_name', $tmp_civicrm_contact_data, array());
$tmp_sql = "SELECT contact.id as id1, {$rg->threshold} as weight
FROM civicrm_contact as contact
JOIN civicrm_email as email ON email.contact_id=contact.id
WHERE contact_type = 'Individual'
AND lower(email) = lower( %1 )
AND lower(first_name) = lower('$tmp_first_name')
AND lower(last_name) = lower('$tmp_last_name') ";
return array(
"civicrm_contact.{$rg->name}.{$rg->threshold}" => CRM_Core_DAO::composeQuery($tmp_sql, $params, TRUE),
);
FYI: In CiviCRM environments that deal with families, couples, parents and young children, its VERY common for 2 or more contacts to share an email address.
Not sure if this is connected to the issue at: https://issues.civicrm.org/jira/browse/CRM-14134