Skip to content

Commit

Permalink
Towards CRM-20328 remove over-loading from checkRegistration function
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Mar 28, 2017
1 parent 7b64dc8 commit 7dfe13a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CRM/Event/Form/Registration/AdditionalParticipant.php
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ public function postProcess() {

if (!$this->_allowConfirmation) {
// check if the participant is already registered
$params['contact_id'] = CRM_Event_Form_Registration_Register::checkRegistration($params, $this, TRUE, TRUE);
$params['contact_id'] = CRM_Event_Form_Registration_Register::getRegistrationContactID($params, $this, TRUE);
}

//carry campaign to partcipants.
Expand Down
20 changes: 5 additions & 15 deletions CRM/Event/Form/Registration/Register.php
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ public function postProcess() {
if (!$this->_allowConfirmation) {
// check if the participant is already registered
if (!$this->_skipDupeRegistrationCheck) {
$params['contact_id'] = self::checkRegistration($params, $this, FALSE, TRUE, TRUE);
$params['contact_id'] = self::getRegistrationContactID($params, $this, FALSE);
}
}

Expand Down Expand Up @@ -1176,30 +1176,20 @@ public function postProcess() {
* Event data.
* @param bool $isAdditional
* Treat isAdditional participants a bit differently.
* @param bool $returnContactId
* Just find and return the contactID match to use.
* @param bool $useDedupeRules
* Force usage of dedupe rules.
*
* @return int
*/
public static function checkRegistration($fields, &$self, $isAdditional = FALSE, $returnContactId = FALSE, $useDedupeRules = FALSE) {
public static function checkRegistration($fields, &$self, $isAdditional = FALSE) {
// CRM-3907, skip check for preview registrations
// CRM-4320 participant need to walk wizard
if (!$returnContactId &&
if (
($self->_mode == 'test' || $self->_allowConfirmation)
) {
return FALSE;
}

$contactID = self::getRegistrationContactID($fields, $self, $isAdditional);

if ($returnContactId) {
// CRM-7377
// return contactID if contact already exists
return $contactID;
}

if ($contactID) {
$participant = new CRM_Event_BAO_Participant();
$participant->contact_id = $contactID;
Expand All @@ -1224,7 +1214,7 @@ public static function checkRegistration($fields, &$self, $isAdditional = FALSE,
}

$status = ts("It looks like you are already registered for this event. If you want to change your registration, or you feel that you've received this message in error, please contact the site administrator.") . ' ' . ts('You can also <a href="%1">register another participant</a>.', array(1 => $registerUrl));
$session->setStatus($status, ts('Oops.'), 'alert');
CRM_Core_Session::singleton()->setStatus($status, ts('Oops.'), 'alert');
$url = CRM_Utils_System::url('civicrm/event/info',
"reset=1&id={$self->_values['event']['id']}&noFullMsg=true"
);
Expand All @@ -1241,7 +1231,7 @@ public static function checkRegistration($fields, &$self, $isAdditional = FALSE,

if ($isAdditional) {
$status = ts("It looks like this participant is already registered for this event. If you want to change your registration, or you feel that you've received this message in error, please contact the site administrator.");
$session->setStatus($status, ts('Oops.'), 'alert');
CRM_Core_Session::singleton()->setStatus($status, ts('Oops.'), 'alert');
return $participant->id;
}
}
Expand Down

0 comments on commit 7dfe13a

Please sign in to comment.