/*
* Contact ID of the member
*/
- protected $_contactID = null;
+ public $_contactID = null;
/*
* Display name of the person paying for the membership (used for receipts)
*/
* context would be set to standalone if the contact is use is being selected from
* the form rather than in the URL
*/
- protected $_context;
+ public $_context;
/**
* An array to hold a list of datefields on the 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');
+ CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
}
$this->assign('endDate', CRM_Utils_Date::customFormat(CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership',
)
);
- //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->_paymentProcessor = array('billing_mode' => 1);
- $validProcessors = array();
- $processors = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, 'billing_mode IN ( 1, 3 )');
-
- foreach ($processors as $ppID => $label) {
- $paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($ppID, $this->_mode);
- if ($paymentProcessor['payment_processor_type'] == 'PayPal' && !$paymentProcessor['user_name']) {
- continue;
- }
- elseif ($paymentProcessor['payment_processor_type'] == 'Dummy' && $this->_mode == 'live') {
- continue;
- }
- else {
- $paymentObject = CRM_Core_Payment::singleton($this->_mode, $paymentProcessor, $this);
- $error = $paymentObject->checkConfig();
- if (empty($error)) {
- $validProcessors[$ppID] = $label;
- }
- $paymentObject = NULL;
- }
- }
- if (empty($validProcessors)) {
- CRM_Core_Error::fatal(ts('Could not find valid payment processor for this page'));
- }
- else {
- $this->_processors = $validProcessors;
- }
- // also check for billing information
- // get the billing location type
- $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array(), 'validate');
- // CRM-8108 remove ts around Billing location type
- //$this->_bltID = array_search( ts('Billing'), $locationTypes );
- $this->_bltID = array_search('Billing', $locationTypes);
- if (!$this->_bltID) {
- CRM_Core_Error::fatal(ts('Please set a location type of %1', array(1 => 'Billing')));
- }
- $this->set('bltID', $this->_bltID);
- $this->assign('bltID', $this->_bltID);
-
- $this->_fields = array();
-
- CRM_Core_Payment_Form::setCreditCardFields($this);
-
- // this required to show billing block
- $this->assign_by_ref('paymentProcessor', $paymentProcessor);
- $this->assign('hidePayPalExpress', TRUE);
- }
- else {
- $this->assign('membershipMode', FALSE);
}
// when custom data is included in this page
CRM_Custom_Form_CustomData::setDefaultValues($this);
}
- $this->_fromEmails = CRM_Core_BAO_Email::getFromEmail();
+ CRM_Utils_System::setTitle(ts('Renew Membership'));
+
parent::preProcess();
}
if ($this->_cdType) {
return CRM_Custom_Form_CustomData::setDefaultValues($this);
}
- $defaults = array();
+
$defaults = parent::setDefaultValues();
$this->_memType = $defaults['membership_type_id'];
parent::buildQuickForm();
- $defaults = array();
$defaults = parent::setDefaultValues();
$this->_memType = $defaults['membership_type_id'];
$this->assign('customDataType', 'Membership');
$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
$this->_params['year'] = CRM_Core_Payment_Form::getCreditCardExpirationYear($this->_params);
$this->_params['month'] = CRM_Core_Payment_Form::getCreditCardExpirationMonth($this->_params);
+ $this->_params['description'] = ts('Office Credit Card Membership Renewal Contribution');
$this->_params['ip_address'] = CRM_Utils_System::ipAddress();
$this->_params['amount'] = $formValues['total_amount'];
$this->_params['currencyID'] = $config->defaultCurrency;
CRM_Member_BAO_Membership::recordMembershipContribution(array_merge($formValues, array('membership_id' => $renewMembership->id)));
}
- if (!empty($formValues['send_receipt'])) {
- CRM_Core_DAO::setFieldValue('CRM_Member_DAO_MembershipType',
- $formValues['membership_type_id'][1],
- 'receipt_text_renewal',
- $formValues['receipt_text_renewal']
- );
- }
-
$receiptSend = FALSE;
if (!empty($formValues['send_receipt'])) {
$receiptSend = TRUE;