From c0f73fabd7b24a2d31d80242c863f0a4a57f8b72 Mon Sep 17 00:00:00 2001 From: eileen Date: Wed, 9 Oct 2019 10:12:02 +0200 Subject: [PATCH] [REF] move definition of important values & retrieval outside payment-object 'if' clauses The concepts of billingMode is deprecated - goal is not to have separate handling for each one --- CRM/Event/Form/Registration.php | 9 ++------- CRM/Event/Form/Registration/Confirm.php | 17 +++++++++-------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/CRM/Event/Form/Registration.php b/CRM/Event/Form/Registration.php index 2ac4111730..d0c51c7722 100644 --- a/CRM/Event/Form/Registration.php +++ b/CRM/Event/Form/Registration.php @@ -725,6 +725,8 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { // CRM-10032 $this->processFirstParticipant($participant->id); } + $this->_params['participantID'] = $participant->id; + $this->set('primaryParticipant', $this->_params); CRM_Core_BAO_CustomValueTable::postProcess($this->_params, 'civicrm_participant', @@ -752,13 +754,6 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $paymentPartcipant = CRM_Event_BAO_ParticipantPayment::create($paymentParams); } - //set only primary participant's params for transfer checkout. - // The concept of contributeMode is deprecated. - if (($this->_contributeMode == 'checkout' || $this->_contributeMode == 'notify') && !empty($this->_params['is_primary'])) { - $this->_params['participantID'] = $participant->id; - $this->set('primaryParticipant', $this->_params); - } - $this->assign('action', $this->_action); // create CMS user diff --git a/CRM/Event/Form/Registration/Confirm.php b/CRM/Event/Form/Registration/Confirm.php index 05b5aa02ae..6076724b3d 100644 --- a/CRM/Event/Form/Registration/Confirm.php +++ b/CRM/Event/Form/Registration/Confirm.php @@ -737,6 +737,15 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $isTest = TRUE; } + $primaryParticipant = $this->get('primaryParticipant'); + + if (empty($primaryParticipant['participantID'])) { + CRM_Core_Error::deprecatedFunctionWarning('This line is not logically reachable.'); + $primaryParticipant['participantID'] = $registerByID; + } + //otherwise send mail Confirmation/Receipt + $primaryContactId = $this->get('primaryContactId'); + // for Transfer checkout. // The concept of contributeMode is deprecated. if (($this->_contributeMode == 'checkout' || @@ -746,12 +755,6 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $this->_totalAmount > 0 ) { - $primaryParticipant = $this->get('primaryParticipant'); - - if (empty($primaryParticipant['participantID'])) { - $primaryParticipant['participantID'] = $registerByID; - } - //build an array of custom profile and assigning it to template $customProfile = CRM_Event_BAO_Event::buildCustomProfile($registerByID, $this->_values, NULL, $isTest); if (count($customProfile)) { @@ -826,8 +829,6 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { } } else { - //otherwise send mail Confirmation/Receipt - $primaryContactId = $this->get('primaryContactId'); //build an array of cId/pId of participants $additionalIDs = CRM_Event_BAO_Event::buildCustomProfile($registerByID, -- 2.25.1