From a6513ad565d4d8fb76009b8336f7b3caca648899 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 14 Nov 2014 05:09:30 +1300 Subject: [PATCH] CRM-15555 remove last instances of refs to hard-coded payment field types --- CRM/Contribute/Form/AbstractEditPayment.php | 3 + CRM/Contribute/Form/UpdateBilling.php | 18 +- CRM/Core/Payment/Form.php | 181 +------------------- CRM/Event/Cart/BAO/MerParticipant.php | 2 +- CRM/Event/Cart/Form/Checkout/Payment.php | 5 +- CRM/Event/Form/EventFees.php | 2 +- CRM/Event/Form/Registration.php | 6 +- CRM/Member/Form.php | 42 +++++ CRM/Member/Form/Membership.php | 35 +--- CRM/Member/Form/MembershipRenewal.php | 38 +--- 10 files changed, 67 insertions(+), 265 deletions(-) diff --git a/CRM/Contribute/Form/AbstractEditPayment.php b/CRM/Contribute/Form/AbstractEditPayment.php index 1546dc51ee..60df3ced40 100644 --- a/CRM/Contribute/Form/AbstractEditPayment.php +++ b/CRM/Contribute/Form/AbstractEditPayment.php @@ -46,6 +46,9 @@ class CRM_Contribute_Form_AbstractEditPayment extends CRM_Core_Form { public $_fields; + /** + * @var array current payment processor including a copy of the object in 'object' key + */ public $_paymentProcessor; public $_recurPaymentProcessors; diff --git a/CRM/Contribute/Form/UpdateBilling.php b/CRM/Contribute/Form/UpdateBilling.php index cf03cf65cd..ea233ce446 100644 --- a/CRM/Contribute/Form/UpdateBilling.php +++ b/CRM/Contribute/Form/UpdateBilling.php @@ -34,7 +34,7 @@ */ /** - * This class generates form components for processing a ontribution + * This class generates form components for processing a contribution * */ class CRM_Contribute_Form_UpdateBilling extends CRM_Core_Form { @@ -47,7 +47,11 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Core_Form { protected $_selfService = FALSE; public $_bltID = NULL; - public $_paymentProcessor = NULL; + + /** + * @var array current payment processor including a copy of the object in 'object' key + */ + public $_paymentProcessor = array(); public $_paymentProcessorObj = NULL; @@ -74,13 +78,13 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Core_Form { $this->_coid = CRM_Utils_Request::retrieve('coid', 'Integer', $this, FALSE); if ($this->_coid) { $this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_coid, 'contribute', 'info'); - $this->_paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_coid, 'contribute', 'obj'); + $this->_paymentProcessor['object'] = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_coid, 'contribute', 'obj'); $this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_coid, 'contribution'); } if ($this->_mid) { $this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_mid, 'membership', 'info'); - $this->_paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_mid, 'membership', 'obj'); + $this->_paymentProcessor['object'] = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_mid, 'membership', 'obj'); $this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_mid, 'membership'); $membershipTypes = CRM_Member_PseudoConstant::membershipType(); $membershipTypeId = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_mid, 'membership_type_id'); @@ -101,9 +105,9 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Core_Form { $this->_selfService = TRUE; } - if (!$this->_paymentProcessorObj->isSupported('updateSubscriptionBillingInfo')) { + if (!$this->_paymentProcessor['object']->isSupported('updateSubscriptionBillingInfo')) { CRM_Core_Error::fatal(ts("%1 processor doesn't support updating subscription billing details.", - array(1 => $this->_paymentProcessorObj->_processorName) + array(1 => $this->_paymentProcessor['object']->_processorName) )); } $this->assign('paymentProcessor', $this->_paymentProcessor); @@ -205,7 +209,7 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Core_Form { ) ); - CRM_Core_Payment_Form::buildCreditCard($this); + CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor['object'], TRUE); $this->addFormRule(array('CRM_Contribute_Form_UpdateBilling', 'formRule'), $this); } diff --git a/CRM/Core/Payment/Form.php b/CRM/Core/Payment/Form.php index 7d618e0ef9..e33623631f 100644 --- a/CRM/Core/Payment/Form.php +++ b/CRM/Core/Payment/Form.php @@ -176,65 +176,6 @@ class CRM_Core_Payment_Form { )); } - /** - * create all fields needed for a credit card transaction - * @deprecated - use the setPaymentFieldsByProcessor which leverages the processor to determine the fields - * @param CRM_Core_Form $form - * - * @return void - * @access public - */ - static function setCreditCardFields(&$form) { - CRM_Core_Payment_Form::setBillingDetailsFields($form); - - $form->_paymentFields['credit_card_number'] = array( - 'htmlType' => 'text', - 'name' => 'credit_card_number', - 'title' => ts('Card Number'), - 'cc_field' => TRUE, - 'attributes' => array('size' => 20, 'maxlength' => 20, 'autocomplete' => 'off'), - 'is_required' => TRUE, - ); - - $form->_paymentFields['cvv2'] = array( - 'htmlType' => 'text', - 'name' => 'cvv2', - 'title' => ts('Security Code'), - 'cc_field' => TRUE, - 'attributes' => array('size' => 5, 'maxlength' => 10, 'autocomplete' => 'off'), - 'is_required' => CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, - 'cvv_backoffice_required', - NULL - ,1 - ), - ); - - $form->_paymentFields['credit_card_exp_date'] = array( - 'htmlType' => 'date', - 'name' => 'credit_card_exp_date', - 'title' => ts('Expiration Date'), - 'cc_field' => TRUE, - 'attributes' => CRM_Core_SelectValues::date('creditCard'), - 'is_required' => TRUE, - ); - - $creditCardType = array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::creditCard(); - $form->_paymentFields['credit_card_type'] = array( - 'htmlType' => 'select', - 'name' => 'credit_card_type', - 'title' => ts('Card Type'), - 'cc_field' => TRUE, - 'attributes' => $creditCardType, - 'is_required' => FALSE, - ); - //CRM-15509 this is probably a temporary resting place for these form assignments but we are working towards putting this - // in an option group & having php / payment processors define the billing form rather than the tpl - $smarty = CRM_Core_Smarty::singleton(); - $smarty->assign('paymentTypeName', 'credit_card'); - $smarty->assign('paymentTypeLabel', ts('Credit Card Information')); - $smarty->assign('paymentFields', self::getPaymentFields($form->_paymentProcessor)); - } - /** * @param CRM_Core_Form $form * @param bool $useRequired @@ -258,63 +199,6 @@ class CRM_Core_Payment_Form { } } - /** - * create all fields needed for direct debit transaction - * @deprecated - use the setPaymentFieldsByProcessor which leverages the processor to determine the fields - * @param $form - * - * @return void - * @access public - */ - static function setDirectDebitFields(&$form) { - CRM_Core_Payment_Form::setBillingDetailsFields($form); - - $form->_paymentFields['account_holder'] = array( - 'htmlType' => 'text', - 'name' => 'account_holder', - 'title' => ts('Account Holder'), - 'cc_field' => TRUE, - 'attributes' => array('size' => 20, 'maxlength' => 34, 'autocomplete' => 'on'), - 'is_required' => TRUE, - ); - - //e.g. IBAN can have maxlength of 34 digits - $form->_paymentFields['bank_account_number'] = array( - 'htmlType' => 'text', - 'name' => 'bank_account_number', - 'title' => ts('Bank Account Number'), - 'cc_field' => TRUE, - 'attributes' => array('size' => 20, 'maxlength' => 34, 'autocomplete' => 'off'), - 'is_required' => TRUE, - ); - - //e.g. SWIFT-BIC can have maxlength of 11 digits - $form->_paymentFields['bank_identification_number'] = array( - 'htmlType' => 'text', - 'name' => 'bank_identification_number', - 'title' => ts('Bank Identification Number'), - 'cc_field' => TRUE, - 'attributes' => array('size' => 20, 'maxlength' => 11, 'autocomplete' => 'off'), - 'is_required' => TRUE, - ); - - $form->_paymentFields['bank_name'] = array( - 'htmlType' => 'text', - 'name' => 'bank_name', - 'title' => ts('Bank Name'), - 'cc_field' => TRUE, - 'attributes' => array('size' => 20, 'maxlength' => 64, 'autocomplete' => 'off'), - 'is_required' => TRUE, - ); - //CRM-15509 this is probably a temporary resting place for these form assignments but we are working towards putting this - // in an option group & having php / payment processors define the billing form rather than the tpl - $smarty = CRM_Core_Smarty::singleton(); - // replace these payment type names with an option group - moving name & label assumptions out of the tpl is a step towards that - $smarty->assign('paymentTypeName', 'direct_debit'); - $smarty->assign('paymentTypeLabel', ts('Direct Debit Information')); - $smarty->assign('paymentFields', self::getPaymentFields($form->_paymentProcessor)); - } - /** * @param array $paymentProcessor * @todo it will be necessary to set details that affect it - mostly likely take Country as a param. Should we add generic @@ -358,7 +242,7 @@ class CRM_Core_Payment_Form { } /** - * @param CRM_Contribute_Form_AbstractEditPayment|CRM_Contribute_Form_Contribution_Main|CRM_Core_Payment_ProcessorForm $form + * @param CRM_Contribute_Form_AbstractEditPayment|CRM_Contribute_Form_Contribution_Main|CRM_Core_Payment_ProcessorForm|CRM_Contribute_Form_UpdateBilling $form * @param array $processor array of properties including 'object' as loaded from CRM_Financial_BAO_PaymentProcessor::getPaymentProcessors * @param bool $isBillingDataOptional This manifests for 'NULL' (pay later) payment processor as the addition of billing fields to the form and * for payment processors that gather payment data on site as rendering the fields as not being required. (not entirely sure why but this @@ -427,43 +311,6 @@ class CRM_Core_Payment_Form { } } } - /** - * Function to add all the credit card fields - * @deprecated Use BuildPaymentForm - * @param $form - * @param bool $useRequired - * - * @return void - * @access public - */ - static function buildCreditCard(&$form, $useRequired = FALSE) { - if ($form->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_FORM) { - self::setCreditCardFields($form); - self::addCommonFields($form, $useRequired, $form->_paymentFields); - - $form->addRule('cvv2', - ts('Please enter a valid value for your card security code. This is usually the last 3-4 digits on the card\'s signature panel.'), - 'integer' - ); - - $form->addRule('credit_card_exp_date', - ts('Card expiration date cannot be a past date.'), - 'currentDate', TRUE - ); - - } - - - if ($form->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_BUTTON) { - $form->_expressButtonName = $form->getButtonName('upload', 'express'); - $form->assign('expressButtonName', $form->_expressButtonName); - $form->add('image', - $form->_expressButtonName, - $form->_paymentProcessor['url_button'], - array('class' => 'crm-form-submit') - ); - } - } /** * The credit card pseudo constant results only the CC label, not the key ID @@ -483,32 +330,6 @@ class CRM_Core_Payment_Form { return $creditCardTypes; } - /** - * Function to add all the direct debit fields - * @deprecated use buildPaymentForm - * - * @param $form - * @param bool $useRequired - * @return void - * @access public - */ - static function buildDirectDebit(&$form, $useRequired = FALSE) { - if ($form->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_FORM) { - self::setDirectDebitFields($form); - self::addCommonFields($form, $useRequired, $form->_paymentFields); - - $form->addRule('bank_identification_number', - ts('Please enter a valid Bank Identification Number (value must not contain punctuation characters).'), - 'nopunctuation' - ); - - $form->addRule('bank_account_number', - ts('Please enter a valid Bank Account Number (value must not contain punctuation characters).'), - 'nopunctuation' - ); - } - } - /** * Make sure that credit card number and cvv are valid * Called within the scope of a QF formRule function diff --git a/CRM/Event/Cart/BAO/MerParticipant.php b/CRM/Event/Cart/BAO/MerParticipant.php index 3ab862bef1..3e4c3bdbb8 100644 --- a/CRM/Event/Cart/BAO/MerParticipant.php +++ b/CRM/Event/Cart/BAO/MerParticipant.php @@ -51,7 +51,7 @@ class CRM_Event_Cart_BAO_MerParticipant extends CRM_Event_BAO_Participant { * @return CRM_Event_Cart_BAO_MerParticipant * @throws Exception */ - public static function &create($params) { + static function create(&$params) { $participantParams = array( 'id' => CRM_Utils_Array::value('id', $params), 'role_id' => self::get_attendee_role_id(), diff --git a/CRM/Event/Cart/Form/Checkout/Payment.php b/CRM/Event/Cart/Form/Checkout/Payment.php index decef950de..e145f6a604 100644 --- a/CRM/Event/Cart/Form/Checkout/Payment.php +++ b/CRM/Event/Cart/Form/Checkout/Payment.php @@ -160,8 +160,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { $this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($payment_processor_id, $this->_mode); $this->assign('paymentProcessor', $this->_paymentProcessor); - CRM_Core_Payment_Form::setCreditCardFields($this); - CRM_Core_Payment_Form::buildCreditCard($this); + CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, FALSE); if ($can_pay_later || self::is_administrator()) { $this->addElement('checkbox', 'is_pay_later', @@ -393,7 +392,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { $errors = array(); if ($self->payment_required && empty($self->_submitValues['is_pay_later'])) { - $payment = &CRM_Core_Payment::singleton($self->_mode, $self->_paymentProcessor, $this); + $payment = CRM_Core_Payment::singleton($self->_mode, $self->_paymentProcessor, CRM_Core_DAO::$_nullObject); $error = $payment->checkConfig($self->_mode); if ($error) { $errors['_qf_default'] = $error; diff --git a/CRM/Event/Form/EventFees.php b/CRM/Event/Form/EventFees.php index de19ab6ab8..81b88772bb 100644 --- a/CRM/Event/Form/EventFees.php +++ b/CRM/Event/Form/EventFees.php @@ -410,7 +410,7 @@ SELECT id, html_type } } if ($form->_mode) { - CRM_Core_Payment_Form::buildCreditCard($form, TRUE); + CRM_Core_Payment_Form::buildPaymentForm($form, $form->_processor, FALSE); } elseif (!$form->_mode) { $form->addElement('checkbox', 'record_contribution', ts('Record Payment?'), NULL, diff --git a/CRM/Event/Form/Registration.php b/CRM/Event/Form/Registration.php index d97abac8e9..fdac42ca8a 100644 --- a/CRM/Event/Form/Registration.php +++ b/CRM/Event/Form/Registration.php @@ -400,10 +400,8 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { } $this->set('bltID', $this->_bltID); - if ($this->_values['event']['is_monetary'] && - ($this->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_FORM) - ) { - CRM_Core_Payment_Form::setCreditCardFields($this); + if ($this->_values['event']['is_monetary']) { + CRM_Core_Payment_Form::setPaymentFieldsByProcessor($this, $this->_paymentProcessor); } $params = array('entity_id' => $this->_eventId, 'entity_table' => 'civicrm_event'); $this->_values['location'] = CRM_Core_BAO_Location::getValues($params, TRUE); diff --git a/CRM/Member/Form.php b/CRM/Member/Form.php index b832a56c04..6233cf049d 100644 --- a/CRM/Member/Form.php +++ b/CRM/Member/Form.php @@ -46,8 +46,38 @@ class CRM_Member_Form extends CRM_Contribute_Form_AbstractEditPayment { */ public $_id; + /** + * Membership Type ID + * @var + */ + protected $_memType; + + /** + * Array of from email ids + * @var array + */ + protected $_fromEmails = array(); + function preProcess() { + $this->_action = CRM_Utils_Request::retrieve('action', 'String',$this, FALSE, 'add'); + $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'membership'); + $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); + $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this); + $this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this); + + $this->assign('context', $this->_context); + $this->assign('membershipMode', $this->_mode); + $this->assign('contactID', $this->_contactID); + if ($this->_mode) { + $this->assignPaymentRelatedVariables(); + } + + if ($this->_id) { + $this->_memType = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_id, 'membership_type_id'); + $this->_membershipIDs[] = $this->_id; + } + $this->_fromEmails = CRM_Core_BAO_Email::getFromEmail(); } /** @@ -60,6 +90,10 @@ class CRM_Member_Form extends CRM_Contribute_Form_AbstractEditPayment { */ function setDefaultValues() { $defaults = array(); + if (isset($this->_id)) { + $params = array('id' => $this->_id); + CRM_Member_BAO_Membership::retrieve($params, $defaults); + } if (isset($defaults['minimum_fee'])) { $defaults['minimum_fee'] = CRM_Utils_Money::format($defaults['minimum_fee'], NULL, '%a'); @@ -90,6 +124,14 @@ class CRM_Member_Form extends CRM_Contribute_Form_AbstractEditPayment { * @access public */ public function buildQuickForm() { + if ($this->_mode) { + $this->add('select', 'payment_processor_id', + ts('Payment Processor'), + $this->_processors, TRUE, + array('onChange' => "buildAutoRenew( null, this.value );") + ); + CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, TRUE); + } if ($this->_action & CRM_Core_Action::RENEW) { $this->addButtons(array( array( diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index a410a8f644..d5f9ae4a1b 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -111,17 +111,12 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { return CRM_Custom_Form_CustomData::preProcess($this); } + parent::preProcess(); // get price set id. $this->_priceSetId = CRM_Utils_Array::value('priceSetId', $_GET); $this->set('priceSetId', $this->_priceSetId); $this->assign('priceSetId', $this->_priceSetId); - // action - $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add'); - $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); - $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this); - $this->_processors = array(); - $this->assign('contactID', $this->_contactID); // check for edit permission if (!CRM_Core_Permission::checkActionPermission('CiviMember', $this->_action)) { @@ -136,21 +131,6 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { } } - $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this); - $this->assign('context', $this->_context); - - if ($this->_id) { - $this->_memType = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_id, 'membership_type_id'); - $this->_membershipIDs[] = $this->_id; - } - - $this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this); - $this->assign('membershipMode', $this->_mode); - - if ($this->_mode) { - $this->assignPaymentRelatedVariables(); - } - if ($this->_action & CRM_Core_Action::ADD) { if (!CRM_Member_BAO_Membership::statusAvailabilty($this->_contactID)) { // all possible statuses are disabled - redirect back to contact form @@ -222,12 +202,8 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { ); } $this->assign('onlinePendingContributionId', $this->_onlinePendingContributionId); - $this->_fromEmails = CRM_Core_BAO_Email::getFromEmail(); $this->setPageTitle(ts('Membership')); - - - parent::preProcess(); } /** @@ -715,15 +691,6 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; $this->add('select', 'from_email_address', ts('Receipt From'), $this->_fromEmails); $this->add('textarea', 'receipt_text_signup', ts('Receipt Message')); - if ($this->_mode) { - - $this->add('select', 'payment_processor_id', - ts('Payment Processor'), - $this->_processors, TRUE, - array('onChange' => "buildAutoRenew( null, this.value );") - ); - CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, TRUE); - } // Retrieve the name and email of the contact - this will be the TO for receipt email if ($this->_contactID) { diff --git a/CRM/Member/Form/MembershipRenewal.php b/CRM/Member/Form/MembershipRenewal.php index 60a3df7528..f0271a4f21 100644 --- a/CRM/Member/Form/MembershipRenewal.php +++ b/CRM/Member/Form/MembershipRenewal.php @@ -91,26 +91,11 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { return CRM_Custom_Form_CustomData::preProcess($this); } + parent::preProcess(); // check for edit permission if (!CRM_Core_Permission::check('edit memberships')) { CRM_Core_Error::fatal(ts('You do not have permission to access this page')); } - // action - $this->_action = CRM_Utils_Request::retrieve('action', 'String', - $this, FALSE, 'add' - ); - $this->_context = CRM_Utils_Request::retrieve('context', 'String', - $this, FALSE, 'membership' - ); - $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', - $this - ); - $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', - $this - ); - if ($this->_id) { - $this->_memType = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_id, 'membership_type_id'); - } $this->assign('endDate', CRM_Utils_Date::customFormat(CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_id, 'end_date' @@ -125,24 +110,15 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { ) ); - //using credit card :: CRM-2759 - $this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this); if ($this->_mode) { $membershipFee = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_memType, 'minimum_fee'); if (!$membershipFee) { - $statusMsg = ts('Membership Renewal using a credit card requires a Membership fee. Since there is no fee associated with the selected memebership type, you can use the normal renewal mode.'); + $statusMsg = ts('Membership Renewal using a credit card requires a Membership fee. Since there is no fee associated with the selected membership type, you can use the normal renewal mode.'); CRM_Core_Session::setStatus($statusMsg, '', 'info'); CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view/membership', "reset=1&action=renew&cid={$this->_contactID}&id={$this->_id}&context=membership" )); } - $this->assign('membershipMode', $this->_mode); - $this->assignPaymentRelatedVariables(); - $validProcessors = array(); - $processors = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, 'billing_mode IN ( 1, 3 )'); - } - else { - $this->assign('membershipMode', FALSE); } // when custom data is included in this page @@ -152,8 +128,6 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { CRM_Custom_Form_CustomData::setDefaultValues($this); } - $this->_fromEmails = CRM_Core_BAO_Email::getFromEmail(); - CRM_Utils_System::setTitle(ts('Renew Membership')); parent::preProcess(); @@ -171,7 +145,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { if ($this->_cdType) { return CRM_Custom_Form_CustomData::setDefaultValues($this); } - $defaults = array(); + $defaults = parent::setDefaultValues(); $this->_memType = $defaults['membership_type_id']; @@ -282,7 +256,6 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { parent::buildQuickForm(); - $defaults = array(); $defaults = parent::setDefaultValues(); $this->_memType = $defaults['membership_type_id']; $this->assign('customDataType', 'Membership'); @@ -450,11 +423,6 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; $this->add('textarea', 'receipt_text_renewal', ts('Renewal Message')); - if ($this->_mode) { - $this->add('select', 'payment_processor_id', ts('Payment Processor'), $this->_processors, TRUE); - CRM_Core_Payment_Form::buildCreditCard($this, TRUE); - } - // Retrieve the name and email of the contact - this will be the TO for receipt email list($this->_contributorDisplayName, $this->_contributorEmail -- 2.25.1