fix grantbudget to handle different currency formats
This commit is contained in:
parent
ed86787d20
commit
38b48eefe9
@ -81,9 +81,9 @@ class CRM_AnnualGrantBudgets_BAO_GrantBudget extends CRM_AnnualGrantBudgets_DAO_
|
|||||||
$grantBudget[] = [
|
$grantBudget[] = [
|
||||||
'id' => $result->id,
|
'id' => $result->id,
|
||||||
'name' => $result->name,
|
'name' => $result->name,
|
||||||
'budget' => CRM_Utils_Money::format($result->budget),
|
'budget' => $result->budget,
|
||||||
'total_amount_granted' => CRM_Utils_Money::format($result->total_amount_granted),
|
'total_amount_granted' => $result->total_amount_granted,
|
||||||
'balance_amount' => CRM_Utils_Money::format(($result->budget - $result->total_amount_granted)),
|
'balance_amount' => $result->budget - $result->total_amount_granted,
|
||||||
'financial_type_id' => $result->financial_type_id,
|
'financial_type_id' => $result->financial_type_id,
|
||||||
'note' => $result->note,
|
'note' => $result->note,
|
||||||
'is_reserved' => $result->is_reserved,
|
'is_reserved' => $result->is_reserved,
|
||||||
@ -125,8 +125,8 @@ class CRM_AnnualGrantBudgets_BAO_GrantBudget extends CRM_AnnualGrantBudgets_DAO_
|
|||||||
])['values'][0];
|
])['values'][0];
|
||||||
|
|
||||||
if ($grantBudget) {
|
if ($grantBudget) {
|
||||||
$balanceAmount = CRM_Utils_Rule::cleanMoney($grantBudget['balance_amount']);
|
$balanceAmount = $grantBudget['balance_amount'];
|
||||||
$amountGranted = CRM_Utils_Rule::cleanMoney($params['multifund_amount'][$k]);
|
$amountGranted = $params['multifund_amount'][$k];
|
||||||
// If there's a $grantId, we're updating an existing grant. Make sure we don't
|
// If there's a $grantId, we're updating an existing grant. Make sure we don't
|
||||||
// double-count this money on validation.
|
// double-count this money on validation.
|
||||||
if ($grantId) {
|
if ($grantId) {
|
||||||
@ -142,7 +142,10 @@ class CRM_AnnualGrantBudgets_BAO_GrantBudget extends CRM_AnnualGrantBudgets_DAO_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($balanceAmount < $amountGranted) {
|
if ($balanceAmount < $amountGranted) {
|
||||||
$errors["multifund_amount[$k]"] = ts("The annual budget for this grant is {$grantBudget['budget']}. Grants totaling {$grantBudget['total_amount_granted']} have been made. {$grantBudget['balance_amount']} remains.");
|
$budgetDisplay = CRM_Utils_Money::format($grantBudget['budget']);
|
||||||
|
$totalGrantedDisplay = CRM_Utils_Money::format($grantBudget['total_amount_granted']);
|
||||||
|
$balanceDisplay = CRM_Utils_Money::format($grantBudget['balance_amount']);
|
||||||
|
$errors["multifund_amount[$k]"] = ts("The annual budget for this grant is $budgetDisplay. Grants totaling $totalGrantedDisplay have been made. $balanceDisplay remains.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user