<?php /** * This api exposes CiviCRM GrantBudget. * * @package CiviCRM_APIv3 */ /** * Save a GrantBudget. * * @param array $params * * @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'); } /** * Get a GrantBudget. * * @param array $params * * @return array * Array of retrieved GrantBudget property values. */ function civicrm_api3_grant_budget_get($params) { return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); } /** * Delete a GrantBudget. * * @param array $params * * @return array * Array of deleted values. */ function civicrm_api3_grant_budget_delete($params) { return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params); } /** * Delete a GrantBudget. * * @param array $params * * @return array * Array of deleted values. */ function civicrm_api3_grant_budget_getbudget($params) { $result = CRM_Grant_BAO_GrantBudget::getGrantBudget($params); return civicrm_api3_create_success($result, $params, 'GrantBudget', 'get'); } /** * Adjust metadata for Grant budget action. * * @param $spec */ function _civicrm_api3_grant_budget_getbudget_spec(&$spec) { $spec['fiscal_year'] = [ 'api.required' => 1, 'title' => ts('Fiscal Year'), 'type' => CRM_Utils_Type::T_INT, 'pseudoconstant' => [ 'callback' => 'CRM_Grant_BAO_GrantBudget::getFiscalyear', ], ]; }