Details

    • Type: Sub-task
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.16
    • Fix Version/s: 4.7.19
    • Component/s: Dedupe
    • Labels:
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code
    • Verified?:
      No

      Description

      There are many calls to variations of this bit of code....

      • // dupeCheck - check if contact record already exists
      • // code modified from api/v2/Contact.php-function civicrm_contact_check_params()
      • $params['contact_type'] = $this->_ctype;
      • $dedupeParams = CRM_Dedupe_Finder::formatParams($params, $params['contact_type']);
      • $dedupeParams['check_permission'] = '';
      • //dupesByParams($params, $ctype, $level = 'Unsupervised', $except = array())
      • $ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, $params['contact_type']);

      I intend to rationalise it to this
      $ids = CRM_Contact_BAO_Contact::getDuplicateContacts($params, $this->_ctype, 'Unsupervised', array(), FALSE);

      In many cases the result is then parsed for the first id, it any. I intend to reduce that to

      • // add contact using dedupe rule
      • $dedupeParams = CRM_Dedupe_Finder::formatParams($params, 'Individual');
      • $dedupeParams['check_permission'] = FALSE;
      • $dupeIds = CRM_Dedupe_Finder::dupesByParams($dedupeParams, 'Individual');
      • // if we find more than one contact, use the first one
      • if (!empty($dupeIds[0])) { - $params['contact_id'] = $dupeIds[0]; - }

      + $params['contact_id'] = CRM_Contact_BAO_Contact::getFirstDuplicateContact($params, 'Individual', 'Unsupervised', array(), FALSE);

        Attachments

          Activity

            People

            • Assignee:
              eileen Eileen McNaughton
              Reporter:
              eileen Eileen McNaughton
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: