3 +--------------------------------------------------------------------+
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2019 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
29 * The ActivityType api is deprecated. Please use the OptionValue api instead.
33 * @package CiviCRM_APIv3
37 * Notification of deprecated function.
39 * @deprecated api notice
41 * to indicate this entire api entity is deprecated
43 function _civicrm_api3_activity_type_deprecation() {
44 return 'The ActivityType api is deprecated. Please use the OptionValue api instead.';
48 * Retrieve activity types.
50 * @param array $params
53 * activity types keyed by id
54 * @deprecated - use the getoptions action instead
56 function civicrm_api3_activity_type_get($params) {
58 $activityTypes = CRM_Core_OptionGroup
::values('activity_type');
59 return civicrm_api3_create_success($activityTypes, $params, 'activity_type', 'get');
63 * Create activity type.
65 * @param array $params
68 * created / updated activity type
70 * @deprecated use the OptionValue api instead
72 function civicrm_api3_activity_type_create($params) {
76 if ($optionValueID = CRM_Utils_Array
::value('option_value_id', $params)) {
80 $activityObject = CRM_Core_OptionValue
::addOptionValue($params, 'activity_type', $action, $optionValueID);
81 $activityType = array();
82 _civicrm_api3_object_to_array($activityObject, $activityType[$activityObject->id
]);
83 return civicrm_api3_create_success($activityType, $params, 'activity_type', 'create');
87 * Adjust Metadata for Create action.
89 * The metadata is used for setting defaults, documentation & validation.
91 * @param array $params
92 * Array of parameters determined by getfields.
94 function _civicrm_api3_activity_type_create_spec(&$params) {
95 $params['label'] = array(
98 'type' => CRM_Utils_Type
::T_STRING
,
100 $params['weight'] = array(
103 'type' => CRM_Utils_Type
::T_STRING
,
108 * Delete ActivityType.
110 * @param array $params
111 * Array including id of activity_type to delete.
112 * @return array API result array
113 * @throws API_Exception
114 * @deprecated use OptionValue api
116 function civicrm_api3_activity_type_delete($params) {
117 $result = CRM_Core_BAO_OptionValue
::del($params['id']);
119 return civicrm_api3_create_success(TRUE, $params);
121 throw new API_Exception("Failure to delete activity type id {$params['id']}");