Add comments about deprecation
authoreileenmcnaugton <eileen@fuzion.co.nz>
Thu, 15 Oct 2015 08:43:17 +0000 (21:43 +1300)
committereileenmcnaugton <eileen@fuzion.co.nz>
Thu, 15 Oct 2015 08:44:21 +0000 (21:44 +1300)
CRM/Contribute/Form/Contribution/Confirm.php
CRM/Contribute/Form/Contribution/Main.php
CRM/Contribute/Form/ContributionBase.php
CRM/Event/BAO/Event.php
CRM/Event/Form/Participant.php
CRM/Event/Form/Registration.php
CRM/Event/Form/Registration/Confirm.php
CRM/Event/Form/Registration/Register.php

index 7d302e84614b3bf85217d880206f4e6b8dc0cd1a..1b68cbca3164a1e717d00547ed3f44d723ed285d 100644 (file)
@@ -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';
       }
index 051786be2d595f243c90b6b55719d10ae679a68c..5c01b79459bd816d1f07c07364ad767f58522c93 100644 (file)
@@ -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
index 0984975146baa66f06509b6bc4af394e4f249736..5967757f2d515349b3a02fdcd9a3fb7b6cc599be 100644 (file)
@@ -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
index d7653063ab0e280cae4baa250ae3439fd44d7b60..ce6cf4646de843cb893141d6ed4e5d2c0673df20 100644 (file)
@@ -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();
index 05e0822f87e7926b9818b2d06550dd478507c748..4c776e58a36c5346dbef9445a673532eea6e375b 100644 (file)
@@ -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);
index f37433b2c9a4a1e0b295cc855fd74a1dcb1833a1..f600b1a1817c91a5b5123caeba02f0ece1a7192d 100644 (file)
@@ -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);
index 4cca3d8e3e99870e51032a47edde80a9bfdc9606..8e32b256c543e230cbaa504160118b52f68670be 100644 (file)
@@ -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);
     }
index 6d39361aa95d0c53ad6eed46b02bef5d72b5e9d3..02fd952d938775cf5684501cdc02df749bc77bcb 100644 (file)
@@ -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');
       }
     }