<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
$this->_fromEmails = CRM_Event_BAO_Event::getFromEmailIds($eventId);
$paymentInfo = CRM_Core_BAO_FinancialTrxn::getPartialPaymentWithType($this->_id, $enitityType);
- $paymentDetails = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_id, $this->_component);
+ $paymentDetails = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_id, $this->_component, FALSE, TRUE);
$this->_amtPaid = $paymentDetails['paid'];
$this->_amtTotal = $paymentDetails['total'];
$this->assign('paymentType', $this->_paymentType);
$this->assign('paymentAmt', abs($paymentAmt));
- $this->_paymentProcessor = array('billing_mode' => 1);
+ $this->setPageTitle($this->_refund ? ts('Refund') : ts('Payment'));
- $title = ($this->_refund) ? "Refund for {$this->_contributorDisplayName}" : "Payment from {$this->_contributorDisplayName}";
- if ($title) {
- CRM_Utils_System::setTitle(ts('%1', array(1 => $title)));
- }
+ $this->_paymentProcessor = array('billing_mode' => 1);
}
+ /**
+ * This virtual function is used to set the default values of
+ * various form elements
+ *
+ * access public
+ *
+ * @return array reference to the array of default values
+ *
+ */
+ /**
+ * @return array
+ */
public function setDefaultValues() {
if ($this->_view == 'transaction' && ($this->_action & CRM_Core_Action::BROWSE)) {
return;
$billingDefaults = $this->getProfileDefaults('Billing', $this->_contactId);
$defaults = array_merge($defaults, $billingDefaults);
-
- // now fix all state country selectors, set correct state based on country
- CRM_Core_BAO_Address::fixAllStateSelects($this, $defaults);
}
if (empty($defaults['trxn_date']) && empty($defaults['trxn_date_time'])) {
}
// Set $newCredit variable in template to control whether link to credit card mode is included
- CRM_Core_Payment::allowBackofficeCreditCard($this);
+ $this->assign('newCredit', CRM_Core_Config::isEnabledBackOfficeCreditCardPayments());
return $defaults;
}
);
$this->add('text', 'check_number', ts('Check Number'), $attributes['financial_trxn_check_number']);
- $trxnId = $this->add('text', 'trxn_id', ts('Transaction ID'), $attributes['trxn_id']);
+ $this->add('text', 'trxn_id', ts('Transaction ID'), array('class' => 'twelve') + $attributes['trxn_id']);
//add receipt for offline contribution
$this->addElement('checkbox', 'is_email_receipt', ts('Send Receipt?'));
$this->addFormRule(array('CRM_Contribute_Form_AdditionalPayment', 'formRule'), $this);
}
+ /**
+ * @param $fields
+ * @param $files
+ * @param $self
+ *
+ * @return array
+ */
static function formRule($fields, $files, $self) {
$errors = array();
if ($self->_paymentType == 'owed' && $fields['total_amount'] > $self->_owed) {
}
}
+ /**
+ * @param $submittedValues
+ */
public function processCreditCard($submittedValues) {
$config = CRM_Core_Config::singleton();
$session = CRM_Core_Session::singleton();
}
// process the additional payment
+ $participantId = NULL;
+ if ($this->_component == 'event') {
+ $participantId = $this->_id;
+ }
$trxnRecord = CRM_Contribute_BAO_Contribution::recordAdditionalPayment($this->_contributionId, $submittedValues, $this->_paymentType, $participantId);
if ($trxnRecord->id && !empty($this->_params['is_email_receipt'])) {
}
}
+ /**
+ * @param $params
+ *
+ * @return mixed
+ */
function emailReceipt(&$params) {
// email receipt sending
// send message template
list($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams);
return $mailSent;
}
-}
\ No newline at end of file
+}