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 +--------------------------------------------------------------------+
13 * This api exposes CiviCRM phone records.
15 * @package CiviCRM_APIv3
19 * Add an Phone for a contact.
21 * @param array $params
22 * Array per getfields metadata.
26 function civicrm_api3_phone_create($params) {
27 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__
), $params, 'Phone');
31 * Adjust Metadata for Create action.
33 * The metadata is used for setting defaults, documentation & validation.
35 * @param array $params
36 * Array of parameters determined by getfields.
38 function _civicrm_api3_phone_create_spec(&$params) {
39 $params['contact_id']['api.required'] = 1;
40 $params['phone']['api.required'] = 1;
41 // hopefully change to use handleprimary
42 $params['is_primary']['api.default'] = 0;
43 $defaultLocation = CRM_Core_BAO_LocationType
::getDefault();
44 if ($defaultLocation) {
45 $params['location_type_id']['api.default'] = $defaultLocation->id
;
50 * Delete an existing Phone.
52 * @param array $params
53 * Array per getfields metadata.
58 function civicrm_api3_phone_delete($params) {
59 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__
), $params);
63 * civicrm_api('Phone','Get') to retrieve one or more phones is implemented by
64 * function civicrm_api3_phone_get ($params) into the file Phone/Get.php
65 * Could have been implemented here in this file too, but we moved it to illustrate the feature with a real usage.