remove hardcoded account relationship ID
This commit is contained in:
parent
e00085d701
commit
f05a93ddc5
@ -30,7 +30,11 @@ class CRM_Grant_BAO_GrantBudget extends CRM_Grant_DAO_GrantBudget {
|
||||
'status_id',
|
||||
'Paid'
|
||||
);
|
||||
|
||||
$accountRelationshipId = civicrm_api3('OptionValue', 'getvalue', [
|
||||
'return' => "value",
|
||||
'option_group_id' => "account_relationship",
|
||||
'name' => "Grant Expense Account is",
|
||||
]);
|
||||
$config = CRM_Core_Config::singleton();
|
||||
$mkTime = mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], $fiscalYear);
|
||||
$fiscalStartDate = date('Y-m-d', $mkTime);
|
||||
@ -41,6 +45,7 @@ class CRM_Grant_BAO_GrantBudget extends CRM_Grant_DAO_GrantBudget {
|
||||
2 => [$fiscalStartDate, 'String'],
|
||||
3 => [$fiscalEndDate, 'String'],
|
||||
4 => [$paidStatusID, 'Integer'],
|
||||
5 => [$accountRelationshipId, 'Integer'],
|
||||
];
|
||||
|
||||
$where = '';
|
||||
@ -48,6 +53,7 @@ class CRM_Grant_BAO_GrantBudget extends CRM_Grant_DAO_GrantBudget {
|
||||
$where = 'WHERE cft.id = %5';
|
||||
$qParams[5] = [$params['financial_type_id'], 'Integer'];
|
||||
}
|
||||
|
||||
$grantBudgetTableName = CRM_Grant_DAO_GrantBudget::getTableName();
|
||||
$sql = "SELECT cgb.id, cft.name, IFNULL(cgb.budget, 0) AS budget,
|
||||
SUM(IFNULL(trxn." . GRANT_AMOUNT_CHECK_FIELD . ", 0)) as total_amount_granted,
|
||||
@ -63,7 +69,7 @@ class CRM_Grant_BAO_GrantBudget extends CRM_Grant_DAO_GrantBudget {
|
||||
AND cg." . GRANT_DATE_CHECK_FIELD . " >= %2
|
||||
AND cg." . GRANT_DATE_CHECK_FIELD . " < %3
|
||||
LEFT JOIN civicrm_entity_financial_account cefa
|
||||
ON cefa.entity_table = 'civicrm_financial_type' AND cft.id = cefa.entity_id AND account_relationship = 14
|
||||
ON cefa.entity_table = 'civicrm_financial_type' AND cft.id = cefa.entity_id AND account_relationship = %5
|
||||
LEFT JOIN civicrm_financial_trxn trxn ON trxn.from_financial_account_id = cefa.financial_account_id
|
||||
{$where}
|
||||
GROUP BY cft.id
|
||||
|
Loading…
Reference in New Issue
Block a user