INFRA-132 - Remove extra spaces around '.'
[civicrm-core.git] / api / v3 / Activity.php
index 4e46c49e2fb450c7857f5923c5bb9d8336315a36..fc1e693f6dad686a97bdc647bcaa8fec34c7c2b0 100644 (file)
@@ -3,7 +3,7 @@
 
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -41,7 +41,8 @@
 /**
  * Creates or updates an Activity. See the example for usage
  *
- * @param array $params Associative array of property name/value
+ * @param array $params
+ *   Associative array of property name/value.
  *                             pairs for the activity.
  * {@getfields activity_create}
  *
@@ -75,7 +76,6 @@ function civicrm_api3_activity_create($params) {
     return $errors;
   }
 
-
   // processing for custom data
   $values = $activityArray = array();
   _civicrm_api3_custom_format_params($params, $values, 'Activity');
@@ -177,7 +177,8 @@ function civicrm_api3_activity_create($params) {
 /**
  * Specify Meta data for create. Note that this data is retrievable via the getfields function
  * and is used for pre-filling defaults and ensuring mandatory requirements are met.
- * @param array $params (reference) array of parameters determined by getfields
+ * @param array $params
+ *   (reference) array of parameters determined by getfields.
  */
 function _civicrm_api3_activity_create_spec(&$params) {
 
@@ -212,7 +213,8 @@ function _civicrm_api3_activity_create_spec(&$params) {
 /**
  * Gets a CiviCRM activity according to parameters
  *
- * @param array  $params       Associative array of property name/value
+ * @param array $params
+ *   Associative array of property name/value.
  *                             pairs for the activity.
  *
  * @return array
@@ -233,8 +235,8 @@ function civicrm_api3_activity_get($params) {
   else {
     $activities = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE);
   }
-  $options = _civicrm_api3_get_options_from_params($params, FALSE,'activity','get');
-  if($options['is_count']) {
+  $options = _civicrm_api3_get_options_from_params($params, FALSE, 'activity', 'get');
+  if ($options['is_count']) {
     return civicrm_api3_create_success($activities, $params, 'activity', 'get');
   }
 
@@ -248,7 +250,8 @@ function civicrm_api3_activity_get($params) {
  *
  * NOTE: Called by civicrm-core and CiviHR
  *
- * @param array $params API request parameters
+ * @param array $params
+ *   API request parameters.
  * @param array $activities
  * @return array new activities list
  */
@@ -274,16 +277,19 @@ function _civicrm_api3_activity_get_formatResult($params, $activities) {
           $activities[$key]['assignee_contact_id'] = CRM_Activity_BAO_ActivityAssignment::retrieveAssigneeIdsByActivityId($activityArray['id']);
         }
         break;
+
       case 'target_contact_id':
         foreach ($activities as $key => $activityArray) {
           $activities[$key]['target_contact_id'] = CRM_Activity_BAO_ActivityTarget::retrieveTargetIdsByActivityId($activityArray['id']);
         }
         break;
+
       case 'source_contact_id':
         foreach ($activities as $key => $activityArray) {
           $activities[$key]['source_contact_id'] = CRM_Activity_BAO_Activity::getSourceContactID($activityArray['id']);
         }
         break;
+
       default:
         if (substr($n, 0, 6) == 'custom') {
           $returnProperties[$n] = $v;
@@ -303,7 +309,8 @@ function _civicrm_api3_activity_get_formatResult($params, $activities) {
 /**
  * Delete a specified Activity.
  *
- * @param array $params array holding 'id' of activity to be deleted
+ * @param array $params
+ *   Array holding 'id' of activity to be deleted.
  * {@getfields activity_delete}
  *
  * @throws API_Exception
@@ -326,14 +333,13 @@ function civicrm_api3_activity_delete($params) {
 }
 
 /**
- * Function to check for required params
+ * Check for required params
  *
- * @param array $params associated array of fields
+ * @param array $params
+ *   Associated array of fields.
  *
  * @throws API_Exception
  * @throws Exception
- * @internal param bool $addMode true for add mode
- *
  * @return array $error array with errors
  */
 function _civicrm_api3_activity_check_params(&$params) {
@@ -365,18 +371,17 @@ function _civicrm_api3_activity_check_params(&$params) {
       }
     }
 
-
     $sql = '
 SELECT  count(*)
   FROM  civicrm_contact
  WHERE  id IN (' . implode(', ', $contactIds) . ' )';
     if (count($contactIds) != CRM_Core_DAO::singleValueQuery($sql)) {
-      throw new API_Exception('Invalid ' .  ' Contact Id');
+      throw new API_Exception('Invalid ' . ' Contact Id');
     }
   }
 
-
-  $activityIds = array('activity' => CRM_Utils_Array::value('id', $params),
+  $activityIds = array(
+  'activity' => CRM_Utils_Array::value('id', $params),
                  'parent' => CRM_Utils_Array::value('parent_id', $params),
                  'original' => CRM_Utils_Array::value('original_id', $params),
   );
@@ -405,7 +410,7 @@ SELECT  count(*)
     $activityTypeIdInList = array_search(($activityName ? $activityName : $activityLabel), $activityTypes);
 
     if (!$activityTypeIdInList) {
-      $errorString = $activityName ? "Invalid Activity Name : $activityName"  : "Invalid Activity Type Label";
+      $errorString = $activityName ? "Invalid Activity Name : $activityName" : "Invalid Activity Type Label";
       throw new Exception($errorString);
     }
     elseif ($activityTypeId && ($activityTypeId != $activityTypeIdInList)) {
@@ -426,7 +431,6 @@ SELECT  count(*)
     throw new API_Exception('Invalid Activity Duration (in minutes)');
   }
 
-
   //if adding a new activity & date_time not set make it now
   // this should be managed by the wrapper layer & setting ['api.default'] in speces
   // needs testing
@@ -440,7 +444,8 @@ SELECT  count(*)
 /**
  * @see _civicrm_api3_generic_getlist_params.
  *
- * @param $request array
+ * @param $request
+ *   Array.
  */
 function _civicrm_api3_activity_getlist_params(&$request) {
   $fieldsToReturn = array('activity_date_time', 'activity_type_id', 'subject', 'source_contact_id');
@@ -455,8 +460,10 @@ function _civicrm_api3_activity_getlist_params(&$request) {
 /**
  * @see _civicrm_api3_generic_getlist_output
  *
- * @param $result array
- * @param $request array
+ * @param $result
+ *   Array.
+ * @param $request
+ *   Array.
  *
  * @return array
  */
@@ -483,4 +490,3 @@ function _civicrm_api3_activity_getlist_output($result, $request) {
   }
   return $output;
 }
-