From b5c998846e4d892a713f1b002831a686a0e68429 Mon Sep 17 00:00:00 2001 From: Civiware Solutions Date: Sat, 11 Aug 2018 23:21:25 +0530 Subject: [PATCH] Changes to code --- CRM/Grant/BAO/GrantBudget.php | 9 +++++---- CRM/Grant/Page/AnnualBudgets.php | 10 ++++++++++ api/v3/GrantBudget.php | 3 +++ templates/CRM/Grant/Page/AnnualBudgets.tpl | 19 ++++++++++++++++++- xml/Menu/annualgrantbudgets.xml | 2 +- 5 files changed, 37 insertions(+), 6 deletions(-) diff --git a/CRM/Grant/BAO/GrantBudget.php b/CRM/Grant/BAO/GrantBudget.php index a641fac..027acb8 100644 --- a/CRM/Grant/BAO/GrantBudget.php +++ b/CRM/Grant/BAO/GrantBudget.php @@ -37,17 +37,18 @@ class CRM_Grant_BAO_GrantBudget extends CRM_Grant_DAO_GrantBudget { LEFT JOIN civicrm_grant cg ON cg.financial_type_id = cft.id AND cg.status_id IN (%4) AND cg.decision_date >= %2 AND cg.decision_date <= %3 - $where + {$where} GROUP BY cft.id ORDER BY cft.name"; $result = CRM_Core_DAO::executeQuery($sql, $qParams); while ($result->fetch()) { $grantBudget[$result->id] = [ + 'id' => $result->id, 'name' => $result->name, - 'budget' => $result->budget, - 'total_amount_granted' => $result->total_amount_granted, - 'balance_amount' => ($result->budget - $result->total_amount_granted), + 'budget' => CRM_Utils_Money::format($result->budget), + 'total_amount_granted' => CRM_Utils_Money::format($result->total_amount_granted), + 'balance_amount' => CRM_Utils_Money::format(($result->budget - $result->total_amount_granted)), ]; } return $grantBudget; diff --git a/CRM/Grant/Page/AnnualBudgets.php b/CRM/Grant/Page/AnnualBudgets.php index 52788bc..810cf7e 100644 --- a/CRM/Grant/Page/AnnualBudgets.php +++ b/CRM/Grant/Page/AnnualBudgets.php @@ -43,6 +43,16 @@ class CRM_Grant_Page_AnnualBudgets extends CRM_Core_Page_Basic { return ts('Annual Grant Budget'); } + /** + * Get name of edit form. + * + * @return string + * Classname of edit form. + */ + public function editForm() { + return 'CRM_Grant_Page_AnnualBudgets'; + } + /** * Get user context. * diff --git a/api/v3/GrantBudget.php b/api/v3/GrantBudget.php index 43fd86c..fcac915 100644 --- a/api/v3/GrantBudget.php +++ b/api/v3/GrantBudget.php @@ -13,6 +13,9 @@ * @return array */ function civicrm_api3_grant_budget_create($params) { + if (!empty($params['budget'])) { + $params['budget'] = CRM_Utils_Rule::cleanMoney($params['budget']); + } return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'GrantBudget'); } diff --git a/templates/CRM/Grant/Page/AnnualBudgets.tpl b/templates/CRM/Grant/Page/AnnualBudgets.tpl index a49c7ff..80ba8a1 100644 --- a/templates/CRM/Grant/Page/AnnualBudgets.tpl +++ b/templates/CRM/Grant/Page/AnnualBudgets.tpl @@ -1,3 +1,20 @@
- + + + + + + + + {crmAPI var='result' entity='GrantBudget' action='getbudget' fiscal_year=2018} + {foreach from=$result.values item=row} + + + + + + + {/foreach} +
{ts}Endowement{/ts}{ts}Annual Budget{/ts}{ts}Amount Awarded{/ts}{ts}Amound Remaining{/ts}
{$row.name}{$row.budget}{$row.total_amount_granted}{$row.balance_amount}
+ {crmButton p="civicrm" q="reset=1" class="cancel" icon="times"}{ts}Done{/ts}{/crmButton}
diff --git a/xml/Menu/annualgrantbudgets.xml b/xml/Menu/annualgrantbudgets.xml index c7d51bc..467da59 100644 --- a/xml/Menu/annualgrantbudgets.xml +++ b/xml/Menu/annualgrantbudgets.xml @@ -3,7 +3,7 @@ civicrm/grant/annual/budgets CRM_Grant_Page_AnnualBudgets - Grant Annual Budgets + Scholarship Annual Award Budgets access CiviCRM