/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
/**
* 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}
*
return $errors;
}
-
// processing for custom data
$values = $activityArray = array();
_civicrm_api3_custom_format_params($params, $values, 'Activity');
/**
* 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) {
/**
* 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
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');
}
*
* 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
*/
$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;
/**
* 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
}
/**
- * 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) {
}
}
-
$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),
);
$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)) {
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
/**
* @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');
/**
* @see _civicrm_api3_generic_getlist_output
*
- * @param $result array
- * @param $request array
+ * @param $result
+ * Array.
+ * @param $request
+ * Array.
*
* @return array
*/
}
return $output;
}
-