<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
public $_contributeMode = 'direct';
/**
- * related component whose financial payment is being processed
+ * Related component whose financial payment is being processed
*
* @var string
- * @public
*/
protected $_component = NULL;
/**
- * id of the component entity
+ * Id of the component entity
*/
public $_id = NULL;
list($this->_contributorDisplayName, $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId);
- if (!$this->_refund) {
- $this->assignProcessors();
- // also check for billing information
- // get the billing location type
- $this->assignBillingType();
- }
+ $this->assignPaymentRelatedVariables();
$this->assign('contributionMode', $this->_mode);
$this->assign('contactId', $this->_contactId);
$this->assign('paymentAmt', abs($paymentAmt));
$this->setPageTitle($this->_refund ? ts('Refund') : ts('Payment'));
-
- $this->_paymentProcessor = array('billing_mode' => 1);
}
/**
*
* access public
*
- * @return array reference to the array of default values
- *
+ * @return array
+ * reference to the array of default values
*/
/**
* @return array
if ($this->_view == 'transaction' && ($this->_action & CRM_Core_Action::BROWSE)) {
return;
}
- $defaults = array( );
+ $defaults = array();
if ($this->_mode) {
$defaults = $this->_values;
if (empty($defaults['trxn_date']) && empty($defaults['trxn_date_time'])) {
list($defaults['trxn_date'],
$defaults['trxn_date_time']
- ) = CRM_Utils_Date::setDateDefaults(
+ ) = CRM_Utils_Date::setDateDefaults(
CRM_Utils_Array::value('register_date', $defaults), 'activityDateTime'
);
}
$allPanes[$name] = array(
'url' => CRM_Utils_System::url('civicrm/payment/add', $urlParams),
'open' => $open,
- 'id' => $type
+ 'id' => $type,
);
- if ($type == 'CreditCard') {
- $this->add('hidden', 'hidden_CreditCard', 1);
- CRM_Core_Payment_Form::buildCreditCard($this, TRUE);
- }
- elseif ($type == 'DirectDebit') {
- $this->add('hidden', 'hidden_DirectDebit', 1);
- CRM_Core_Payment_Form::buildDirectDebit($this, TRUE);
- }
+ CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, FALSE);
+
$qfKey = $this->controller->_key;
$this->assign('qfKey', $qfKey);
$this->assign('allPanes', $allPanes);
'type' => 'upload',
'name' => ts('%1', array(1 => $buttonName)),
'js' => $js,
- 'isDefault' => TRUE
+ 'isDefault' => TRUE,
),
array(
'type' => 'cancel',
- 'name' => ts('Cancel')
+ 'name' => ts('Cancel'),
),
)
);
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
if ($self->_paymentType == 'owed' && $fields['total_amount'] > $self->_owed) {
$errors['total_amount'] = ts('Payment amount cannot be greater than owed amount');
$session = CRM_Core_Session::singleton();
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view',
- "reset=1&cid={$this->_contactId}&selectedChild=participant"
- ));
+ "reset=1&cid={$this->_contactId}&selectedChild=participant"
+ ));
}
}
//Get the rquire fields value only.
$params = $this->_params = $submittedValues;
- $this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($this->_params['payment_processor_id'],
- $this->_mode
- );
-
//get the payment processor id as per mode.
+ //@todo unclear relevance of mode - seems like a lot of duplicated params here!
$this->_params['payment_processor'] = $params['payment_processor_id'] =
$this->_params['payment_processor_id'] = $submittedValues['payment_processor_id'] = $this->_paymentProcessor['id'];
if ($this->_context == 'standalone' && !empty($submittedValues['is_email_receipt'])) {
list($this->userDisplayName,
$this->userEmail
- ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId);
+ ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId);
$this->assign('displayName', $this->userDisplayName);
}
CRM_Core_Session::setStatus($statusMsg, ts('Complete'), 'success');
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view',
- "reset=1&cid={$this->_contactId}&selectedChild=participant"
- ));
+ "reset=1&cid={$this->_contactId}&selectedChild=participant"
+ ));
}
}
/**
- * @param $params
+ * @param array $params
*
* @return mixed
*/
- function emailReceipt(&$params) {
+ public function emailReceipt(&$params) {
// email receipt sending
// send message template
if ($this->_component == 'event') {
'groupName' => 'msg_tpl_workflow_contribution',
'valueName' => 'payment_or_refund_notification',
'contactId' => $this->_contactId,
- 'PDFFilename' => ts('notification').'.pdf',
+ 'PDFFilename' => ts('notification') . '.pdf',
);
// try to send emails only if email id is present