Merge pull request #12031 from mukeshcompucorp/fix-template-structure-issues
[civicrm-core.git] / api / v3 / GroupContact.php
index 856ad61bfeae84807c5b034bd61c22498d2648f9..16046437951ff89c9361d761e589592ecab4eb94 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                                |
+ | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2017                                |
  +--------------------------------------------------------------------+
@@ -140,25 +140,25 @@ function civicrm_api3_group_contact_create($params) {
  * Delete group contact record.
  *
  * @param array $params
- *
  * @return array
- *
+ * @throws API_Exception
+ * @throws CiviCRM_API3_Exception
  * @deprecated
  */
 function civicrm_api3_group_contact_delete($params) {
   $checkParams = $params;
   if (!empty($checkParams['status']) && in_array($checkParams['status'], array('Removed', 'Deleted'))) {
-    $checkParams['status'] = 'Added';
+    $checkParams['status'] = array('IN' => array('Added', 'Pending'));
   }
   elseif (!empty($checkParams['status']) && $checkParams['status'] == 'Added') {
-    $checkParams['status'] = 'Removed';
+    $checkParams['status'] = array('IN' => array('Pending', 'Removed'));
   }
   elseif (!empty($checkParams['status'])) {
     unset($checkParams['status']);
   }
   $groupContact = civicrm_api3('GroupContact', 'get', $checkParams);
   if ($groupContact['count'] == 0 && !empty($params['skip_undelete'])) {
-    $checkParams['status'] = 'removed';
+    $checkParams['status'] = array('IN' => array('Removed', 'Pending'));
   }
   $groupContact2 = civicrm_api3('GroupContact', 'get', $checkParams);
   if ($groupContact['count'] == 0 && $groupContact2['count'] == 0) {