X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FGroupContact.php;h=e296e18297ad20c8cf3c66468f35954fbdb0353d;hb=a60c0bc84a8db9a4123f53879109576524393ff9;hp=308bb104f852f194db4e46c66d50ce9f049ea410;hpb=7f768717e37801b57add73e3c501ef61cc60327e;p=civicrm-core.git diff --git a/api/v3/GroupContact.php b/api/v3/GroupContact.php index 308bb104f8..e296e18297 100644 --- a/api/v3/GroupContact.php +++ b/api/v3/GroupContact.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 4.7 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2015 | + | Copyright CiviCRM LLC (c) 2004-2016 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -146,6 +146,10 @@ function civicrm_api3_group_contact_create($params) { * @deprecated */ function civicrm_api3_group_contact_delete($params) { + $groupContact = civicrm_api3('GroupContact', 'get', $params); + if ($groupContact['count'] == 0) { + throw new API_Exception('Cannot Delete GroupContact'); + } $params['status'] = CRM_Utils_Array::value('status', $params, empty($params['skip_undelete']) ? 'Removed' : 'Deleted'); // "Deleted" isn't a real option so skip the api wrapper to avoid pseudoconstant validation return civicrm_api3_group_contact_create($params);