4 * TODO: How to handle NULL values/records?
5 * Class CRM_Dedupe_BAO_QueryBuilder_IndividualSupervised
7 class CRM_Dedupe_BAO_QueryBuilder_IndividualSupervised
extends CRM_Dedupe_BAO_QueryBuilder
{
10 * Record - what do I do.
16 public static function record($rg) {
18 $civicrm_contact = CRM_Utils_Array
::value('civicrm_contact', $rg->params
, array());
19 $civicrm_email = CRM_Utils_Array
::value('civicrm_email', $rg->params
, array());
23 CRM_Utils_Array
::value('first_name', $civicrm_contact, ''),
27 CRM_Utils_Array
::value('last_name', $civicrm_contact, ''),
31 CRM_Utils_Array
::value('email', $civicrm_email, ''),
37 "civicrm_contact.{$rg->name}.{$rg->threshold}" => CRM_Core_DAO
::composeQuery("
38 SELECT contact.id as id1, {$rg->threshold} as weight
39 FROM civicrm_contact as contact
40 JOIN civicrm_email as email ON email.contact_id=contact.id
41 WHERE contact_type = 'Individual'
44 AND email = %3", $params, TRUE),
49 * Internal - what do I do.
55 public static function internal($rg) {
56 $query = self
::filterQueryByContactList($rg->contactIds
, "
57 SELECT contact1.id as id1, contact2.id as id2, {$rg->threshold} as weight
58 FROM civicrm_contact as contact1
59 JOIN civicrm_email as email1 ON email1.contact_id=contact1.id
60 JOIN civicrm_contact as contact2 ON
61 contact1.first_name = contact2.first_name AND
62 contact1.last_name = contact2.last_name
63 JOIN civicrm_email as email2 ON
64 email2.contact_id=contact2.id AND
65 email1.email=email2.email
66 WHERE contact1.contact_type = 'Individual'");
69 "civicrm_contact.{$rg->name}.{$rg->threshold}" => $query,