From 0f2b049efff05258eca438eda3d8522480ff2b23 Mon Sep 17 00:00:00 2001 From: eileenmcnaugton Date: Thu, 15 Oct 2015 21:43:17 +1300 Subject: [PATCH] Add comments about deprecation --- CRM/Contribute/Form/Contribution/Confirm.php | 11 ++++++++++- CRM/Contribute/Form/Contribution/Main.php | 1 + CRM/Contribute/Form/ContributionBase.php | 7 +++++++ CRM/Event/BAO/Event.php | 4 +++- CRM/Event/Form/Participant.php | 3 +++ CRM/Event/Form/Registration.php | 3 +++ CRM/Event/Form/Registration/Confirm.php | 5 +++++ CRM/Event/Form/Registration/Register.php | 6 ++---- 8 files changed, 34 insertions(+), 6 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 7d302e8461..1b68cbca31 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -505,6 +505,9 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr ); } else { + // The concept of contributeMode is deprecated. + // the is_monetary concept probably should be too as it can be calculated from + // the existence of 'amount' & seems fragile. if ($this->_contributeMode == 'notify' || !$this->_values['is_monetary'] || $this->_amount <= 0.0 || $this->_params['is_pay_later'] || ($this->_separateMembershipPayment && $this->_amount <= 0.0) @@ -1571,6 +1574,9 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr if (isset($membershipContributionID)) { $form->_values['contribution_id'] = $membershipContributionID; } + // The concept of contributeMode is deprecated. + // the is_monetary concept probably should be too as it can be calculated from + // the existence of 'amount' & seems fragile. if ($form->_contributeMode) { if ($form->_values['is_monetary'] && $form->_amount > 0.0 && !$form->_params['is_pay_later']) { // call postProcess hook before leaving @@ -1701,10 +1707,12 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr * We are moving towards always creating as pending and updating at the end (based on payment), so this should be * an interim refactoring. It was shared with another unrelated form & some parameters may not apply to this form. * - * * @return bool */ protected function getIsPending() { + // The concept of contributeMode is deprecated. + // the is_monetary concept probably should be too as it can be calculated from + // the existence of 'amount' & seems fragile. if (((isset($this->_contributeMode)) || !empty ($this->_params['is_pay_later']) ) && @@ -1828,6 +1836,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $form->_paymentProcessor = civicrm_api3('payment_processor', 'getsingle', array( 'id' => $params['payment_processor_id'], )); + // The concept of contributeMode is deprecated as is the billing_mode concept. if ($form->_paymentProcessor['billing_mode'] == 1) { $form->_contributeMode = 'direct'; } diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 051786be2d..5c01b79459 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -1163,6 +1163,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu !empty($this->_paymentProcessor) && ((float ) $params['amount'] > 0.0 || $memFee > 0.0) ) { + // The concept of contributeMode is deprecated - as should be the 'is_monetary' setting. $this->setContributeMode(); // Really this setting of $this->_params & params within it should be done earlier on in the function // probably the values determined here should be reused in confirm postProcess as there is no opportunity to alter anything diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index 0984975146..5967757f2d 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -182,6 +182,11 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { */ public $_useForMember; + /** + * @deprecated + * + * @var + */ public $_isBillingAddressRequiredForPayLater; /** @@ -554,6 +559,8 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { } } + // The concept of contributeMode is deprecated. + // The payment processor object can provide info about the fields it shows. if ($this->_contributeMode == 'direct' && $assignCCInfo) { if ($this->_paymentProcessor && $this->_paymentProcessor['payment_type'] & CRM_Core_Payment::PAYMENT_TYPE_DIRECT_DEBIT diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index d7653063ab..ce6cf4646d 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -1151,6 +1151,7 @@ WHERE civicrm_event.is_active = 1 'email' => $email, 'confirm_email_text' => CRM_Utils_Array::value('confirm_email_text', $values['event']), 'isShowLocation' => CRM_Utils_Array::value('is_show_location', $values['event']), + // The concept of contributeMode is deprecated. 'contributeMode' => CRM_Utils_Array::value('contributeMode', $template->_tpl_vars), 'participantID' => $participantId, 'conference_sessions' => $sessions, @@ -1186,12 +1187,13 @@ WHERE civicrm_event.is_active = 1 // address required during receipt processing (pdf and email receipt) if ($displayAddress = CRM_Utils_Array::value('address', $values)) { $sendTemplateParams['tplParams']['address'] = $displayAddress; + // The concept of contributeMode is deprecated. $sendTemplateParams['tplParams']['contributeMode'] = NULL; } // set lineItem details if ($lineItem = CRM_Utils_Array::value('lineItem', $values)) { - // check if additional prticipant, if so filter only to relevant ones + // check if additional participant, if so filter only to relevant ones // CRM-9902 if (!empty($values['params']['additionalParticipant'])) { $ownLineItems = array(); diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index 05e0822f87..4c776e58a3 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -153,6 +153,8 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment /** * Contribution mode for event registration for offline mode. + * + * @deprecated */ public $_contributeMode = 'direct'; @@ -1571,6 +1573,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment CRM_Utils_System::mungeCreditCard($params['credit_card_number']) ); $this->assign('credit_card_type', $params['credit_card_type']); + // The concept of contributeMode is deprecated. $this->assign('contributeMode', 'direct'); $this->assign('isAmountzero', 0); $this->assign('is_pay_later', 0); diff --git a/CRM/Event/Form/Registration.php b/CRM/Event/Form/Registration.php index f37433b2c9..f600b1a181 100644 --- a/CRM/Event/Form/Registration.php +++ b/CRM/Event/Form/Registration.php @@ -370,6 +370,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { ); CRM_Utils_System::redirect($url); } + // The concept of contributeMode is deprecated. $this->_contributeMode = $this->get('contributeMode'); $this->assign('contributeMode', $this->_contributeMode); @@ -491,6 +492,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $this->assign('address', CRM_Utils_Address::format($addressFields)); + // The concept of contributeMode is deprecated. if ($this->_contributeMode == 'direct' && empty($params['is_pay_later'])) { $date = CRM_Utils_Date::format(CRM_Utils_Array::value('credit_card_exp_date', $params)); $date = CRM_Utils_Date::mysqlToIso($date); @@ -767,6 +769,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { } //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); diff --git a/CRM/Event/Form/Registration/Confirm.php b/CRM/Event/Form/Registration/Confirm.php index 4cca3d8e3e..8e32b256c5 100644 --- a/CRM/Event/Form/Registration/Confirm.php +++ b/CRM/Event/Form/Registration/Confirm.php @@ -81,6 +81,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $this->assign('hookDiscount', $this->_params[0]['discount']); } + // The concept of contributeMode is deprecated. if ($this->_contributeMode == 'express') { $params = array(); // rfp == redirect from paypal @@ -597,6 +598,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { if (!empty($value['is_pay_later']) || $value['amount'] == 0 || + // The concept of contributeMode is deprecated. $this->_contributeMode == 'checkout' || $this->_contributeMode == 'notify' ) { @@ -787,6 +789,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { } // for Transfer checkout. + // The concept of contributeMode is deprecated. if (($this->_contributeMode == 'checkout' || $this->_contributeMode == 'notify' ) && empty($params[0]['is_pay_later']) && @@ -1052,6 +1055,8 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { } //create an contribution address + // The concept of contributeMode is deprecated. Elsewhere we use the function processBillingAddress() - although + // currently that is only inherited by back-office forms. if ($form->_contributeMode != 'notify' && empty($params['is_pay_later'])) { $contribParams['address_id'] = CRM_Contribute_BAO_Contribution::createAddress($params, $form->_bltID); } diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index 6d39361aa9..02fd952d93 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -926,9 +926,6 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { /** * Process the form submission. - * - * - * @return void */ public function postProcess() { // get the submitted form values. @@ -1103,7 +1100,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { ) { $this->handlePreApproval($params); - + // The concept of contributeMode is deprecated - but still needs removal from the message templates. $this->set('contributeMode', 'express'); // Send Event Name & Id in Params @@ -1141,6 +1138,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { elseif ($this->_paymentProcessor && $this->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_NOTIFY ) { + // The concept of contributeMode is deprecated - but still needs removal from the message templates. $this->set('contributeMode', 'notify'); } } -- 2.25.1