// CRM-11516
if ($this->_gName == 'payment_instrument') {
- $accountType = CRM_Core_PseudoConstant::accountOptionValues('financial_account_type', NULL, " AND v.name = 'Asset' ");
+ $accountType = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialAccount', 'financial_account_type_id', array('condition' => " AND v.name = 'Asset' "));
$financialAccount = CRM_Contribute_PseudoConstant::financialAccount(NULL, key($accountType));
$this->add('select', 'financial_account_id', ts('Financial Account'),
$optionValue = CRM_Core_BAO_OptionValue::add($params, $ids);
// CRM-11516
if (CRM_Utils_Array::value('financial_account_id', $params)) {
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' "));
+ $relationTypeId = key(CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship', array('condition' => " AND v.name LIKE 'Asset Account is' ")));
$params = array(
'entity_table' => 'civicrm_option_value',
'entity_id' => $optionValue->id,
}
// CRM-11516
if ($this->_gName == 'payment_instrument') {
- $accountType = CRM_Core_PseudoConstant::accountOptionValues('financial_account_type', NULL, " AND v.name = 'Asset' ");
+ $accountType = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialAccount', 'financial_account_type_id', array('condition' => " AND v.name = 'Asset' "));
$financialAccount = CRM_Contribute_PseudoConstant::financialAccount(NULL, key($accountType));
$this->add('select', 'financial_account_id', ts('Financial Account'),
// CRM-11516
if (CRM_Utils_Array::value('financial_account_id', $params)) {
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' "));
+ $relationTypeId = key(CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship', array('condition' => " AND v.name LIKE 'Asset Account is' ")));
$params = array(
'entity_table' => 'civicrm_option_value',
'entity_id' => $optionValue->id,
);
// Financial Account of account type asset CRM-11515
- $accountType = CRM_Core_PseudoConstant::accountOptionValues('financial_account_type', NULL, " AND v.name = 'Asset' ");
+ $accountType = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialAccount', 'financial_account_type_id', array('condition' => " AND v.name = 'Asset' "));
$financialAccount = CRM_Contribute_PseudoConstant::financialAccount(NULL, key($accountType));
if ($fcount = count($financialAccount)) {
$this->assign('financialAccount', $fcount);
//CRM-11515
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' "));
+ $relationTypeId = key(CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship', array('condition' => " AND v.name LIKE 'Asset Account is' ")));
$params = array(
'entity_table' => 'civicrm_payment_processor',
'entity_id' => $dao->id,
}
static function closeReOpen($batchIds = array(), $status) {
- $batchStatus = CRM_Core_PseudoConstant::accountOptionValues( 'batch_status' );
+ $batchStatus = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialItem', 'status_id');
$params['status_id'] = CRM_Utils_Array::key( $status, $batchStatus );
$session = CRM_Core_Session::singleton( );
$params['modified_date'] = date('YmdHis');
$this->_priceSet = current(CRM_Price_BAO_Set::getSetDetail($priceSetId));
$fieldID = key($this->_priceSet['fields']);
- $assetRelation = key(CRM_CORE_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' "));
-
if (isset($params['field'])) {
foreach ($params['field'] as $key => $value) {
// if contact is not selected we should skip the row
!(CRM_Utils_Array::value('contribution_status_id', $params) == array_search('Pending', $contributionStatuses) && !$params['contribution']->is_pay_later)) {
$skipRecords = TRUE;
if (CRM_Utils_Array::value('contribution_status_id', $params) == array_search('Pending', $contributionStatuses)) {
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
+ $relationTypeId = key(CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship', array('condition' => " AND v.name LIKE 'Accounts Receivable Account is' ")));
$params['to_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $relationTypeId);
}
elseif (CRM_Utils_Array::value('payment_processor', $params)) {
//if financial type is changed
if (CRM_Utils_Array::value('financial_type_id', $params) &&
$params['contribution']->financial_type_id != $params['prevContribution']->financial_type_id) {
- $incomeTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Income Account is' "));
+ $incomeTypeId = key(CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship', array('condition' => " AND v.name LIKE 'Income Account is' ")));
$oldFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['prevContribution']->financial_type_id, $incomeTypeId);
$newFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $incomeTypeId);
if ($oldFinancialAccount != $newFinancialAccount) {
$params['trxnParams']['to_financial_account_id'] = NULL;
$params['trxnParams']['total_amount'] = - $params['total_amount'];
}
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL,
- " AND v.name LIKE 'Accounts Receivable Account is' "));
+ $relationTypeId = key(CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship', array('condition' => " AND v.name LIKE 'Accounts Receivable Account is' ")));
$params['trxnParams']['from_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType(
$financialTypeID, $relationTypeId);
}
if ($params['prevContribution']->payment_instrument_id != null
&& $params['prevContribution']->contribution_status_id == array_search('Pending', $contributionStatus)
&& $params['contribution']->contribution_status_id == array_search('Pending', $contributionStatus)) {
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
+ $relationTypeId = key(CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship', array('condition' => " AND v.name LIKE 'Accounts Receivable Account is' ")));
$params['trxnParams']['from_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $relationTypeId);
}
elseif ($params['prevContribution']->payment_instrument_id != null) {
if (CRM_Utils_Array::value('cost', $params)) {
$contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
$financialAccountType = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id']);
- $accountRelationship = CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND label IN ('Premiums Inventory Account is', 'Cost of Sales Account is')");
+ $accountRelationship = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship', array('condition' => " AND label IN ('Premiums Inventory Account is', 'Cost of Sales Account is')"));
$toFinancialAccount = CRM_Utils_Array::value('isDeleted', $params) ? 'Premiums Inventory Account is' : 'Cost of Sales Account is';
$fromFinancialAccount = CRM_Utils_Array::value('isDeleted', $params) ? 'Cost of Sales Account is': 'Premiums Inventory Account is';
$accountRelationship = array_flip($accountRelationship);
*/
static function recordFees($params) {
- $expenseTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Expense Account is' "));
+ $expenseTypeId = key(CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship', array('condition' => " AND v.name LIKE 'Expense Account is' ")));
$domainId = CRM_Core_Config::domainID();
$amount = 0;
if (CRM_Utils_Array::value('prevContribution', $params)) {
$params = array(1 => array($priceSetId, 'Integer'),
2 => array($feeLevel, 'String'));
$mainAmount = CRM_Core_DAO::singleValueQuery($query, $params);
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Discounts Account is' "));
+ $relationTypeId = key(CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship', array('condition' => " AND v.name LIKE 'Discounts Account is' ")));
$contributionParams['trxnParams']['from_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType(
$contributionParams['contribution']->financial_type_id, $relationTypeId);
if (CRM_Utils_Array::value('from_financial_account_id', $contributionParams['trxnParams'])) {
* @static
*/
static function getAccountingCode($financialTypeId) {
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Income Account is' "));
+ $relationTypeId = key(CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship', array('condition' => " AND v.name LIKE 'Income Account is' ")));
$query = "SELECT cfa.accounting_code
FROM civicrm_financial_type cft
LEFT JOIN civicrm_entity_financial_account cefa ON cefa.entity_id = cft.id AND cefa.entity_table = 'civicrm_financial_type'
*/
static function add($lineItem, $contribution) {
$contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
- $financialItemStatus = CRM_Core_PseudoConstant::accountOptionValues('financial_item_status');
+ $financialItemStatus = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialItem', 'status_id');
if ($contribution->contribution_status_id == array_search('Completed', $contributionStatuses)) {
$itemStatus = array_search('Paid', $financialItemStatus);
}
// Financial Type
$financialType = CRM_Contribute_PseudoConstant::financialType();
$revenueFinancialType = array();
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Income Account is' "));
+ $relationTypeId = key(CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship', array('condition' => " AND v.name LIKE 'Income Account is' ")));
CRM_Core_PseudoConstant::populate(
$revenueFinancialType,
'CRM_Financial_DAO_EntityFinancialAccount',
static function del($financialTypeAccountId, $accountId = null) {
//checking if financial type is present
$check = false;
- $relationValues = CRM_Core_PseudoConstant::accountOptionValues('account_relationship');
+ $relationValues = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship');
$financialTypeId = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_EntityFinancialAccount', $financialTypeAccountId, 'entity_id' );
//check dependencies
// CRM-11826, add entry in civicrm_entity_financial_account
// if financial_account_id is not NULL
if (CRM_Utils_Array::value('financial_account_id', $params)) {
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' "));
+ $relationTypeId = key(CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship', array('condition' => " AND v.name LIKE 'Asset Account is' ")));
$values = array(
'entity_table' => 'civicrm_payment_processor',
'entity_id' => $processor->id,
$this->_batchIds = $this->_id;
}
- $allBatchStatus = CRM_Core_PseudoConstant::accountOptionValues('batch_status');
+ $allBatchStatus = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialItem', 'status_id');
$this->_exportStatusId = CRM_Utils_Array::key('Exported', $allBatchStatus);
//check if batch status is valid, do not allow exported batches to export again
$element->freeze();
}
- $financialAccountType = CRM_Core_PseudoConstant::accountOptionValues('financial_account_type');
+ $financialAccountType = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialAccount', 'financial_account_type_id');
if (!empty($financialAccountType)) {
$element = $this->add('select', 'financial_account_type_id', ts('Financial Account Type'),
array('' => '- select -') + $financialAccountType, TRUE);
);
if ($this->_action & CRM_Core_Action::UPDATE && $this->_id) {
- $batchStatus = CRM_Core_PseudoConstant::accountOptionValues('batch_status');
+ $batchStatus = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialItem', 'status_id');
//unset exported status
$exportedStatusId = CRM_Utils_Array::key('Exported', $batchStatus );
$session = CRM_Core_Session::singleton();
$ids = array();
$params = $this->exportValues();
- $batchStatus = CRM_Core_PseudoConstant::accountOptionValues('batch_status');
+ $batchStatus = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialItem', 'status_id');
if ($this->_id) {
$ids['batchID'] = $this->_id;
$params['id'] = $this->_id;
//hidden field to catch the field id in profile
$this->add('hidden', 'account_type_id', $this->_id);
}
- $AccountTypeRelationship = CRM_Core_PseudoConstant::accountOptionValues('account_relationship');
+ $AccountTypeRelationship = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship');
if (!empty($AccountTypeRelationship)) {
$element = $this->add('select',
'account_relationship',
$errorMsg = array();
$errorFlag = FALSE;
if ($self->_action == CRM_Core_Action::DELETE) {
- $groupName = 'account_relationship';
- $relationValues = CRM_Core_PseudoConstant::accountOptionValues($groupName);
+ $relationValues = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship');
if (CRM_Utils_Array::value('financial_account_id', $values) != 'select') {
if ($relationValues[$values['account_relationship']] == 'Premiums Inventory Account is' || $relationValues[$values['account_relationship']] == 'Cost of Sales Account is') {
$premiumsProduct = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_PremiumsProduct', $values['financial_type_id'], 'product_id', 'financial_type_id');
}
if ($_GET['_value'] == 'select') {
- $result = CRM_Core_PseudoConstant::accountOptionValues('account_relationship');
+ $result = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship');
}
else {
$financialAccountType = array(
'4' => array(7), //cost of sales
);
$financialAccountTypeId = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialAccount', $_GET['_value'], 'financial_account_type_id');
- $result = CRM_Core_PseudoConstant::accountOptionValues('account_relationship');
+ $result = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship');
}
$elements = array(
case 'reopen':
$status = $op == 'close' ? 'Closed' : 'Open';
$ids['batchID'] = $recordID;
- $batchStatus = CRM_Core_PseudoConstant::accountOptionValues('batch_status');
+ $batchStatus = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialItem', 'status_id');
$params['status_id'] = CRM_Utils_Array::key($status, $batchStatus);
$session = CRM_Core_Session::singleton();
$params['modified_date'] = date('YmdHis');
$dao = new CRM_Financial_DAO_FinancialAccount();
$dao->orderBy('financial_account_type_id, name');
$dao->find();
- $financialAccountType = CRM_Core_PseudoConstant::accountOptionValues('financial_account_type');
+ $financialAccountType = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialAccount', 'financial_account_type_id');
while ($dao->fetch()) {
$contributionType[$dao->id] = array();
$relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
$this->_title = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $this->_aid, 'name');
CRM_Utils_System::setTitle($this->_title .' - '.ts( 'Assigned Financial Accounts'));
- $financialAccountType = CRM_Core_PseudoConstant::accountOptionValues('financial_account_type');
- $accountRelationship = CRM_Core_PseudoConstant::accountOptionValues('account_relationship');
+ $financialAccountType = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialAccount', 'financial_account_type_id');
+ $accountRelationship = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship');
$dao->copyValues($params);
$dao->find();
while ($dao->fetch()) {
3 => array($cancelledStatus, 'Integer')
);
- $accountType = key(CRM_Core_PseudoConstant::accountOptionValues('financial_account_type', NULL, " AND v.name = 'Asset' "));
+ $accountType = key(CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialAccount', 'financial_account_type_id', array('condition' => " AND v.name = 'Asset' ")));
$query = "
SELECT id
FROM civicrm_financial_account
";
$financialAccountId = CRM_Core_DAO::singleValueQuery($query);
- $accountRelationsips = CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL);
+ $accountRelationsips = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship');
$accountsReceivableAccount = array_search('Accounts Receivable Account is', $accountRelationsips);
$incomeAccountIs = array_search('Income Account is', $accountRelationsips);
$assetAccountIs = array_search('Asset Account is', $accountRelationsips);
$expenseAccountIs = array_search('Expense Account is', $accountRelationsips);
- $financialItemStatus = CRM_Core_PseudoConstant::accountOptionValues('financial_item_status');
+ $financialItemStatus = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialItem', 'status_id');
$unpaidStatus = array_search('Unpaid', $financialItemStatus);
$paidStatus = array_search('Paid', $financialItemStatus);
* - max: integer (default = 10) maximum number of option values expected.
*/
$fields = array(
+ 'CRM_Financial_DAO_EntityFinancialAccount' => array(
+ array(
+ 'fieldName' => 'financial_account_id',
+ 'sample' => 'Member Dues',
+ 'max' => 15,
+ ),
+ array(
+ 'fieldName' => 'account_relationship',
+ 'sample' => 'Income Account is',
+ ),
+ ),
+ 'CRM_Financial_DAO_FinancialItem' => array(
+ array(
+ 'fieldName' => 'status_id',
+ 'sample' => 'Partially paid',
+ ),
+ array(
+ 'fieldName' => 'financial_account_id',
+ 'sample' => 'Accounts Receivable',
+ 'max' => 15,
+ ),
+ ),
+ 'CRM_Financial_DAO_FinancialTrxn' => array(
+ array(
+ 'fieldName' => 'from_financial_account_id',
+ 'sample' => 'Accounts Receivable',
+ 'max' => 15,
+ ),
+ array(
+ 'fieldName' => 'to_financial_account_id',
+ 'sample' => 'Accounts Receivable',
+ 'max' => 15,
+ ),
+ ),
+ 'CRM_Financial_DAO_FinancialAccount' => array(
+ array(
+ 'fieldName' => 'financial_account_type_id',
+ 'sample' => 'Cost of Sales',
+ ),
+ ),
'CRM_Event_DAO_Participant' => array(
array(
'fieldName' => 'fee_currency',
$financialAccount = CRM_Financial_BAO_FinancialAccount::add($params, $ids);
$params['name'] = 'test_financialType1';
$financialType = CRM_Financial_BAO_FinancialType::add($params, $ids);
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Income Account is' "));
+ $relationTypeId = key(CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship', array('condition' => " AND v.name LIKE 'Income Account is' ")));
$financialParams = array(
'entity_table' => 'civicrm_financial_type',
'entity_id' => $financialType->id,
$financialAccount = CRM_Financial_BAO_FinancialAccount::add($params, $ids);
$params['name'] = 'test_financialType2';
$financialType = CRM_Financial_BAO_FinancialType::add($params, $ids);
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Expense Account is' "));
+ $relationTypeId = key(CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship', array('condition' => " AND v.name LIKE 'Expense Account is' ")));
$financialParams = array(
'entity_table' => 'civicrm_financial_type',
'entity_id' => $financialType->id,
$financialAccount = CRM_Financial_BAO_FinancialAccount::add($params, $ids);
$params['name'] = 'test_financialType3';
$financialType = CRM_Financial_BAO_FinancialType::add($params, $ids);
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' "));
+ $relationTypeId = key(CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship', array('condition' => " AND v.name LIKE 'Asset Account is' ")));
$financialParams = array(
'entity_table' => 'civicrm_financial_type',
'entity_id' => $financialType->id,
'value' => $paymentInstrumentValue,
);
$optionValue = CRM_Core_BAO_OptionValue::retrieve($optionParams, $defaults);
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' "));
+ $relationTypeId = key(CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship', array('condition' => " AND v.name LIKE 'Asset Account is' ")));
$financialParams = array(
'entity_table' => 'civicrm_option_value',
'entity_id' => $optionValue->id,
'id' => $trxn['financial_trxn_id'],
);
if ($context == 'payLater') {
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
+ $relationTypeId = key(CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship', array('condition' => " AND v.name LIKE 'Accounts Receivable Account is' ")));
$compareParams = array(
'status_id' => 1,
'from_financial_account_id' => CRM_Contribute_PseudoConstant::financialAccountType($contribution['financial_type_id'], $relationTypeId),
'version' => 3,
);
$optionValue = civicrm_api('option_value', 'create', $optionParams);
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' "));
+ $relationTypeId = key(CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship', array('condition' => " AND v.name LIKE 'Asset Account is' ")));
$financialParams = array(
'entity_table' => 'civicrm_option_value',
'entity_id' => $optionValue['id'],
<required>true</required>
<add>4.3</add>
<comment>FK to a new civicrm_option_value (account_relationship)</comment>
+ <pseudoconstant>
+ <optionGroupName>account_relationship</optionGroupName>
+ </pseudoconstant>
</field>
<field>
<name>financial_account_id</name>
<required>true</required>
<add>4.3</add>
<comment>FK to the financial_account_id</comment>
+ <pseudoconstant>
+ <table>civicrm_financial_account</table>
+ <keyColumn>id</keyColumn>
+ <labelColumn>name</labelColumn>
+ </pseudoconstant>
</field>
<foreignKey>
<name>financial_account_id</name>
<default>3</default>
<add>4.3</add>
<comment>pseudo FK into civicrm_option_value.</comment>
+ <pseudoconstant>
+ <optionGroupName>financial_account_type</optionGroupName>
+ </pseudoconstant>
</field>
<field>
<name>accounting_code</name>
<type>int unsigned</type>
<comment>FK to civicrm_financial_account</comment>
<add>4.3</add>
+ <pseudoconstant>
+ <table>civicrm_financial_account</table>
+ <keyColumn>id</keyColumn>
+ <labelColumn>name</labelColumn>
+ </pseudoconstant>
</field>
<foreignKey>
<name>financial_account_id</name>
<type>int unsigned</type>
<comment>Payment status: test, paid, part_paid, unpaid (if empty assume unpaid)</comment>
<add>4.3</add>
+ <pseudoconstant>
+ <optionGroupName>financial_item_status</optionGroupName>
+ </pseudoconstant>
</field>
<field>
<name>entity_table</name>
<type>int unsigned</type>
<comment>FK to financial_account table.</comment>
<add>4.3</add>
+ <pseudoconstant>
+ <table>civicrm_financial_account</table>
+ <keyColumn>id</keyColumn>
+ <labelColumn>name</labelColumn>
+ </pseudoconstant>
</field>
<foreignKey>
<name>from_financial_account_id</name>
<type>int unsigned</type>
<comment>FK to financial_financial_account table.</comment>
<add>4.3</add>
+ <pseudoconstant>
+ <table>civicrm_financial_account</table>
+ <keyColumn>id</keyColumn>
+ <labelColumn>name</labelColumn>
+ </pseudoconstant>
</field>
<foreignKey>
<name>to_financial_account_id</name>