Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
6a488035 TO |
2 | /* |
3 | +--------------------------------------------------------------------+ | |
a30c801b | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 5 | | | |
a30c801b TO |
6 | | This work is published under the GNU AGPLv3 license with some | |
7 | | permitted exceptions and without any warranty. For full license | | |
8 | | and copyright information, see https://civicrm.org/licensing | | |
6a488035 TO |
9 | +--------------------------------------------------------------------+ |
10 | */ | |
11 | ||
12 | /** | |
244bbdd8 | 13 | * This api exposes CiviCRM Grant records. |
b081365f CW |
14 | * |
15 | * @note Grant component must be enabled. | |
6a488035 TO |
16 | * |
17 | * @package CiviCRM_APIv3 | |
6a488035 TO |
18 | */ |
19 | ||
6a488035 | 20 | /** |
244bbdd8 | 21 | * Create/update Grant. |
6a488035 | 22 | * |
cf470720 | 23 | * @param array $params |
2e66abf8 | 24 | * Array per getfields metadata. |
6a488035 | 25 | * |
a6c01b45 | 26 | * @return array |
6a488035 TO |
27 | */ |
28 | function civicrm_api3_grant_create($params) { | |
9af2925b | 29 | return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Grant'); |
6a488035 | 30 | } |
11e09c59 TO |
31 | |
32 | /** | |
0aa0303c EM |
33 | * Adjust Metadata for Create action. |
34 | * | |
35 | * The metadata is used for setting defaults, documentation & validation. | |
6a488035 | 36 | * |
cf470720 | 37 | * @param array $params |
b081365f | 38 | * Array of parameters determined by getfields. |
6a488035 TO |
39 | */ |
40 | function _civicrm_api3_grant_create_spec(&$params) { | |
9988c6b3 | 41 | $params['contact_id']['api.required'] = 1; |
6a488035 | 42 | $params['grant_type_id']['api.required'] = 1; |
f4f2cb4c MM |
43 | $params['status_id']['api.required'] = 1; |
44 | $params['amount_total']['api.required'] = 1; | |
cf8f0fff | 45 | $params['status_id']['api.aliases'] = ['grant_status']; |
6a488035 TO |
46 | } |
47 | ||
48 | /** | |
c28e1768 | 49 | * Returns array of grants matching a set of one or more properties. |
6a488035 | 50 | * |
cf470720 | 51 | * @param array $params |
2e66abf8 | 52 | * Array per getfields metadata. |
6a488035 | 53 | * |
a6c01b45 | 54 | * @return array |
72b3a70c | 55 | * Array of matching grants |
6a488035 TO |
56 | */ |
57 | function civicrm_api3_grant_get($params) { | |
9af2925b | 58 | return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Grant'); |
6a488035 TO |
59 | } |
60 | ||
61 | /** | |
244bbdd8 | 62 | * This method is used to delete an existing Grant. |
6a488035 | 63 | * |
cf470720 | 64 | * @param array $params |
244bbdd8 | 65 | * Id of the Grant to be deleted is required. |
6a488035 | 66 | * |
a6c01b45 | 67 | * @return array |
72b3a70c | 68 | * API Result Array |
6a488035 TO |
69 | */ |
70 | function civicrm_api3_grant_delete($params) { | |
71 | return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params); | |
72 | } |