本文整理汇总了PHP中CRM_Financial_BAO_FinancialAccount::getFinancialAccountForFinancialTypeByRelationship方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Financial_BAO_FinancialAccount::getFinancialAccountForFinancialTypeByRelationship方法的具体用法?PHP CRM_Financial_BAO_FinancialAccount::getFinancialAccountForFinancialTypeByRelationship怎么用?PHP CRM_Financial_BAO_FinancialAccount::getFinancialAccountForFinancialTypeByRelationship使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Financial_BAO_FinancialAccount
的用法示例。
在下文中一共展示了CRM_Financial_BAO_FinancialAccount::getFinancialAccountForFinancialTypeByRelationship方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFinancialAccountForStatusChangeTrxn
/**
* Get the financial account for the item associated with the new transaction.
*
* @param array $params
* @param CRM_Financial_BAO_FinancialItem $prevFinancialItem
*
* @return int
*/
public static function getFinancialAccountForStatusChangeTrxn($params, $prevFinancialItem)
{
if (!empty($params['financial_account_id'])) {
return $params['financial_account_id'];
}
$contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus($params['contribution_status_id'], 'name');
$preferredAccountsRelationships = array('Refunded' => 'Credit/Contra Revenue Account is', 'Chargeback' => 'Chargeback Account is');
if (in_array($contributionStatus, array_keys($preferredAccountsRelationships))) {
$financialTypeID = !empty($params['financial_type_id']) ? $params['financial_type_id'] : $params['prevContribution']->financial_type_id;
return CRM_Financial_BAO_FinancialAccount::getFinancialAccountForFinancialTypeByRelationship($financialTypeID, $preferredAccountsRelationships[$contributionStatus]);
}
return $prevFinancialItem->financial_account_id;
}
示例2: testGetFinancialAccountByFinancialTypeAndRelationshipCustomAddedRefunded
/**
* Test getting financial account for a given financial Type with a particular relationship.
*/
public function testGetFinancialAccountByFinancialTypeAndRelationshipCustomAddedRefunded()
{
$financialAccount = $this->callAPISuccess('FinancialAccount', 'create', array('name' => 'Refund Account', 'is_active' => TRUE));
$this->callAPISuccess('EntityFinancialAccount', 'create', array('entity_id' => 2, 'entity_table' => 'civicrm_financial_type', 'account_relationship' => 'Credit/Contra Revenue Account is', 'financial_account_id' => 'Refund Account'));
$this->assertEquals($financialAccount['id'], CRM_Financial_BAO_FinancialAccount::getFinancialAccountForFinancialTypeByRelationship(2, 'Credit/Contra Revenue Account is'));
}