<?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->preProcessPledge();
}
+ if ($this->_id) {
+ $this->showRecordLinkMesssage($this->_id);
+ }
$this->_values = array();
// current contribution id
}
// 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());
// fix the display of the monetary value, CRM-4038
if (isset($defaults['total_amount'])) {
unset($status[CRM_Utils_Array::key('Overdue', $statusName)]);
}
}
-
+
if ($this->_id) {
$contributionStatus = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $this->_id, 'contribution_status_id');
$name = CRM_Utils_Array::value($contributionStatus, $statusName);
/**
* global form rule
*
- * @param array $fields the input form values
- * @param array $files the uploaded files if any
- * @param array $options additional user data
+ * @param array $fields the input form values
+ * @param array $files the uploaded files if any
+ * @param $self
+ *
+ * @internal param array $options additional user data
*
* @return true if no errors, else array of errors
* @access public
$fieldType = NULL;
if ($itemId && !empty($lineItems[$itemId]['price_field_id'])) {
$fieldType = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $lineItems[$itemId]['price_field_id'], 'html_type');
+ $this->_priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $lineItems[$itemId]['price_field_id'], 'price_set_id');
+ }
+
+ if ($this->_priceSetId && CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config')) {
+ $lineItems[$itemId]['unit_price'] = $lineItems[$itemId]['line_total'] = CRM_Utils_Rule::cleanMoney(CRM_Utils_Array::value('total_amount', $submittedValues));
}
- $lineItems[$itemId]['unit_price'] = $lineItems[$itemId]['line_total'] = CRM_Utils_Rule::cleanMoney(CRM_Utils_Array::value('total_amount', $submittedValues));
// 10117 update th line items for participants
if (!empty($lineItems[$itemId]['price_field_id'])) {
- $this->_priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $lineItems[$itemId]['price_field_id'], 'price_set_id');
$lineItem[$this->_priceSetId] = $lineItems;
}
}
$pcp[$f] = CRM_Utils_Array::value($f, $submittedValues);
}
}
+
+ $isEmpty = array_keys(array_flip($submittedValues['soft_credit_contact_id']));
+ if ($this->_id && count($isEmpty) == 1 && key($isEmpty) == NULL) {
+ //Delete existing soft credit records if soft credit list is empty on update
+ CRM_Contribute_BAO_ContributionSoft::del(array('contribution_id' => $this->_id));
+ }
else {
- $isEmpty = array_keys(array_flip($submittedValues['soft_credit_contact_id']));
- if ($this->_id && count($isEmpty) == 1 && key($isEmpty) == NULL) {
- //Delete existing soft credit records if soft credit list is empty on update
- CRM_Contribute_BAO_ContributionSoft::del(array('contribution_id' => $this->_id));
- }
- else {
- //build soft credit params
- $softParams = $softIDs =array();
- foreach ($submittedValues['soft_credit_contact_id'] as $key => $val) {
- if ($val && $submittedValues['soft_credit_amount'][$key]) {
- $softParams[$key]['contact_id'] = $val;
- $softParams[$key]['amount'] = CRM_Utils_Rule::cleanMoney($submittedValues['soft_credit_amount'][$key]);
- $softParams[$key]['soft_credit_type_id'] = $submittedValues['soft_credit_type'][$key];
- if (!empty($submittedValues['soft_credit_id'][$key])) {
- $softIDs[] = $softParams[$key]['id'] = $submittedValues['soft_credit_id'][$key];
- }
+ //build soft credit params
+ $softParams = $softIDs =array();
+ foreach ($submittedValues['soft_credit_contact_id'] as $key => $val) {
+ if ($val && $submittedValues['soft_credit_amount'][$key]) {
+ $softParams[$key]['contact_id'] = $val;
+ $softParams[$key]['amount'] = CRM_Utils_Rule::cleanMoney($submittedValues['soft_credit_amount'][$key]);
+ $softParams[$key]['soft_credit_type_id'] = $submittedValues['soft_credit_type'][$key];
+ if (!empty($submittedValues['soft_credit_id'][$key])) {
+ $softIDs[] = $softParams[$key]['id'] = $submittedValues['soft_credit_id'][$key];
}
}
}
"reset=1&action=add&context={$this->_context}&cid={$this->_contactID}"
));
}
+
+ //store contribution ID if not yet set (on create)
+ if ( empty($this->_id) && !empty($contribution->id) ) {
+ $this->_id = $contribution->id;
+ }
}
public function processCreditCard($submittedValues, $config, $session, $pId, $lineItem) {
if (!empty($this->_params['receive_date'])) {
$paymentParams['receive_date'] = $this->_params['receive_date'];
}
- if (!empty($this->_params['receive_date'])) {
- $paymentParams['receive_date'] = $this->_params['receive_date'];
- }
$result = NULL;