Towards CRM-20328 remove another call to the duplicate code
authoreileen <emcnaughton@wikimedia.org>
Tue, 28 Mar 2017 21:01:36 +0000 (10:01 +1300)
committereileen <emcnaughton@wikimedia.org>
Tue, 28 Mar 2017 21:31:37 +0000 (10:31 +1300)
CRM/Event/Form/Registration/Register.php

index 3cbfc64b9b320d5323f8b4bc29913a739797b384..798c3edc0e9de828d2ccdecee9482b314f9bc1a3 100644 (file)
@@ -95,21 +95,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
       $contactID = $self->getContactID();
     }
     if (!$contactID && is_array($fields) && $fields) {
-
-      //CRM-14134 use Unsupervised rule for everyone
-      $dedupeParams = CRM_Dedupe_Finder::formatParams($fields, 'Individual');
-
-      // disable permission based on cache since event registration is public page/feature.
-      $dedupeParams['check_permission'] = FALSE;
-
-      // find event dedupe rule
-      if (CRM_Utils_Array::value('dedupe_rule_group_id', $self->_values['event'], 0) > 0) {
-        $ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, 'Individual', 'Unsupervised', array(), $self->_values['event']['dedupe_rule_group_id']);
-      }
-      else {
-        $ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, 'Individual', 'Unsupervised');
-      }
-      $contactID = CRM_Utils_Array::value(0, $ids);
+      $contactID = CRM_Contact_BAO_Contact::getFirstDuplicateContact($fields, 'Individual', 'Unsupervised', array(), FALSE, CRM_Utils_Array::value('dedupe_rule_group_id', $self->_values['event']));
     }
     return $contactID;
   }