}
/**
- * call getfields from api wrapper. This function ensures that settings that could alter
- * getfields output (e.g. action for all api & profile_id for profile api ) are consistently passed in.
+ * Call getfields from api wrapper. This function ensures that settings that
+ * could alter getfields output (e.g. action for all api & profile_id for
+ * profile api ) are consistently passed in.
*
- * We check whether the api call is 'getfields' because if getfields is being called we return an empty array
- * as no alias swapping, validation or default filling is done on getfields & we want to avoid a loop
+ * We check whether the api call is 'getfields' because if getfields is
+ * being called we return an empty array as no alias swapping, validation or
+ * default filling is done on getfields & we want to avoid a loop
*
* @todo other output modifiers include contact_type
*
* Convert possibly camel name to underscore separated entity name
*
* @param string $entity
- * Entity name in various formats e.g. Contribution, contribution, OptionValue, option_value, UFJoin, uf_join.
- * @return string $entity entity name in underscore separated format
+ * Entity name in various formats e.g. Contribution, contribution,
+ * OptionValue, option_value, UFJoin, uf_join.
+ * @return string $entity
+ * Entity name in underscore separated format.
*
- * FIXME: Why isn't this called first thing in civicrm_api wrapper?
+ * @fixme Why isn't this called first thing in civicrm_api wrapper?
*/
function _civicrm_api_get_entity_name_from_camel($entity) {
if ($entity == strtolower($entity)) {
civicrm_api3_verify_one_mandatory($params,
NULL,
array(
- 'activity_name', 'activity_type_id', 'activity_label',
+ 'activity_name',
+ 'activity_type_id',
+ 'activity_label',
)
);
}
// If this is a case activity, see if there is an existing activity
// and set it as an old revision. Also retrieve details we'll need.
// this handling should all be moved to the BAO layer
- $case_id = '';
- $createRevision = FALSE;
+ $case_id = '';
+ $createRevision = FALSE;
$oldActivityValues = array();
if (!empty($params['case_id'])) {
$case_id = $params['case_id'];
);
$params['source_contact_id'] = array(
- 'name' => 'source_contact_id',
- 'title' => 'Activity Source Contact',
- 'type' => 1,
- 'FKClassName' => 'CRM_Activity_DAO_ActivityContact',
- 'api.default' => 'user_contact_id',
+ 'name' => 'source_contact_id',
+ 'title' => 'Activity Source Contact',
+ 'type' => 1,
+ 'FKClassName' => 'CRM_Activity_DAO_ActivityContact',
+ 'api.default' => 'user_contact_id',
);
}
function _civicrm_api3_activity_check_params(&$params) {
$contactIDFields = array_intersect_key($params,
- array(
- 'source_contact_id' => 1,
- 'assignee_contact_id' => 1,
- 'target_contact_id' => 1,
- )
+ array(
+ 'source_contact_id' => 1,
+ 'assignee_contact_id' => 1,
+ 'target_contact_id' => 1,
+ )
);
// this should be handled by wrapper layer & probably the api would already manage it
}
$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),
+ 'activity' => CRM_Utils_Array::value('id', $params),
+ 'parent' => CRM_Utils_Array::value('parent_id', $params),
+ 'original' => CRM_Utils_Array::value('original_id', $params),
);
foreach ($activityIds as $id => $value) {
//correctly by doing pseudoconstant validation
// needs testing
$activityTypes = CRM_Activity_BAO_Activity::buildOptions('activity_type_id', 'validate');
- $activityName = CRM_Utils_Array::value('activity_name', $params);
- $activityName = ucfirst($activityName);
+ $activityName = CRM_Utils_Array::value('activity_name', $params);
+ $activityName = ucfirst($activityName);
$activityLabel = CRM_Utils_Array::value('activity_label', $params);
if ($activityLabel) {
$activityTypes = CRM_Activity_BAO_Activity::buildOptions('activity_type_id', 'create');
}
/**
- * @see _civicrm_api3_generic_getlist_params.
+ * @see _civicrm_api3_generic_getlist_params
*
- * @param $request
- * Array.
+ * @param array $request
+ * API request.
*/
function _civicrm_api3_activity_getlist_params(&$request) {
- $fieldsToReturn = array('activity_date_time', 'activity_type_id', 'subject', 'source_contact_id');
+ $fieldsToReturn = array(
+ 'activity_date_time',
+ 'activity_type_id',
+ 'subject',
+ 'source_contact_id',
+ );
$request['params']['return'] = array_unique(array_merge($fieldsToReturn, $request['extra']));
$request['params']['options']['sort'] = 'activity_date_time DESC';
$request['params'] += array(
$data = array(
'id' => $row[$request['id_field']],
'label' => $row[$request['label_field']] ? $row[$request['label_field']] : ts('(no subject)'),
- 'description' => array(CRM_Core_Pseudoconstant::getLabel('CRM_Activity_BAO_Activity', 'activity_type_id', $row['activity_type_id'])),
+ 'description' => array(
+ CRM_Core_Pseudoconstant::getLabel('CRM_Activity_BAO_Activity', 'activity_type_id', $row['activity_type_id']),
+ ),
);
if (!empty($row['activity_date_time'])) {
$data['description'][0] .= ': ' . CRM_Utils_Date::customFormat($row['activity_date_time']);
}
if (!empty($row['source_contact_id'])) {
- $data['description'][] = ts('By %1', array(1 => CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $row['source_contact_id'], 'display_name')));
+ $data['description'][] = ts('By %1', array(
+ 1 => CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $row['source_contact_id'], 'display_name'),
+ ));
}
foreach ($request['extra'] as $field) {
$data['extra'][$field] = isset($row[$field]) ? $row[$field] : NULL;