3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
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 |
9 +--------------------------------------------------------------------+
14 * This api exposes CiviCRM price field values.
16 * PriceFields may contain zero or more PriceFieldValues.
17 * Use chaining to create PriceFields and values in one api call.
19 * @package CiviCRM_APIv3
23 * Create or update a PriceFieldValue.
25 * @param array $params
26 * name/value pairs to insert in new 'PriceFieldValue'
31 function civicrm_api3_price_field_value_create($params) {
33 if (!empty($params['id'])) {
34 $ids['id'] = $params['id'];
37 $bao = CRM_Price_BAO_PriceFieldValue
::create($params, $ids);
40 _civicrm_api3_object_to_array($bao, $values[$bao->id
]);
41 return civicrm_api3_create_success($values, $params, 'PriceFieldValue', 'create', $bao);
46 * Adjust Metadata for Create action.
48 * The metadata is used for setting defaults, documentation & validation.
50 * @param array $params
51 * Array of parameters determined by getfields.
53 function _civicrm_api3_price_field_value_create_spec(&$params) {
54 $params['price_field_id']['api.required'] = TRUE;
55 $params['label']['api.required'] = TRUE;
56 $params['amount']['api.required'] = TRUE;
57 $params['is_active']['api.default'] = TRUE;
58 $params['financial_type_id']['api.default'] = TRUE;
62 * Returns array of PriceFieldValues matching a set of one or more group properties.
64 * @param array $params
65 * Array of one or more valid property_name=>value pairs. If $params is set.
66 * as null, all price_field_values will be returned (default limit is 25)
71 function civicrm_api3_price_field_value_get($params) {
72 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__
), $params);
76 * Delete an existing PriceFieldValue.
78 * This method is used to delete any existing PriceFieldValue given its id.
80 * @param array $params
81 * Array containing id of the group to be deleted.
86 function civicrm_api3_price_field_value_delete($params) {
87 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__
), $params);