CRM-16417 follow up to refactor
authorEileen McNaughton <eileen@fuzion.co.nz>
Sun, 28 Jun 2015 06:30:29 +0000 (18:30 +1200)
committerEileen McNaughton <eileen@fuzion.co.nz>
Sun, 28 Jun 2015 06:30:29 +0000 (18:30 +1200)
CRM/Member/Form/MembershipRenewal.php

index 6a7a4d639474086589a68d47a44d41705e5ded0c..da0707198e1ba12142bb5c5006cefd492d9fd631 100644 (file)
@@ -611,26 +611,25 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
       $this->_params['is_pay_later'] = 1;
     }
 
+    // These variable sets prior to renewMembership may not be required for this form. They were in
+    // a function this form shared with other forms.
     $contributionRecurID = isset($this->_params['contributionRecurID']) ? $this->_params['contributionRecurID'] : NULL;
-
     $membershipSource = NULL;
-    if (!empty($form->_params['membership_source'])) {
-      $membershipSource = $form->_params['membership_source'];
-    }
-    elseif (isset($form->_values['title']) && !empty($form->_values['title'])) {
-      $membershipSource = ts('Online Contribution:') . ' ' . $form->_values['title'];
+    if (!empty($this->_params['membership_source'])) {
+      $membershipSource = $this->_params['membership_source'];
     }
     $isPayLater = NULL;
-    if (isset($form->_params)) {
-      $isPayLater = CRM_Utils_Array::value('is_pay_later', $form->_params);
+    if (isset($this->_params)) {
+      $isPayLater = CRM_Utils_Array::value('is_pay_later', $this->_params);
     }
     $campaignId = NULL;
-    if (isset($form->_values) && is_array($form->_values) && !empty($form->_values)) {
-      $campaignId = CRM_Utils_Array::value('campaign_id', $form->_params);
-      if (!array_key_exists('campaign_id', $form->_params)) {
-        $campaignId = CRM_Utils_Array::value('campaign_id', $form->_values);
+    if (isset($this->_values) && is_array($this->_values) && !empty($this->_values)) {
+      $campaignId = CRM_Utils_Array::value('campaign_id', $this->_params);
+      if (!array_key_exists('campaign_id', $this->_params)) {
+        $campaignId = CRM_Utils_Array::value('campaign_id', $this->_values);
       }
     }
+
     $renewMembership = CRM_Member_BAO_Membership::renewMembership(
       $this->_contactID, $formValues['membership_type_id'][1], $isTestMembership,
       $renewalDate, NULL, $customFieldsFormatted, $numRenewTerms, $this->_membershipId,