$financialType = $this->add('select', 'financial_type_id',
ts('Financial Type'),
array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::financialType(),
- TRUE
+ TRUE,
+ array('onChange' => "CRM.buildCustomData( 'Contribution', this.value );")
);
if (!$this->_mode) {
}
//FIXME FOR NEW DATA FLOW http://wiki.civicrm.org/confluence/display/CRM/CiviAccounts+4.3+Data+Flow
- if (CRM_Utils_Array::value('fee_amount', $fields)) {
- $financialAccount = array();
- CRM_Core_PseudoConstant::populate($financialAccount,
- 'CRM_Financial_DAO_EntityFinancialAccount',
- $all = TRUE,
- $retrieve = 'financial_account_id',
- $filter = NULL,
- " account_relationship = 5 AND entity_id = {$fields['financial_type_id']} ");
- if (!current($financialAccount)) {
- $errors['financial_type_id'] = ts("Financial Account of account relationship of 'Expense Account is' is not configured for this Financial Type");
- }
+ if (CRM_Utils_Array::value('fee_amount', $fields)
+ && $financialType = CRM_Contribute_BAO_Contribution::validateFinancialType($fields['financial_type_id'])) {
+ $errors['financial_type_id'] = ts("Financial Account of account relationship of 'Expense Account is' is not configured for Financial Type : ") . $financialType;
}
return $errors;
}
}
$lineItems = CRM_Price_BAO_LineItem::getLineItems($entityID, $entityTable);
+ foreach (array_keys($lineItems) as $id) {
+ $lineItems[$id]['id'] = $id;
+ }
$itemId = key($lineItems);
$fieldType = NULL;
if ($itemId && CRM_Utils_Array::value('price_field_id', $lineItems[$itemId])) {
$fieldType = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $lineItems[$itemId]['price_field_id'], 'html_type');
}
$lineItems[$itemId]['unit_price'] = $lineItems[$itemId]['line_total'] = CRM_Utils_Rule::cleanMoney(CRM_Utils_Array::value('total_amount', $submittedValues));
- $lineItems[$itemId]['id'] = $itemId;
// 10117 update th line items for participants
$this->_priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $lineItems[$itemId]['price_field_id'], 'price_set_id');
$lineItem[$this->_priceSetId] = $lineItems;
}
}
- if (!CRM_Utils_Array::value('total_amount', $submittedValues)) {
+ if (!isset($submittedValues['total_amount'])) {
$submittedValues['total_amount'] = CRM_Utils_Array::value('total_amount', $this->_values);
}
$this->assign('lineItem', !empty($lineItem) && !$isQuickConfig ? $lineItem : FALSE);
if ($pId) {
$params['contribution_mode'] = 'participant';
$params['participant_id'] = $pId;
+ $params['skipLineItem'] = 1;
}
$params['line_item'] = $lineItem;
$params['payment_processor_id'] = $params['payment_processor'] = CRM_Utils_Array::value('id', $this->_paymentProcessor);
unset($submittedValues[$key]);
}
}
-
+
+ // CRM-12680 set $_lineItem if its not set
+ if (empty($this->_lineItem) && !empty($lineItem)) {
+ $this->_lineItem = $lineItem;
+ }
+
//Get the rquire fields value only.
$params = $this->_params = $submittedValues;
);
//get the payment processor id as per mode.
- $params['payment_processor_id'] = $this->_params['payment_processor_id'] = $submittedValues['payment_processor_id'] = $this->_paymentProcessor['id'];
+ $this->_params['payment_processor'] = $params['payment_processor_id'] =
+ $this->_params['payment_processor_id'] = $submittedValues['payment_processor_id'] = $this->_paymentProcessor['id'];
$now = date('YmdHis');
$fields = array();