Merge pull request #23892 from eileenmcnaughton/order
[civicrm-core.git] / api / v3 / Batch.php
CommitLineData
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 9 +--------------------------------------------------------------------+
d25dd0ee 10 */
6a488035
TO
11
12/**
244bbdd8 13 * This api exposes CiviCRM Batch records.
6a488035
TO
14 *
15 * @package CiviCRM_APIv3
6a488035
TO
16 */
17
18/**
61fe4988 19 * Save a Batch.
6a488035 20 *
c490a46a 21 * @param array $params
77b97be7 22 *
a6c01b45 23 * @return array
58f5a267 24 * @throws \API_Exception
25 * @throws \Civi\API\Exception\UnauthorizedException
6a488035
TO
26 */
27function civicrm_api3_batch_create($params) {
1237d8d7 28 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Batch');
6a488035
TO
29}
30
87a2386c 31/**
0aa0303c
EM
32 * Adjust Metadata for Create action.
33 *
34 * The metadata is used for setting defaults, documentation & validation.
87a2386c 35 *
cf470720 36 * @param array $params
b081365f 37 * Array of parameters determined by getfields.
87a2386c
E
38 */
39function _civicrm_api3_batch_create_spec(&$params) {
58f5a267 40 $params['created_id']['api.default'] = 'user_contact_id';
41 $params['created_date']['api.default'] = 'now';
42 $params['modified_id']['api.default'] = 'user_contact_id';
43 $params['modified_date']['api.default'] = 'now';
87a2386c
E
44 $params['status_id']['api.required'] = 1;
45 $params['title']['api.required'] = 1;
46 $params['status_id']['api.required'] = 1;
47}
48
6a488035 49/**
9d32e6f7 50 * Get a Batch.
6a488035 51 *
c490a46a 52 * @param array $params
77b97be7 53 *
a6c01b45 54 * @return array
16b10e64 55 * Array of retrieved batch property values.
6a488035
TO
56 */
57function civicrm_api3_batch_get($params) {
58 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
59}
60
61/**
9d32e6f7 62 * Delete a Batch.
6a488035 63 *
c490a46a 64 * @param array $params
77b97be7 65 *
a6c01b45 66 * @return array
16b10e64 67 * Array of deleted values.
58f5a267 68 * @throws \API_Exception
69 * @throws \Civi\API\Exception\UnauthorizedException
6a488035
TO
70 */
71function civicrm_api3_batch_delete($params) {
72 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
73}