3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
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 +--------------------------------------------------------------------+
30 * APIv3 functions for registering/processing mailing group events.
32 * @package CiviCRM_APIv3
33 * @subpackage API_MailerGroup
34 * @copyright CiviCRM LLC (c) 2004-2014
40 * @deprecated api notice
42 * to indicate this entire api entity is deprecated
44 function _civicrm_api3_mailing_group_deprecation() {
45 return 'The mailing_group api is deprecated. Use the mailing_event apis instead.';
49 * Handle an unsubscribe event
52 * @param array $params
56 function civicrm_api3_mailing_group_event_unsubscribe($params) {
57 return civicrm_api('mailing_event_unsubscribe', 'create', $params);
61 * Handle a site-level unsubscribe event
64 * @param array $params
68 function civicrm_api3_mailing_group_event_domain_unsubscribe($params) {
69 $params['org_unsubscribe'] = 1;
70 return civicrm_api('mailing_event_unsubscribe', 'create', $params);
74 * Handle a resubscription event
77 * @param array $params
81 function civicrm_api3_mailing_group_event_resubscribe($params) {
82 return civicrm_api('mailing_event_resubscribe', 'create', $params);
86 * Handle a subscription event
89 * @param array $params
93 function civicrm_api3_mailing_group_event_subscribe($params) {
94 return civicrm_api('mailing_event_subscribe', 'create', $params);
98 * @param array $params
100 * @throws \API_Exception
102 function civicrm_api3_mailing_group_create($params) {
103 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__
), $params);
107 * @param array $params
111 function civicrm_api3_mailing_group_get($params) {
112 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__
), $params);
116 * @param array $params
118 * @throws \API_Exception
120 function civicrm_api3_mailing_group_delete($params) {
121 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__
), $params);
125 * @param array $params
128 function civicrm_api3_mailing_group_getfields($params) {
129 $dao = _civicrm_api3_get_DAO('Subscribe');
131 $fields = $d->fields();
134 $dao = _civicrm_api3_get_DAO('Unsubscribe');
136 $fields = $fields +
$d->fields();
139 // CRM-13830 - prevent the api wrapper from helping out with pseudoconstants
140 // Since these fields don't belong to this entity it will fail
141 foreach ($fields as &$field) {
142 unset($field['pseudoconstant']);
145 return civicrm_api3_create_success($fields, $params, 'mailing_group', 'getfields');