Added api

This commit is contained in:
CiviWare Solutions 2018-08-11 22:12:42 +05:30
parent f3d5126406
commit e177d11f36

70
api/v3/GrantBudget.php Normal file
View File

@ -0,0 +1,70 @@
<?php
/**
* This api exposes CiviCRM GrantBudget.
*
* @package CiviCRM_APIv3
*/
/**
* Save a GrantBudget.
*
* @param array $params
*
* @return array
*/
function civicrm_api3_grant_budget_create($params) {
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',
],
];
}