// hidden field to catch the field id in profile
$this->add('hidden', 'account_type_id', $this->_id);
}
- $AccountTypeRelationship = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship');
+ $params['orderColumn'] = 'label';
+ $AccountTypeRelationship = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship', $params);
if (!empty($AccountTypeRelationship)) {
$element = $this->add('select',
'account_relationship',
ts('Financial Account Relationship'),
- array('select' => '- select -') + $AccountTypeRelationship,
+ array('select' => '- Select Financial Account Relationship -') + $AccountTypeRelationship,
TRUE
);
}
if ($this->_action == CRM_Core_Action::ADD) {
if (!empty($this->_submitValues['account_relationship']) || !empty($this->_submitValues['financial_account_id'])) {
- $financialAccountType = array(
- '5' => 5, //expense
- '3' => 1, //AR relation
- '1' => 3, //revenue
- '6' => 1, //Asset
- '7' => 4, //cost of sales
- '8' => 1, //premium inventory
- '9' => 3, //discount account is,
- );
-
+ $financialAccountType = CRM_Financial_BAO_FinancialAccount::getfinancialAccountRelations();
$financialAccountType = CRM_Utils_Array::value($this->_submitValues['account_relationship'], $financialAccountType);
$result = CRM_Contribute_PseudoConstant::financialAccount(NULL, $financialAccountType);
}
}
if ($this->_action == CRM_Core_Action::UPDATE) {
- $financialAccountType = array(
- '5' => 5, //expense
- '3' => 1, //AR relation
- '1' => 3, //revenue
- '6' => 1, //Asset
- '7' => 4, //cost of sales
- '8' => 1, //premium inventory
- '9' => 3, //discount account is,
- );
-
+ $financialAccountType = CRM_Financial_BAO_FinancialAccount::getfinancialAccountRelations();
$financialAccountType = $financialAccountType[$this->_defaultValues['account_relationship']];
$result = CRM_Contribute_PseudoConstant::financialAccount(NULL, $financialAccountType);
$result = CRM_Contribute_PseudoConstant::financialAccount();
}
else {
- $financialAccountType = array(
- '5' => 5, // expense
- '3' => 1, // AR relation
- '1' => 3, // revenue
- '6' => 1, // asset
- '7' => 4, // cost of sales
- '8' => 1, // premium inventory
- '9' => 3, // discount account is
- '10' => 2, // sales tax liability
- );
+ $financialAccountType = CRM_Financial_BAO_FinancialAccount::getfinancialAccountRelations();
$financialAccountType = CRM_Utils_Array::value($_GET['_value'], $financialAccountType);
$result = CRM_Contribute_PseudoConstant::financialAccount(NULL, $financialAccountType);
if ($financialAccountType) {
CRM_Utils_System::civiExit();
}
- if ($_GET['_value'] == 'select') {
- $result = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship');
- }
- else {
- $financialAccountType = array(
- '5' => array(5), //expense
- '1' => array(3, 6, 8), //Asset
- '3' => array(1, 9), //revenue
- '4' => array(7), //cost of sales
- );
+ if ($_GET['_value'] != 'select') {
+ $financialAccountType = CRM_Financial_BAO_FinancialAccount::getfinancialAccountRelations(TRUE);
$financialAccountId = CRM_Utils_Request::retrieve('_value', 'Positive', CRM_Core_DAO::$_nullObject);
$financialAccountTypeId = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialAccount', $financialAccountId, 'financial_account_type_id');
- $result = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship');
}
-
+ $params['orderColumn'] = 'label';
+ $result = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship', $params);
+
$elements = array(
array(
'name' => ts('- Select Financial Account Relationship -'),