$billingDefaults = $this->getProfileDefaults('Billing', $this->_contactID);
$defaults = array_merge($defaults, $billingDefaults);
- // now fix all state country selectors (FIXME: what does this do ?? dgg)
+ // now fix all state country selectors, set correct state based on country
CRM_Core_BAO_Address::fixAllStateSelects($this, $defaults);
}
}
//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;
}
$errors = array_merge($errors, $softErrors);
}
$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
- $this->_priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $lineItems[$itemId]['price_field_id'], 'price_set_id');
- $lineItem[$this->_priceSetId] = $lineItems;
+ 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;
+ }
}
$isQuickConfig = 0;
if ($this->_priceSetId && CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config')) {