INFRA-132 - Fix misc oddball syntax
[civicrm-core.git] / api / v3 / GroupContact.php
index fa668214a5575b74dc40a0b58ae92dfd7892bd89..95a48a79ba617e5b0063089d0d07b491b85adc1d 100644 (file)
@@ -3,7 +3,7 @@
 
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
 
 /**
  * This API will give list of the groups for particular contact
- * Particualr status can be sent in params array
+ * Particular status can be sent in params array
  * If no status mentioned in params, by default 'added' will be used
  * to fetch the records
  *
- * @param  array $params  name value pair of contact information
+ * @param array $params
+ *   Name value pair of contact information.
  * {@getfields GroupContact_get}
  *
  * @return  array  list of groups, given contact subsribed to
@@ -62,7 +63,8 @@ function civicrm_api3_group_contact_get($params) {
   }
   $status = CRM_Utils_Array::value('status', $params, 'Added');
 
-  $values = &CRM_Contact_BAO_GroupContact::getContactGroup($params['contact_id'], $status, NULL, FALSE, TRUE);
+  $groupId = CRM_Utils_Array::value('group_id', $params);
+  $values = &CRM_Contact_BAO_GroupContact::getContactGroup($params['contact_id'], $status, NULL, FALSE, TRUE, FALSE, TRUE, $groupId);
   return civicrm_api3_create_success($values, $params);
 }
 
@@ -71,7 +73,8 @@ function civicrm_api3_group_contact_get($params) {
  *
  * @access public
  *
- * @param  array $params Input parameters
+ * @param array $params
+ *   Input parameters.
  *
  * Allowed @params array keys are:<br>
  * "contact_id" (required) : first contact to add<br>
@@ -122,8 +125,7 @@ function civicrm_api3_group_contact_create($params) {
  *
  * @param <type> $params
  *
- * @return <type>
- * @deprecated
+ * @return array <type>@deprecated
  */
 function civicrm_api3_group_contact_delete($params) {
   $params['status'] = CRM_Utils_Array::value('status', $params, empty($params['skip_undelete']) ? 'Removed' : 'Deleted');
@@ -143,8 +145,7 @@ function _civicrm_api3_group_contact_delete_spec(&$params) {
  *
  * @param <type> $params
  *
- * @return <type>
- * @deprecated
+ * @return array|int <type>@deprecated
  */
 function civicrm_api3_group_contact_pending($params) {
   $params['status'] = 'Pending';
@@ -186,10 +187,10 @@ function _civicrm_api3_group_contact_common($params, $op = 'Added') {
   $tracking = CRM_Utils_Array::value('tracking', $params);
 
   if ($op == 'Added' || $op == 'Pending') {
-    $extraReturnValues= array(
+    $extraReturnValues = array(
       'total_count' => 0,
       'added' => 0,
-      'not_added' => 0
+      'not_added' => 0,
     );
     foreach ($groupIDs as $groupID) {
       list($tc, $a, $na) = CRM_Contact_BAO_GroupContact::addContactsToGroup($contactIDs,
@@ -204,10 +205,10 @@ function _civicrm_api3_group_contact_common($params, $op = 'Added') {
     }
   }
   else {
-    $extraReturnValues= array(
+    $extraReturnValues = array(
       'total_count' => 0,
       'removed' => 0,
-      'not_removed' => 0
+      'not_removed' => 0,
     );
     foreach ($groupIDs as $groupID) {
       list($tc, $r, $nr) = CRM_Contact_BAO_GroupContact::removeContactsFromGroup($contactIDs, $groupID, $method, $status, $tracking);
@@ -238,3 +239,15 @@ function civicrm_api3_group_contact_update_status($params) {
   return TRUE;
 }
 
+/**
+ * @deprecated api notice
+ * @return array of deprecated actions
+ */
+function _civicrm_api3_group_contact_deprecation() {
+  return array(
+    'delete' => 'GroupContact "delete" action is deprecated in favor of "create".',
+    'pending' => 'GroupContact "pending" action is deprecated in favor of "create".',
+    'update_status' => 'GroupContact "update_status" action is deprecated in favor of "create".',
+  );
+}
+