<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
+ | CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
- * This class provides the functionality for batch entry for contributions/memberships
+ * This class provides the functionality for batch entry for contributions/memberships.
*/
class CRM_Batch_Form_Entry extends CRM_Core_Form {
/**
* Build all the data structures needed to build the form.
- *
- * @return void
*/
public function preProcess() {
$this->_batchId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
/**
* Build the form object.
- *
- *
- * @return void
*/
public function buildQuickForm() {
if (!$this->_profileId) {
$errors = array();
$batchTypes = CRM_Core_Pseudoconstant::get('CRM_Batch_DAO_Batch', 'type_id', array('flip' => 1), 'validate');
$fields = array(
- 'total_amount' => 'Amount',
- 'financial_type' => 'Financial Type',
- 'payment_instrument' => 'Paid By',
+ 'total_amount' => ts('Amount'),
+ 'financial_type' => ts('Financial Type'),
+ 'payment_instrument' => ts('Payment Method'),
);
//CRM-16480 if contact is selected, validate financial type and amount field.
/**
* Set default values for the form.
- *
- *
- * @return void
*/
public function setDefaultValues() {
if (empty($this->_fields)) {
/**
* Process the form after the input has been submitted and validated.
- *
- *
- * @return void
*/
public function postProcess() {
$params = $this->controller->exportValues($this->_name);
* @param array $params
* Associated array of submitted values.
*
- *
- * @return void
+ * @return bool
*/
private function processContribution(&$params) {
$dates = array(
'reminder_date',
);
- // get the price set associated with offline memebership
+ // get the price set associated with offline membership
$priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', 'default_membership_type_amount', 'id', 'name');
$this->_priceSet = $priceSets = current(CRM_Price_BAO_PriceSet::getSetDetail($priceSetId));
// make contribution entry
$contrbutionParams = array_merge($value, array('membership_id' => $membership->id));
+ // @todo - calling this from here is pretty hacky since it is called from membership.create anyway
+ // This form should set the correct params & not call this fn directly.
CRM_Member_BAO_Membership::recordMembershipContribution($contrbutionParams);
}
else {
*
* @param array $value
* Associated array of submitted values.
- *
- *
- * @return void
*/
private function updateContactInfo(&$value) {
$value['preserveDBName'] = $this->_preserveDefault;
}
/**
- * Function exists purely for unit testing purposes. If you feel tempted to use this in live code
- * then it probably means there is some functionality that needs to be moved
- * out of the form layer
+ * Function exists purely for unit testing purposes.
+ *
+ * If you feel tempted to use this in live code then it probably means there is some functionality
+ * that needs to be moved out of the form layer
*
* @param array $params
*
}
/**
- * Function exists purely for unit testing purposes. If you feel tempted to use this in live code
- * then it probably means there is some functionality that needs to be moved
- * out of the form layer
+ * Function exists purely for unit testing purposes.
+ *
+ * If you feel tempted to use this in live code then it probably means there is some functionality
+ * that needs to be moved out of the form layer.
*
* @param array $params
*