<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.4 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
*/
protected $_context;
+ /**
+ * An array to hold a list of datefields on the form
+ * so that they can be converted to ISO in a consistent manner
+ *
+ * @var array
+ */
+ protected $_dateFields = array(
+ 'receive_date' => array('default' => 'now'),
+ );
+
public function preProcess() {
//custom data related code
$this->_cdType = CRM_Utils_Array::value('type', $_GET);
}
// also check for billing information
// get the billing location type
- $locationTypes = CRM_Core_PseudoConstant::locationType();
+ $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
// CRM-8108 remove ts around Billing location type
//$this->_bltID = array_search( ts('Billing'), $locationTypes );
$this->_bltID = array_search('Billing', $locationTypes);
$autoRenew = array();
if (!empty($membershipType)) {
$sql = '
-SELECT id,
+SELECT id,
auto_renew,
duration_unit,
duration_interval
$this->addDate('renewal_date', ts('Date Renewal Entered'), FALSE, array('formatType' => 'activityDate'));
- $this->add('select', 'financial_type_id', ts('Financial Type'),
+ $this->add('select', 'financial_type_id', ts('Financial Type'),
array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::financialType()
);
if (CRM_Core_Permission::access('CiviContribute') && !$this->_mode) {
$this->add('text', 'total_amount', ts('Amount'));
$this->addRule('total_amount', ts('Please enter a valid amount.'), 'money');
- $this->addDate('receive_date', ts('Received'), FALSE, array('formatType' => 'activityDate'));
+ $this->addDate('receive_date', ts('Received'), FALSE, array('formatType' => 'activityDateTime'));
$this->add('text', 'num_terms', ts('Extend Membership by'), array('onchange' => "setPaymentBlock();"), TRUE);
$this->addRule('num_terms', ts('Please enter a whole number for how many periods to renew.'), 'integer');
// causes a conflict in standalone mode so skip in standalone for now
$this->addElement('checkbox', 'contribution_contact', ts('Record Payment from a Different Contact?'));
$this->add( 'select', 'honor_type_id', ts('Membership payment is : '),
- array( '' => ts( '-') ) + CRM_Core_PseudoConstant::honor() );
+ array( '' => ts( '-') ) + CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'honor_type_id') );
require_once 'CRM/Contact/Form/NewContact.php';
CRM_Contact_Form_NewContact::buildQuickForm($this,1, null, false,'contribution_');
}
}
$now = CRM_Utils_Date::getToday( null, 'YmdHis');
- if (CRM_Utils_Array::value('receive_date', $this->_params)) {
- $formValues['receive_date'] = CRM_Utils_Date::processDate($this->_params['receive_date']);
- }
- else {
- $formValues['receive_date'] = $now;
- }
+ $this->convertDateFieldsToMySQL($formValues);
$this->assign('receive_date', $formValues['receive_date']);
if (CRM_Utils_Array::value('send_receipt', $this->_params)) {
$this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($formValues['payment_processor_id'],
$this->_mode
);
-
+
$fields = array();
// set email for primary location.
if (CRM_Utils_Array::value('record_contribution', $formValues) || $this->_mode) {
// set the source
$formValues['contribution_source'] = "{$memType} Membership: Offline membership renewal (by {$userName})";
-
+
//create line items
$lineItem = array();
$priceSetId = null;
CRM_Member_BAO_Membership::createLineItems($this, $formValues['membership_type_id'], $priceSetId);
- CRM_Price_BAO_Set::processAmount($this->_priceSet['fields'],
+ CRM_Price_BAO_PriceSet::processAmount($this->_priceSet['fields'],
$this->_params, $lineItem[$priceSetId]
);
- //CRM-11529 for quick config backoffice transactions
- //when financial_type_id is passed in form, update the
+ //CRM-11529 for quick config backoffice transactions
+ //when financial_type_id is passed in form, update the
//lineitems with the financial type selected in form
if ($submittedFinancialType = CRM_Utils_Array::value('financial_type_id', $formValues)) {
foreach ($lineItem[$priceSetId] as &$li) {
}
}
$formValues['contact_id'] = $this->_contactID;
-
- CRM_Member_BAO_Membership::recordMembershipContribution( $formValues,
- CRM_Core_DAO::$_nullArray,
- $renewMembership->id );
+
+ CRM_Member_BAO_Membership::recordMembershipContribution(array_merge($formValues, array('membership_id' => $renewMembership->id)));
}
if (CRM_Utils_Array::value('send_receipt', $formValues)) {