$defaults["billing_state_province_id-{$this->_bltID}"] = $config->defaultContactStateProvince;
}
- $names = array(
- 'first_name',
- 'middle_name',
- 'last_name',
- "street_address-{$this->_bltID}",
- "city-{$this->_bltID}",
- "postal_code-{$this->_bltID}",
- "country_id-{$this->_bltID}",
- "state_province_id-{$this->_bltID}",
- "state_province-{$this->_bltID}",
- "country-{$this->_bltID}"
- );
-
- foreach ($names as $name) {
- $fields[$name] = 1;
- }
-
- if ($this->_contactID) {
- CRM_Core_BAO_UFGroup::setProfileDefaults($this->_contactID, $fields, $defaults);
- }
+ $billingDefaults = $this->getProfileDefaults('Billing', $this->_contactID);
+ $defaults = array_merge($defaults, $billingDefaults);
- foreach ($names as $name) {
- if (!empty($defaults[$name])) {
- $defaults['billing_' . $name] = $defaults[$name];
- }
- }
-
- // now fix all state country selectors
+ // 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')) {