const UNAUTHORIZED = 'unauthorized';
const NOT_IMPLEMENTED = 'not-found';
- private $extraParams = array();
+ private $extraParams = [];
/**
* Class constructor.
* @param Exception|NULL $previous
* A previous exception which caused this new exception.
*/
- public function __construct($message, $error_code = 0, $extraParams = array(), Exception $previous = NULL) {
+ public function __construct($message, $error_code = 0, $extraParams = [], Exception $previous = NULL) {
// Using int for error code "old way") ?
if (is_numeric($error_code)) {
$code = $error_code;
$code = 0;
}
parent::__construct(ts($message), $code, $previous);
- $this->extraParams = $extraParams + array('error_code' => $error_code);
+ $this->extraParams = $extraParams + ['error_code' => $error_code];
}
/**
* @return array
*/
public function getErrorCodes() {
- return array(
+ return [
2000 => '$params was not an array',
2001 => 'Invalid Value for Date field',
2100 => 'String value is longer than permitted length',
self::UNAUTHORIZED => 'Unauthorized',
self::NOT_IMPLEMENTED => 'Entity or method is not implemented',
- );
+ ];
}
}
* API_Exception from the api wrapper as the namespace is more generic
*/
class CiviCRM_API3_Exception extends Exception {
- private $extraParams = array();
+ private $extraParams = [];
/**
* Class constructor.
* @param Exception|NULL $previous
* A previous exception which caused this new exception.
*/
- public function __construct($message, $error_code = 0, $extraParams = array(), Exception $previous = NULL) {
+ public function __construct($message, $error_code = 0, $extraParams = [], Exception $previous = NULL) {
parent::__construct(ts($message));
- $this->extraParams = $extraParams + array('error_code' => $error_code);
+ $this->extraParams = $extraParams + ['error_code' => $error_code];
}
/**
* @throws CiviCRM_API3_Exception
* @return array
*/
-function civicrm_api3($entity, $action, $params = array()) {
+function civicrm_api3($entity, $action, $params = []) {
$params['version'] = 3;
$result = \Civi::service('civi_api_kernel')->runSafe($entity, $action, $params);
if (is_array($result) && !empty($result['is_error'])) {
// $apiRequest['params']['action'] = $apiRequest['params']['api_action'];
// unset($apiRequest['params']['api_action']);
}
- return array('action' => array('api.aliases' => array('api_action')));
+ return ['action' => ['api.aliases' => ['api_action']]];
}
- $getFieldsParams = array('action' => $apiRequest['action']);
+ $getFieldsParams = ['action' => $apiRequest['action']];
$entity = $apiRequest['entity'];
if ($entity == 'Profile' && array_key_exists('profile_id', $apiRequest['params'])) {
$getFieldsParams['profile_id'] = $apiRequest['params']['profile_id'];
*/
public function __construct($config = NULL) {
$this->local = TRUE;
- $this->input = array();
- $this->lastResult = array();
+ $this->input = [];
+ $this->lastResult = [];
if (isset($config) && isset($config['server'])) {
// we are calling a remote server via REST
$this->local = FALSE;
*
* @return \stdClass
*/
- private function remoteCall($entity, $action, $params = array()) {
+ private function remoteCall($entity, $action, $params = []) {
$query = $this->uri . "?entity=$entity&action=$action";
- $fields = http_build_query(array(
+ $fields = http_build_query([
'key' => $this->key,
'api_key' => $this->api_key,
'json' => json_encode($params),
- ));
+ ]);
if (function_exists('curl_init')) {
// To facilitate debugging without leaking info, entity & action
$res->is_error = 1;
$res->error_message = curl_error($ch);
$res->level = "cURL";
- $res->error = array('cURL error' => curl_error($ch));
+ $res->error = ['cURL error' => curl_error($ch)];
return $res;
}
curl_close($ch);
$res->is_error = 1;
$res->error_message = 'Unable to parse returned JSON';
$res->level = 'json_decode';
- $res->error = array('Unable to parse returned JSON' => $result);
+ $res->error = ['Unable to parse returned JSON' => $result];
$res->row_result = $result;
}
return $res;
*
* @return bool
*/
- private function call($entity, $action = 'Get', $params = array()) {
+ private function call($entity, $action = 'Get', $params = []) {
if (is_int($params)) {
- $params = array('id' => $params);
+ $params = ['id' => $params];
}
elseif (is_string($params)) {
$params = json_decode($params);
$this->lastResult = json_decode(json_encode(civicrm_api($entity, $action, $params)));
}
// Reset the input to be ready for a new call.
- $this->input = array();
+ $this->input = [];
if (property_exists($this->lastResult, 'is_error')) {
return !$this->lastResult->is_error;
}
* @return array
*/
function civicrm_api3_action_schedule_create($params) {
- civicrm_api3_verify_one_mandatory($params, NULL, array('start_action_date', 'absolute_date'));
+ civicrm_api3_verify_one_mandatory($params, NULL, ['start_action_date', 'absolute_date']);
if (!array_key_exists('name', $params) && !array_key_exists('id', $params)) {
$params['name'] = CRM_Utils_String::munge($params['title']);
}
// an update does not require any mandatory parameters
civicrm_api3_verify_one_mandatory($params,
NULL,
- array(
+ [
'activity_name',
'activity_type_id',
'activity_label',
- )
+ ]
);
}
}
// processing for custom data
- $values = $activityArray = array();
+ $values = $activityArray = [];
_civicrm_api3_custom_format_params($params, $values, 'Activity');
if (!empty($values['custom'])) {
// this handling should all be moved to the BAO layer
$case_id = '';
$createRevision = FALSE;
- $oldActivityValues = array();
+ $oldActivityValues = [];
// Lookup case id if not supplied
if (!isset($params['case_id']) && !empty($params['id'])) {
$params['case_id'] = CRM_Core_DAO::singleValueQuery("SELECT case_id FROM civicrm_case_activity WHERE activity_id = " . (int) $params['id']);
if (!empty($params['case_id'])) {
$case_id = $params['case_id'];
if (!empty($params['id']) && Civi::settings()->get('civicaseActivityRevisions')) {
- $oldActivityParams = array('id' => $params['id']);
+ $oldActivityParams = ['id' => $params['id']];
if (!$oldActivityValues) {
CRM_Activity_BAO_Activity::retrieve($oldActivityParams, $oldActivityValues);
}
if ($case_id && $isNew && !$createRevision) {
// If this is a brand new case activity, add to case(s)
foreach ((array) $case_id as $singleCaseId) {
- $caseActivityParams = array('activity_id' => $activityBAO->id, 'case_id' => $singleCaseId);
+ $caseActivityParams = ['activity_id' => $activityBAO->id, 'case_id' => $singleCaseId];
CRM_Case_BAO_Case::processCaseActivity($caseActivityParams);
}
}
*/
function _civicrm_api3_activity_create_spec(&$params) {
- $params['status_id']['api.aliases'] = array('activity_status');
+ $params['status_id']['api.aliases'] = ['activity_status'];
- $params['assignee_contact_id'] = array(
+ $params['assignee_contact_id'] = [
'name' => 'assignee_id',
'title' => 'Activity Assignee',
'description' => 'Contact(s) assigned to this activity.',
'type' => 1,
'FKClassName' => 'CRM_Contact_DAO_Contact',
'FKApiName' => 'Contact',
- );
- $params['target_contact_id'] = array(
+ ];
+ $params['target_contact_id'] = [
'name' => 'target_id',
'title' => 'Activity Target',
'description' => 'Contact(s) participating in this activity.',
'type' => 1,
'FKClassName' => 'CRM_Contact_DAO_Contact',
'FKApiName' => 'Contact',
- );
+ ];
- $params['source_contact_id'] = array(
+ $params['source_contact_id'] = [
'name' => 'source_contact_id',
'title' => 'Activity Source Contact',
'description' => 'Person who created this activity. Defaults to current user.',
'api.default' => 'user_contact_id',
'FKApiName' => 'Contact',
'api.required' => TRUE,
- );
+ ];
- $params['case_id'] = array(
+ $params['case_id'] = [
'name' => 'case_id',
'title' => 'Case ID',
'description' => 'For creating an activity as part of a case.',
'type' => 1,
'FKClassName' => 'CRM_Case_DAO_Case',
'FKApiName' => 'Case',
- );
+ ];
}
* @param array $params
*/
function _civicrm_api3_activity_get_spec(&$params) {
- $params['tag_id'] = array(
+ $params['tag_id'] = [
'title' => 'Tags',
'description' => 'Find activities with specified tags.',
'type' => CRM_Utils_Type::T_INT,
'FKClassName' => 'CRM_Core_DAO_Tag',
'FKApiName' => 'Tag',
'supports_joins' => TRUE,
- );
- $params['file_id'] = array(
+ ];
+ $params['file_id'] = [
'title' => 'Attached Files',
'description' => 'Find activities with attached files.',
'type' => CRM_Utils_Type::T_INT,
'FKClassName' => 'CRM_Core_DAO_File',
'FKApiName' => 'File',
- );
- $params['case_id'] = array(
+ ];
+ $params['case_id'] = [
'title' => 'Cases',
'description' => 'Find activities within specified cases.',
'type' => CRM_Utils_Type::T_INT,
'FKClassName' => 'CRM_Case_DAO_Case',
'FKApiName' => 'Case',
'supports_joins' => TRUE,
- );
- $params['contact_id'] = array(
+ ];
+ $params['contact_id'] = [
'title' => 'Activity Contact ID',
'description' => 'Find activities involving this contact (as target, source, OR assignee).',
'type' => CRM_Utils_Type::T_INT,
'FKClassName' => 'CRM_Contact_DAO_Contact',
'FKApiName' => 'Contact',
- );
- $params['target_contact_id'] = array(
+ ];
+ $params['target_contact_id'] = [
'title' => 'Target Contact ID',
'description' => 'Find activities with specified target contact.',
'type' => CRM_Utils_Type::T_INT,
'FKClassName' => 'CRM_Contact_DAO_Contact',
'FKApiName' => 'Contact',
- );
- $params['source_contact_id'] = array(
+ ];
+ $params['source_contact_id'] = [
'title' => 'Source Contact ID',
'description' => 'Find activities with specified source contact.',
'type' => CRM_Utils_Type::T_INT,
'FKClassName' => 'CRM_Contact_DAO_Contact',
'FKApiName' => 'Contact',
- );
- $params['assignee_contact_id'] = array(
+ ];
+ $params['assignee_contact_id'] = [
'title' => 'Assignee Contact ID',
'description' => 'Find activities with specified assignee contact.',
'type' => CRM_Utils_Type::T_INT,
'FKClassName' => 'CRM_Contact_DAO_Contact',
'FKApiName' => 'Contact',
- );
- $params['is_overdue'] = array(
+ ];
+ $params['is_overdue'] = [
'title' => 'Is Activity Overdue',
'description' => 'Incomplete activities with a past date.',
'type' => CRM_Utils_Type::T_BOOLEAN,
- );
+ ];
}
/**
*/
function _civicrm_api3_activity_get_extraFilters(&$params, &$sql) {
// Filter by activity contacts
- $activityContactOptions = array(
+ $activityContactOptions = [
'contact_id' => NULL,
'target_contact_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_ActivityContact', 'record_type_id', 'Activity Targets'),
'source_contact_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_ActivityContact', 'record_type_id', 'Activity Source'),
'assignee_contact_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_ActivityContact', 'record_type_id', 'Activity Assignees'),
- );
+ ];
foreach ($activityContactOptions as $activityContactName => $activityContactValue) {
if (!empty($params[$activityContactName])) {
if (!is_array($params[$activityContactName])) {
- $params[$activityContactName] = array('=' => $params[$activityContactName]);
+ $params[$activityContactName] = ['=' => $params[$activityContactName]];
}
$clause = \CRM_Core_DAO::createSQLFilter('contact_id', $params[$activityContactName]);
$typeClause = $activityContactValue ? 'record_type_id = #typeId AND ' : '';
$sql->where("a.id IN (SELECT activity_id FROM civicrm_activity_contact WHERE $typeClause !clause)",
- array('#typeId' => $activityContactValue, '!clause' => $clause)
+ ['#typeId' => $activityContactValue, '!clause' => $clause]
);
}
}
// Subqueries are nice in (a) avoiding duplicates and (b) when the result
// list is expected to be bite-sized. Joins are nice (a) with larger
// datasets and (b) checking for non-existent relations.
- $rels = array(
- 'tag_id' => array(
+ $rels = [
+ 'tag_id' => [
'subquery' => 'a.id IN (SELECT entity_id FROM civicrm_entity_tag WHERE entity_table = "civicrm_activity" AND !clause)',
'join' => '!joinType civicrm_entity_tag !alias ON (!alias.entity_table = "civicrm_activity" AND !alias.entity_id = a.id)',
'column' => 'tag_id',
- ),
- 'file_id' => array(
+ ],
+ 'file_id' => [
'subquery' => 'a.id IN (SELECT entity_id FROM civicrm_entity_file WHERE entity_table = "civicrm_activity" AND !clause)',
'join' => '!joinType civicrm_entity_file !alias ON (!alias.entity_table = "civicrm_activity" AND !alias.entity_id = a.id)',
'column' => 'file_id',
- ),
- 'case_id' => array(
+ ],
+ 'case_id' => [
'subquery' => 'a.id IN (SELECT activity_id FROM civicrm_case_activity WHERE !clause)',
'join' => '!joinType civicrm_case_activity !alias ON (!alias.activity_id = a.id)',
'column' => 'case_id',
- ),
- );
+ ],
+ ];
foreach ($rels as $filter => $relSpec) {
if (!empty($params[$filter])) {
if (!is_array($params[$filter])) {
- $params[$filter] = array('=' => $params[$filter]);
+ $params[$filter] = ['=' => $params[$filter]];
}
// $mode is one of ('LEFT JOIN', 'INNER JOIN', 'SUBQUERY')
$mode = isset($params[$filter]['IS NULL']) ? 'LEFT JOIN' : 'SUBQUERY';
if ($mode === 'SUBQUERY') {
$clause = \CRM_Core_DAO::createSQLFilter($relSpec['column'], $params[$filter]);
if ($clause) {
- $sql->where($relSpec['subquery'], array('!clause' => $clause));
+ $sql->where($relSpec['subquery'], ['!clause' => $clause]);
}
}
else {
$alias = 'actjoin_' . $filter;
$clause = \CRM_Core_DAO::createSQLFilter($alias . "." . $relSpec['column'], $params[$filter]);
if ($clause) {
- $sql->join($alias, $relSpec['join'], array('!alias' => $alias, 'joinType' => $mode));
+ $sql->join($alias, $relSpec['join'], ['!alias' => $alias, 'joinType' => $mode]);
$sql->where($clause);
}
}
_civicrm_api3_activity_fill_activity_contact_names($activities, $params, $returns);
- $tagGet = array('tag_id', 'entity_id');
- $caseGet = $caseIds = array();
+ $tagGet = ['tag_id', 'entity_id'];
+ $caseGet = $caseIds = [];
foreach (array_keys($returns) as $key) {
if (strpos($key, 'tag_id.') === 0) {
$tagGet[] = $key;
break;
case 'tag_id':
- $tags = civicrm_api3('EntityTag', 'get', array(
+ $tags = civicrm_api3('EntityTag', 'get', [
'entity_table' => 'civicrm_activity',
- 'entity_id' => array('IN' => array_keys($activities)),
+ 'entity_id' => ['IN' => array_keys($activities)],
'return' => $tagGet,
- 'options' => array('limit' => 0),
- ));
+ 'options' => ['limit' => 0],
+ ]);
foreach ($tags['values'] as $tag) {
$key = (int) $tag['entity_id'];
unset($tag['entity_id'], $tag['id']);
case 'file_id':
$dao = CRM_Core_DAO::executeQuery("SELECT entity_id, file_id FROM civicrm_entity_file WHERE entity_table = 'civicrm_activity' AND entity_id IN (%1)",
- array(1 => array(implode(',', array_keys($activities)), 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES)));
+ [1 => [implode(',', array_keys($activities)), 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES]]);
while ($dao->fetch()) {
$activities[$dao->entity_id]['file_id'][] = $dao->file_id;
}
case 'case_id':
$dao = CRM_Core_DAO::executeQuery("SELECT activity_id, case_id FROM civicrm_case_activity WHERE activity_id IN (%1)",
- array(1 => array(implode(',', array_keys($activities)), 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES)));
+ [1 => [implode(',', array_keys($activities)), 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES]]);
while ($dao->fetch()) {
$activities[$dao->activity_id]['case_id'][] = $dao->case_id;
$caseIds[$dao->case_id] = $dao->case_id;
// Fetch case fields via the join syntax
// Note this is limited to the first case if the activity belongs to more than one
if ($caseGet && $caseIds) {
- $cases = civicrm_api3('Case', 'get', array(
- 'id' => array('IN' => $caseIds),
- 'options' => array('limit' => 0),
+ $cases = civicrm_api3('Case', 'get', [
+ 'id' => ['IN' => $caseIds],
+ 'options' => ['limit' => 0],
'check_permissions' => !empty($params['check_permissions']),
'return' => $caseGet,
- ));
+ ]);
foreach ($activities as &$activity) {
if (!empty($activity['case_id'])) {
$case = CRM_Utils_Array::value($activity['case_id'][0], $cases['values']);
* array with errors
*/
function _civicrm_api3_activity_check_params(&$params) {
- $activityIds = array(
+ $activityIds = [
'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) {
if ($value &&
* API request.
*/
function _civicrm_api3_activity_getlist_params(&$request) {
- $fieldsToReturn = array(
+ $fieldsToReturn = [
'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(
+ $request['params'] += [
'is_current_revision' => 1,
'is_deleted' => 0,
- );
+ ];
}
/**
* @return array
*/
function _civicrm_api3_activity_getlist_output($result, $request) {
- $output = array();
+ $output = [];
if (!empty($result['values'])) {
foreach ($result['values'] as $row) {
- $data = array(
+ $data = [
'id' => $row[$request['id_field']],
'label' => $row[$request['label_field']] ? $row[$request['label_field']] : ts('(no subject)'),
- 'description' => array(
+ 'description' => [
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(
+ $data['description'][] = ts('By %1', [
1 => CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $row['source_contact_id'], 'display_name'),
- ));
+ ]);
}
// Add repeating info
$repeat = CRM_Core_BAO_RecurringEntity::getPositionAndCount($row['id'], 'civicrm_activity');
$data['extra']['is_recur'] = FALSE;
if ($repeat) {
- $data['suffix'] = ts('(%1 of %2)', array(1 => $repeat[0], 2 => $repeat[1]));
+ $data['suffix'] = ts('(%1 of %2)', [1 => $repeat[0], 2 => $repeat[1]]);
$data['extra']['is_recur'] = TRUE;
}
$output[] = $data;
}
$activityObject = CRM_Core_OptionValue::addOptionValue($params, 'activity_type', $action, $optionValueID);
- $activityType = array();
+ $activityType = [];
_civicrm_api3_object_to_array($activityObject, $activityType[$activityObject->id]);
return civicrm_api3_create_success($activityType, $params, 'activity_type', 'create');
}
* Array of parameters determined by getfields.
*/
function _civicrm_api3_activity_type_create_spec(&$params) {
- $params['label'] = array(
+ $params['label'] = [
'api.required' => 1,
'title' => 'Label',
'type' => CRM_Utils_Type::T_STRING,
- );
- $params['weight'] = array(
+ ];
+ $params['weight'] = [
'api.required' => 1,
'title' => 'Weight',
'type' => CRM_Utils_Type::T_STRING,
- );
+ ];
}
/**
function _civicrm_api3_address_create_spec(&$params) {
$params['location_type_id']['api.required'] = 1;
$params['contact_id']['api.required'] = 1;
- $params['street_parsing'] = array(
+ $params['street_parsing'] = [
'title' => 'Street Address Parsing',
'description' => 'Optional param to indicate you want the street_address field parsed into individual params',
'type' => CRM_Utils_Type::T_BOOLEAN,
- );
- $params['skip_geocode'] = array(
+ ];
+ $params['skip_geocode'] = [
'title' => 'Skip geocode',
'description' => 'Optional param to indicate you want to skip geocoding (useful when importing a lot of addresses
at once, the job \'Geocode and Parse Addresses\' can execute this task after the import)',
'type' => CRM_Utils_Type::T_BOOLEAN,
- );
- $params['fix_address'] = array(
+ ];
+ $params['fix_address'] = [
'title' => ts('Fix address'),
'description' => ts('When true, apply various fixes to the address before insert. Default true.'),
'type' => CRM_Utils_Type::T_BOOLEAN,
'api.default' => TRUE,
- );
- $params['world_region'] = array(
+ ];
+ $params['world_region'] = [
'title' => ts('World Region'),
'name' => 'world_region',
'type' => CRM_Utils_Type::T_TEXT,
- );
+ ];
}
/**
* Array of parameters determined by getfields.
*/
function _civicrm_api3_address_get_spec(&$params) {
- $params['world_region'] = array(
+ $params['world_region'] = [
'title' => ts('World Region'),
'name' => 'world_region',
'type' => CRM_Utils_Type::T_TEXT,
- );
+ ];
}
/**
function civicrm_api3_attachment_create($params) {
if (empty($params['id'])) {
// When creating we need either entity_table or field_name.
- civicrm_api3_verify_one_mandatory($params, NULL, array('entity_table', 'field_name'));
+ civicrm_api3_verify_one_mandatory($params, NULL, ['entity_table', 'field_name']);
}
$config = CRM_Core_Config::singleton();
throw new API_Exception("'content' and 'options.move-file' are mutually exclusive");
}
if ($id && !$isTrusted && isset($file['upload_date']) && $file['upload_date'] != CRM_Utils_Date::isoToMysql($fileDao->upload_date)) {
- throw new API_Exception("Cannot modify upload_date" . var_export(array($file['upload_date'], $fileDao->upload_date, CRM_Utils_Date::isoToMysql($fileDao->upload_date)), TRUE));
+ throw new API_Exception("Cannot modify upload_date" . var_export([$file['upload_date'], $fileDao->upload_date, CRM_Utils_Date::isoToMysql($fileDao->upload_date)], TRUE));
}
if ($id && $name && $name != CRM_Utils_File::cleanFileName($fileDao->uri)) {
throw new API_Exception("Cannot modify name");
// Save custom field to entity
if (!$id && empty($params['entity_table']) && isset($params['field_name'])) {
- civicrm_api3('custom_value', 'create', array(
+ civicrm_api3('custom_value', 'create', [
'entity_id' => $params['entity_id'],
$params['field_name'] => $fileDao->id,
- ));
+ ]);
}
- $result = array(
+ $result = [
$fileDao->id => _civicrm_api3_attachment_format_result($fileDao, $entityFileDao, $returnContent, $isTrusted),
- );
+ ];
return civicrm_api3_create_success($result, $params, 'Attachment', 'create');
}
list($id, $file, $entityFile, $name, $content, $moveFile, $isTrusted, $returnContent) = _civicrm_api3_attachment_parse_params($params);
$dao = __civicrm_api3_attachment_find($params, $id, $file, $entityFile, $isTrusted);
- $result = array();
+ $result = [];
while ($dao->fetch()) {
$result[$dao->id] = _civicrm_api3_attachment_format_result($dao, $dao, $returnContent, $isTrusted);
}
list($id, $file, $entityFile, $name, $content, $moveFile, $isTrusted, $returnContent) = _civicrm_api3_attachment_parse_params($params);
$dao = __civicrm_api3_attachment_find($params, $id, $file, $entityFile, $isTrusted);
- $filePaths = array();
- $fileIds = array();
+ $filePaths = [];
+ $fileIds = [];
while ($dao->fetch()) {
$filePaths[] = $config->customFileUploadDir . DIRECTORY_SEPARATOR . $dao->uri;
$fileIds[] = $dao->id;
}
}
- $result = array();
+ $result = [];
return civicrm_api3_create_success($result, $params, 'Attachment', 'create');
}
* @throws API_Exception
*/
function __civicrm_api3_attachment_find($params, $id, $file, $entityFile, $isTrusted) {
- foreach (array('name', 'content', 'path', 'url') as $unsupportedFilter) {
+ foreach (['name', 'content', 'path', 'url'] as $unsupportedFilter) {
if (!empty($params[$unsupportedFilter])) {
throw new API_Exception("Get by $unsupportedFilter is not currently supported");
}
$select = CRM_Utils_SQL_Select::from('civicrm_file cf')
->join('cef', 'INNER JOIN civicrm_entity_file cef ON cf.id = cef.file_id')
- ->select(array(
+ ->select([
'cf.id',
'cf.uri',
'cf.mime_type',
'cf.created_id',
'cef.entity_table',
'cef.entity_id',
- ));
+ ]);
if ($id) {
- $select->where('cf.id = #id', array('#id' => $id));
+ $select->where('cf.id = #id', ['#id' => $id]);
}
// Recall: $file is filtered by parse_params.
foreach ($file as $key => $value) {
- $select->where('cf.!field = @value', array(
+ $select->where('cf.!field = @value', [
'!field' => $key,
'@value' => $value,
- ));
+ ]);
}
// Recall: $entityFile is filtered by parse_params.
foreach ($entityFile as $key => $value) {
- $select->where('cef.!field = @value', array(
+ $select->where('cef.!field = @value', [
'!field' => $key,
'@value' => $value,
- ));
+ ]);
}
if (!$isTrusted) {
// FIXME ACLs: Add any JOIN or WHERE clauses needed to enforce access-controls for the target entity.
throw new API_Exception("Malformed id");
}
- $file = array();
- foreach (array('mime_type', 'description', 'upload_date') as $field) {
+ $file = [];
+ foreach (['mime_type', 'description', 'upload_date'] as $field) {
if (array_key_exists($field, $params)) {
$file[$field] = $params[$field];
}
}
- $entityFile = array();
- foreach (array('entity_table', 'entity_id') as $field) {
+ $entityFile = [];
+ foreach (['entity_table', 'entity_id'] as $field) {
if (array_key_exists($field, $params)) {
$entityFile[$field] = $params[$field];
}
$isTrusted = empty($params['check_permissions']);
- $returns = isset($params['return']) ? $params['return'] : array();
- $returns = is_array($returns) ? $returns : array($returns);
+ $returns = isset($params['return']) ? $params['return'] : [];
+ $returns = is_array($returns) ? $returns : [$returns];
$returnContent = in_array('content', $returns);
- return array($id, $file, $entityFile, $name, $content, $moveFile, $isTrusted, $returnContent);
+ return [$id, $file, $entityFile, $name, $content, $moveFile, $isTrusted, $returnContent];
}
/**
$config = CRM_Core_Config::singleton();
$path = $config->customFileUploadDir . DIRECTORY_SEPARATOR . $fileDao->uri;
- $result = array(
+ $result = [
'id' => $fileDao->id,
'name' => CRM_Utils_File::cleanFileName($fileDao->uri),
'mime_type' => $fileDao->mime_type,
'entity_id' => $entityFileDao->entity_id,
'icon' => CRM_Utils_File::getIconFromMimeType($fileDao->mime_type),
'created_id' => $fileDao->created_id,
- );
+ ];
$fileHash = CRM_Core_BAO_File::generateFileHash($result['entity_id'], $result['id']);
$result['url'] = CRM_Utils_System::url(
'civicrm/file', 'reset=1&id=' . $result['id'] . '&eid=' . $result['entity_id'] . '&fcs=' . $fileHash,
$fileFields = CRM_Core_DAO_File::fields();
$entityFileFields = CRM_Core_DAO_EntityFile::fields();
- $spec = array();
+ $spec = [];
$spec['id'] = $fileFields['id'];
- $spec['name'] = array(
+ $spec['name'] = [
'title' => 'Name (write-once)',
'description' => 'The logical file name (not searchable)',
'type' => CRM_Utils_Type::T_STRING,
- );
- $spec['field_name'] = array(
+ ];
+ $spec['field_name'] = [
'title' => 'Field Name (write-once)',
'description' => 'Alternative to "entity_table" param - sets custom field value.',
'type' => CRM_Utils_Type::T_STRING,
- );
+ ];
$spec['mime_type'] = $fileFields['mime_type'];
$spec['description'] = $fileFields['description'];
$spec['upload_date'] = $fileFields['upload_date'];
$spec['entity_table']['title'] = CRM_Utils_Array::value('title', $spec['entity_table'], 'Entity Table') . ' (write-once)';
$spec['entity_id'] = $entityFileFields['entity_id'];
$spec['entity_id']['title'] = CRM_Utils_Array::value('title', $spec['entity_id'], 'Entity ID') . ' (write-once)'; // would be hard to securely handle changes
- $spec['url'] = array(
+ $spec['url'] = [
'title' => 'URL (read-only)',
'description' => 'URL for downloading the file (not searchable, expire-able)',
'type' => CRM_Utils_Type::T_STRING,
- );
- $spec['path'] = array(
+ ];
+ $spec['path'] = [
'title' => 'Path (read-only)',
'description' => 'Local file path (not searchable, local-only)',
'type' => CRM_Utils_Type::T_STRING,
- );
- $spec['content'] = array(
+ ];
+ $spec['content'] = [
'title' => 'Content',
'description' => 'File content (not searchable, not returned by default)',
'type' => CRM_Utils_Type::T_STRING,
- );
- $spec['created_id'] = array(
+ ];
+ $spec['created_id'] = [
'title' => 'Created By Contact ID',
'type' => CRM_Utils_Type::T_INT,
'description' => 'FK to civicrm_contact, who uploaded this file',
- );
+ ];
return $spec;
}
if (empty($params['id'])) {
// Creating a new case, so make sure we have the necessary parameters
- civicrm_api3_verify_mandatory($params, NULL, array(
+ civicrm_api3_verify_mandatory($params, NULL, [
'contact_id',
'subject',
- array('case_type', 'case_type_id'),
- )
+ ['case_type', 'case_type_id'],
+ ]
);
}
else {
throw new API_Exception('You cannot update creator id');
}
- $mergedCaseIds = $origContactIds = array();
+ $mergedCaseIds = $origContactIds = [];
// If a contact ID is specified we need to make sure this is the main contact ID for the case (and update if necessary)
if (!empty($params['contact_id'])) {
if (isset($params['contact_id']) && !isset($params['id'])) {
foreach ((array) $params['contact_id'] as $cid) {
- $contactParams = array('case_id' => $caseBAO->id, 'contact_id' => $cid);
+ $contactParams = ['case_id' => $caseBAO->id, 'contact_id' => $cid];
CRM_Case_BAO_CaseContact::create($contactParams);
}
}
}
// return case
- $values = array();
+ $values = [];
_civicrm_api3_object_to_array($caseBAO, $values[$caseBAO->id]);
return civicrm_api3_create_success($values, $params, 'Case', 'create', $caseBAO);
// Initialize XML processor with $params
$xmlProcessor = new CRM_Case_XMLProcessor_Process();
- $xmlProcessorParams = array(
+ $xmlProcessorParams = [
'clientID' => CRM_Utils_Array::value('contact_id', $params),
'creatorID' => CRM_Utils_Array::value('creator_id', $params),
'standardTimeline' => 1,
'duration' => CRM_Utils_Array::value('duration', $params),
'medium_id' => CRM_Utils_Array::value('medium_id', $params),
'details' => CRM_Utils_Array::value('details', $params),
- 'custom' => array(),
+ 'custom' => [],
'relationship_end_date' => CRM_Utils_Array::value('end_date', $params),
- );
+ ];
// Do it! :-D
$xmlProcessor->run($params['case_type'], $xmlProcessorParams);
* Parameters determined by getfields.
*/
function _civicrm_api3_case_get_spec(&$params) {
- $params['contact_id'] = array(
- 'api.aliases' => array('client_id'),
+ $params['contact_id'] = [
+ 'api.aliases' => ['client_id'],
'title' => 'Case Client',
'description' => 'Contact id of one or more clients to retrieve cases for',
'type' => CRM_Utils_Type::T_INT,
- );
- $params['activity_id'] = array(
+ ];
+ $params['activity_id'] = [
'title' => 'Case Activity',
'description' => 'Id of an activity in the case',
'type' => CRM_Utils_Type::T_INT,
- );
- $params['tag_id'] = array(
+ ];
+ $params['tag_id'] = [
'title' => 'Tags',
'description' => 'Find cases with specified tags.',
'type' => 1,
'FKClassName' => 'CRM_Core_DAO_Tag',
'FKApiName' => 'Tag',
'supports_joins' => TRUE,
- );
+ ];
}
/**
* Array of parameters determined by getfields.
*/
function _civicrm_api3_case_create_spec(&$params) {
- $params['contact_id'] = array(
- 'api.aliases' => array('client_id'),
+ $params['contact_id'] = [
+ 'api.aliases' => ['client_id'],
'title' => 'Case Client',
'description' => 'Contact id of case client(s)',
'api.required' => 1,
'type' => CRM_Utils_Type::T_INT,
'FKApiName' => 'Contact',
- );
+ ];
$params['status_id']['api.default'] = 1;
- $params['status_id']['api.aliases'] = array('case_status');
+ $params['status_id']['api.aliases'] = ['case_status'];
$params['creator_id']['api.default'] = 'user_contact_id';
$params['creator_id']['type'] = CRM_Utils_Type::T_INT;
$params['creator_id']['title'] = 'Case Created By';
$params['start_date']['api.default'] = 'now';
- $params['medium_id'] = array(
+ $params['medium_id'] = [
'name' => 'medium_id',
'title' => 'Activity Medium',
'type' => CRM_Utils_Type::T_INT,
- );
+ ];
}
/**
if (is_array($params['contact_id'])) {
$operator = CRM_Utils_Array::first(array_keys($params['contact_id']));
if (!in_array($operator, \CRM_Core_DAO::acceptedSQLOperators(), TRUE)) {
- $params['contact_id'] = array('IN' => $params['contact_id']);
+ $params['contact_id'] = ['IN' => $params['contact_id']];
}
}
else {
- $params['contact_id'] = array('=' => $params['contact_id']);
+ $params['contact_id'] = ['=' => $params['contact_id']];
}
$clause = CRM_Core_DAO::createSQLFilter('contact_id', $params['contact_id']);
$sql->where("a.id IN (SELECT case_id FROM civicrm_case_contact WHERE $clause)");
// Clause to search by tag
if (!empty($params['tag_id'])) {
- $dummySpec = array();
+ $dummySpec = [];
_civicrm_api3_validate_integer($params, 'tag_id', $dummySpec, 'Case');
if (!is_array($params['tag_id'])) {
- $params['tag_id'] = array('=' => $params['tag_id']);
+ $params['tag_id'] = ['=' => $params['tag_id']];
}
$clause = \CRM_Core_DAO::createSQLFilter('tag_id', $params['tag_id']);
if ($clause) {
- $sql->where('a.id IN (SELECT entity_id FROM civicrm_entity_tag WHERE entity_table = "civicrm_case" AND !clause)', array('!clause' => $clause));
+ $sql->where('a.id IN (SELECT entity_id FROM civicrm_entity_tag WHERE entity_table = "civicrm_case" AND !clause)', ['!clause' => $clause]);
}
}
- $cases = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), array('sequential' => 0) + $params, TRUE, 'Case', $sql);
+ $cases = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), ['sequential' => 0] + $params, TRUE, 'Case', $sql);
if (empty($options['is_count']) && !empty($cases['values'])) {
// For historic reasons we return these by default only when fetching a case by id
if (!empty($params['id']) && is_numeric($params['id']) && empty($options['return'])) {
- $options['return'] = array(
+ $options['return'] = [
'contacts' => 1,
'activities' => 1,
'contact_id' => 1,
- );
+ ];
}
_civicrm_api3_case_read($cases['values'], $options);
*/
function civicrm_api3_case_activity_create($params) {
require_once "api/v3/Activity.php";
- return civicrm_api3_activity_create($params) + array(
+ return civicrm_api3_activity_create($params) + [
'deprecated' => CRM_Utils_Array::value('activity_create', _civicrm_api3_case_deprecation()),
- );
+ ];
}
/**
function civicrm_api3_case_addtimeline($params) {
$caseType = CRM_Case_BAO_Case::getCaseType($params['case_id'], 'name');
$xmlProcessor = new CRM_Case_XMLProcessor_Process();
- $xmlProcessorParams = array(
+ $xmlProcessorParams = [
'clientID' => CRM_Case_BAO_Case::getCaseClients($params['case_id']),
'creatorID' => $params['creator_id'],
'standardTimeline' => 0,
'caseID' => $params['case_id'],
'caseType' => $caseType,
'activitySetName' => $params['timeline'],
- );
+ ];
$xmlProcessor->run($caseType, $xmlProcessorParams);
return civicrm_api3_create_success();
}
* Array of parameters determined by getfields.
*/
function _civicrm_api3_case_addtimeline_spec(&$params) {
- $params['case_id'] = array(
+ $params['case_id'] = [
'title' => 'Case ID',
'description' => 'Id of case to update',
'type' => CRM_Utils_Type::T_INT,
'api.required' => 1,
- );
- $params['timeline'] = array(
+ ];
+ $params['timeline'] = [
'title' => 'Timeline',
'description' => 'Name of activity set',
'type' => CRM_Utils_Type::T_STRING,
'api.required' => 1,
- );
- $params['activity_date_time'] = array(
+ ];
+ $params['activity_date_time'] = [
'api.default' => 'now',
'title' => 'Activity date time',
'description' => 'Timeline start date',
'type' => CRM_Utils_Type::T_DATE,
- );
- $params['creator_id'] = array(
+ ];
+ $params['creator_id'] = [
'api.default' => 'user_contact_id',
'title' => 'Activity creator',
'description' => 'Contact id of timeline creator',
'type' => CRM_Utils_Type::T_INT,
- );
+ ];
}
/**
* Array of parameters determined by getfields.
*/
function _civicrm_api3_case_merge_spec(&$params) {
- $params['case_id_1'] = array(
+ $params['case_id_1'] = [
'title' => 'Case ID 1',
'description' => 'Id of main case',
'type' => CRM_Utils_Type::T_INT,
'api.required' => 1,
- );
- $params['case_id_2'] = array(
+ ];
+ $params['case_id_2'] = [
'title' => 'Case ID 2',
'description' => 'Id of second case',
'type' => CRM_Utils_Type::T_INT,
'api.required' => 1,
- );
+ ];
}
/**
* Array of deprecated actions
*/
function _civicrm_api3_case_deprecation() {
- return array('activity_create' => 'Case api "activity_create" action is deprecated. Use the activity api instead.');
+ return ['activity_create' => 'Case api "activity_create" action is deprecated. Use the activity api instead.'];
}
/**
}
//check parameters
- civicrm_api3_verify_mandatory($params, NULL, array('id'));
+ civicrm_api3_verify_mandatory($params, NULL, ['id']);
// return error if modifying creator id
if (array_key_exists('creator_id', $params)) {
throw new API_Exception(ts('You cannot update creator id'));
}
- $mCaseId = $origContactIds = array();
+ $mCaseId = $origContactIds = [];
// get original contact id and creator id of case
if (!empty($params['contact_id'])) {
$dao->copyValues($params);
$dao->save();
- $case = array();
+ $case = [];
_civicrm_api3_object_to_array($dao, $case);
- return civicrm_api3_create_success(array($dao->id => $case), $params, 'Case', 'update', $dao);
+ return civicrm_api3_create_success([$dao->id => $case], $params, 'Case', 'update', $dao);
}
/**
*/
function civicrm_api3_case_delete($params) {
//check parameters
- civicrm_api3_verify_mandatory($params, NULL, array('id'));
+ civicrm_api3_verify_mandatory($params, NULL, ['id']);
if (CRM_Case_BAO_Case::deleteCase($params['id'], CRM_Utils_Array::value('move_to_trash', $params, FALSE))) {
return civicrm_api3_create_success($params, $params, 'Case', 'delete');
* @return void
*/
function _civicrm_api3_case_restore_spec(&$spec) {
- $result = civicrm_api3('Case', 'getfields', array('api_action' => 'delete'));
- $spec = array('id' => $result['values']['id']);
+ $result = civicrm_api3('Case', 'getfields', ['api_action' => 'delete']);
+ $spec = ['id' => $result['values']['id']];
}
/**
}
if (!empty($options['return']['activities'])) {
// add case activities array - we'll populate them in bulk below
- $case['activities'] = array();
+ $case['activities'] = [];
}
// Properly render this joined field
if (!empty($options['return']['case_type_id.definition'])) {
$caseTypeName = !empty($case['case_type_id.name']) ? $case['case_type_id.name'] : CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseType', $caseTypeId, 'name');
$xml = CRM_Case_XMLRepository::singleton()->retrieve($caseTypeName);
}
- $case['case_type_id.definition'] = array();
+ $case['case_type_id.definition'] = [];
if ($xml) {
$case['case_type_id.definition'] = CRM_Case_BAO_CaseType::convertXmlToDefinition($xml);
}
// Bulk-load activities
if (!empty($options['return']['activities'])) {
$query = "SELECT case_id, activity_id FROM civicrm_case_activity WHERE case_id IN (%1)";
- $params = array(1 => array(implode(',', array_keys($cases)), 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES));
+ $params = [1 => [implode(',', array_keys($cases)), 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES]];
$dao = CRM_Core_DAO::executeQuery($query, $params);
while ($dao->fetch()) {
$cases[$dao->case_id]['activities'][] = $dao->activity_id;
}
}
// Bulk-load tags. Supports joins onto the tag entity.
- $tagGet = array('tag_id', 'entity_id');
+ $tagGet = ['tag_id', 'entity_id'];
foreach (array_keys($options['return']) as $key) {
if (strpos($key, 'tag_id.') === 0) {
$tagGet[] = $key;
}
}
if (!empty($options['return']['tag_id'])) {
- $tags = civicrm_api3('EntityTag', 'get', array(
+ $tags = civicrm_api3('EntityTag', 'get', [
'entity_table' => 'civicrm_case',
- 'entity_id' => array('IN' => array_keys($cases)),
+ 'entity_id' => ['IN' => array_keys($cases)],
'return' => $tagGet,
- 'options' => array('limit' => 0),
- ));
+ 'options' => ['limit' => 0],
+ ]);
foreach ($tags['values'] as $tag) {
$key = (int) $tag['entity_id'];
unset($tag['entity_id'], $tag['id']);
*/
function _civicrm_api3_case_format_params(&$params) {
// Format/include custom params
- $values = array();
+ $values = [];
_civicrm_api3_custom_format_params($params, $values, 'Case');
$params = array_merge($params, $values);
// Convert single value to array here to simplify processing in later functions which expect an array.
if (isset($params['contact_id'])) {
if (!is_array($params['contact_id'])) {
- $params['contact_id'] = array($params['contact_id']);
+ $params['contact_id'] = [$params['contact_id']];
}
}
require_once 'api/v3/CaseContact.php';
//CRM:19956 - Assign case_id param if both id and case_id is passed to retrieve the case
if (!empty($params['id']) && !empty($params['params']) && !empty($params['params']['case_id'])) {
- $params['params']['case_id'] = array('IN' => $params['id']);
+ $params['params']['case_id'] = ['IN' => $params['id']];
unset($params['id']);
}
$params['id_field'] = 'case_id';
$params['label_field'] = $params['search_field'] = 'contact_id.sort_name';
- $params['description_field'] = array(
+ $params['description_field'] = [
'case_id',
'case_id.case_type_id.title',
'case_id.subject',
'case_id.status_id',
'case_id.start_date',
- );
- $apiRequest = array(
+ ];
+ $apiRequest = [
'version' => 3,
'entity' => 'CaseContact',
'action' => 'getlist',
'params' => $params,
- );
+ ];
return civicrm_api3_generic_getList($apiRequest);
}
* @return array
*/
function _civicrm_api3_case_contact_getlist_output($result, $request, $entity, $fields) {
- $output = array();
+ $output = [];
if (!empty($result['values'])) {
foreach ($result['values'] as $row) {
- $data = array(
+ $data = [
'id' => $row[$request['id_field']],
'label' => $row[$request['label_field']] . ' - ' . $row['case_id.case_type_id.title'],
- );
+ ];
$status = CRM_Core_PseudoConstant::getLabel('CRM_Case_BAO_Case', 'status_id', $row['case_id.status_id']);
$date = CRM_Utils_Date::customFormat($row['case_id.start_date']);
- $data['description'] = array(
- "#{$row['case_id']}: $status " . ts('(opened %1)', array(1 => $date)),
+ $data['description'] = [
+ "#{$row['case_id']}: $status " . ts('(opened %1)', [1 => $date]),
$row['case_id.subject'],
- );
+ ];
if (!empty($request['image_field'])) {
$data['image'] = isset($row[$request['image_field']]) ? $row[$request['image_field']] : '';
}
* @return array
* @throws \CRM_Core_Exception
*/
-function _civicrm_api3_case_type_get_formatResult(&$result, $options = array()) {
+function _civicrm_api3_case_type_get_formatResult(&$result, $options = []) {
foreach ($result['values'] as $key => &$caseType) {
if (!empty($caseType['definition'])) {
list($xml) = CRM_Utils_XML::parseString($caseType['definition']);
- $caseType['definition'] = $xml ? CRM_Case_BAO_CaseType::convertXmlToDefinition($xml) : array();
+ $caseType['definition'] = $xml ? CRM_Case_BAO_CaseType::convertXmlToDefinition($xml) : [];
}
else {
if (empty($options['return']) || !empty($options['return']['definition'])) {
$caseTypeName = (isset($caseType['name'])) ? $caseType['name'] : CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseType', $caseType['id'], 'name', 'id', TRUE);
$xml = CRM_Case_XMLRepository::singleton()->retrieve($caseTypeName);
- $caseType['definition'] = $xml ? CRM_Case_BAO_CaseType::convertXmlToDefinition($xml) : array();
+ $caseType['definition'] = $xml ? CRM_Case_BAO_CaseType::convertXmlToDefinition($xml) : [];
}
}
$caseType['is_forkable'] = CRM_Case_BAO_CaseType::isForkable($caseType['id']);
// once tests are 100% can try removing the first block & a similar block from Generic:getoptions
// Whitelist approach is safer
- $allowedClasses = array(
+ $allowedClasses = [
'CRM_Core_PseudoConstant',
'CRM_Event_PseudoConstant',
'CRM_Contribute_PseudoConstant',
'CRM_Member_PseudoConstant',
- );
+ ];
$className = $allowedClasses[0];
if (!empty($params['class']) && in_array($params['class'], $allowedClasses)) {
$className = $params['class'];
$callable = "$className::$name";
if (is_callable($callable)) {
if (empty($params)) {
- $values = call_user_func(array($className, $name));
+ $values = call_user_func([$className, $name]);
}
else {
- $values = call_user_func(array($className, $name));
+ $values = call_user_func([$className, $name]);
//@TODO XAV take out the param the COOKIE, Entity, Action and so there are only the "real param" in it
//$values = call_user_func_array( array( $className, $name ), $params );
}
return civicrm_api3_create_success($values, $params, 'Constant');
}
else {
- $values = call_user_func(array('CRM_Utils_PseudoConstant', 'getConstant'), $name);
+ $values = call_user_func(['CRM_Utils_PseudoConstant', 'getConstant'], $name);
if (!empty($values)) {
return civicrm_api3_create_success($values, $params, 'Constant');
}
* @param array $params
*/
function _civicrm_api3_constant_get_spec(&$params) {
- $options = array(
+ $options = [
'activityStatus',
'activityType',
'addressee',
'visibility',
'worldRegion',
'wysiwygEditor',
- );
- $params = array(
- 'name' => array(
+ ];
+ $params = [
+ 'name' => [
'title' => 'Constant Name',
'name' => 'name',
'api.required' => 1,
'options' => array_combine($options, $options),
'type' => CRM_Utils_Type::T_STRING,
- ),
- );
+ ],
+ ];
}
* ContactType array
*/
function civicrm_api3_contact_type_create($params) {
- civicrm_api3_verify_mandatory($params, _civicrm_api3_get_DAO(__FUNCTION__), array('name', 'parent_id'));
+ civicrm_api3_verify_mandatory($params, _civicrm_api3_get_DAO(__FUNCTION__), ['name', 'parent_id']);
if (empty($params['id'])) {
if (!array_key_exists('label', $params)) {
* Api result array
*/
function civicrm_api3_contribution_create(&$params) {
- $values = array();
+ $values = [];
_civicrm_api3_custom_format_params($params, $values, 'Contribution');
$params = array_merge($params, $values);
// The BAO should not clean money - it should be done in the form layer & api wrapper
}
}
if (!empty($params['id']) && !empty($params['contribution_status_id'])) {
- $error = array();
+ $error = [];
//throw error for invalid status change such as setting completed back to pending
//@todo this sort of validation belongs in the BAO not the API - if it is not an OK
// action it needs to be blocked there. If it is Ok through a form it needs to be OK through the api
}
}
if (!empty($params['id']) && !empty($params['financial_type_id'])) {
- $error = array();
+ $error = [];
CRM_Contribute_BAO_Contribution::checkFinancialTypeChange($params['financial_type_id'], $params['id'], $error);
if (array_key_exists('financial_type_id', $error)) {
throw new API_Exception($error['financial_type_id']);
function _civicrm_api3_contribution_create_spec(&$params) {
$params['contact_id']['api.required'] = 1;
$params['total_amount']['api.required'] = 1;
- $params['payment_instrument_id']['api.aliases'] = array('payment_instrument');
+ $params['payment_instrument_id']['api.aliases'] = ['payment_instrument'];
$params['receive_date']['api.default'] = 'now';
$params['receive_date']['api.required'] = TRUE;
- $params['payment_processor'] = array(
+ $params['payment_processor'] = [
'name' => 'payment_processor',
'title' => 'Payment Processor ID',
'description' => 'ID of payment processor used for this contribution',
// field is called payment processor - not payment processor id but can only be one id so
// it seems likely someone will fix it up one day to be more consistent - lets alias it from the start
- 'api.aliases' => array('payment_processor_id'),
+ 'api.aliases' => ['payment_processor_id'],
'type' => CRM_Utils_Type::T_INT,
- );
- $params['financial_type_id']['api.aliases'] = array('contribution_type_id', 'contribution_type');
+ ];
+ $params['financial_type_id']['api.aliases'] = ['contribution_type_id', 'contribution_type'];
$params['financial_type_id']['api.required'] = 1;
- $params['note'] = array(
+ $params['note'] = [
'name' => 'note',
'uniqueName' => 'contribution_note',
'title' => 'note',
'type' => 2,
'description' => 'Associated Note in the notes table',
- );
- $params['soft_credit_to'] = array(
+ ];
+ $params['soft_credit_to'] = [
'name' => 'soft_credit_to',
'title' => 'Soft Credit contact ID (legacy)',
'type' => CRM_Utils_Type::T_INT,
'description' => 'ID of Contact to be Soft credited to (deprecated - use contribution_soft api)',
'FKClassName' => 'CRM_Contact_DAO_Contact',
- );
- $params['honor_contact_id'] = array(
+ ];
+ $params['honor_contact_id'] = [
'name' => 'honor_contact_id',
'title' => 'Honoree contact ID (legacy)',
'type' => CRM_Utils_Type::T_INT,
'description' => 'ID of honoree contact (deprecated - use contribution_soft api)',
'FKClassName' => 'CRM_Contact_DAO_Contact',
- );
- $params['honor_type_id'] = array(
+ ];
+ $params['honor_type_id'] = [
'name' => 'honor_type_id',
'title' => 'Honoree Type (legacy)',
'type' => CRM_Utils_Type::T_INT,
'description' => 'Type of honoree contact (deprecated - use contribution_soft api)',
'pseudoconstant' => TRUE,
- );
+ ];
// note this is a recommended option but not adding as a default to avoid
// creating unnecessary changes for the dev
- $params['skipRecentView'] = array(
+ $params['skipRecentView'] = [
'name' => 'skipRecentView',
'title' => 'Skip adding to recent view',
'type' => CRM_Utils_Type::T_BOOLEAN,
'description' => 'Do not add to recent view (setting this improves performance)',
- );
- $params['skipLineItem'] = array(
+ ];
+ $params['skipLineItem'] = [
'name' => 'skipLineItem',
'title' => 'Skip adding line items',
'type' => CRM_Utils_Type::T_BOOLEAN,
'api.default' => 0,
'description' => 'Do not add line items by default (if you wish to add your own)',
- );
- $params['batch_id'] = array(
+ ];
+ $params['batch_id'] = [
'title' => 'Batch',
'type' => CRM_Utils_Type::T_INT,
'description' => 'Batch which relevant transactions should be added to',
- );
- $params['refund_trxn_id'] = array(
+ ];
+ $params['refund_trxn_id'] = [
'title' => 'Refund Transaction ID',
'type' => CRM_Utils_Type::T_STRING,
'description' => 'Transaction ID specific to the refund taking place',
- );
- $params['card_type_id'] = array(
+ ];
+ $params['card_type_id'] = [
'title' => 'Card Type ID',
'description' => 'Providing Credit Card Type ID',
'type' => CRM_Utils_Type::T_INT,
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'optionGroupName' => 'accept_creditcard',
- ),
- );
+ ],
+ ];
}
/**
function _civicrm_api3_contribution_create_legacy_support_45(&$params) {
//legacy soft credit handling - recommended approach is chaining
if (!empty($params['soft_credit_to'])) {
- $params['soft_credit'][] = array(
+ $params['soft_credit'][] = [
'contact_id' => $params['soft_credit_to'],
'amount' => $params['total_amount'],
'soft_credit_type_id' => CRM_Core_OptionGroup::getDefaultValue("soft_credit_type"),
- );
+ ];
}
if (!empty($params['honor_contact_id'])) {
- $params['soft_credit'][] = array(
+ $params['soft_credit'][] = [
'contact_id' => $params['honor_contact_id'],
'amount' => $params['total_amount'],
'soft_credit_type_id' => CRM_Utils_Array::value('honor_type_id', $params, CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_ContributionSoft', 'soft_credit_type_id', 'in_honor_of')),
- );
+ ];
}
}
throw new API_Exception('You do not have permission to delete this contribution');
}
if (CRM_Contribute_BAO_Contribution::deleteContribution($contributionID)) {
- return civicrm_api3_create_success(array($contributionID => 1));
+ return civicrm_api3_create_success([$contributionID => 1]);
}
else {
throw new API_Exception('Could not delete contribution');
* @param array $params
*/
function _civicrm_api3_contribution_delete_spec(&$params) {
- $params['id']['api.aliases'] = array('contribution_id');
+ $params['id']['api.aliases'] = ['contribution_id'];
}
/**
* @throws \API_Exception
*/
function _civicrm_api3_contribution_get_support_nonunique_returns($params) {
- $additionalOptions = array();
+ $additionalOptions = [];
$options = _civicrm_api3_get_options_from_params($params, TRUE);
- foreach (array('check_number', 'address_id') as $changedVariable) {
+ foreach (['check_number', 'address_id'] as $changedVariable) {
if (isset($options['return']) && !empty($options['return'][$changedVariable])) {
$additionalOptions['return']['contribution_' . $changedVariable] = 1;
}
// Arguably we should also do the same with 'campaign_id' &
// 'source' - which are also fields being rendered with unique names.
// That seems more consistent with other api where we output the actual field names.
- $outputAliases = array(
+ $outputAliases = [
'contribution_check_number' => 'check_number',
'contribution_address_id' => 'address_id',
'payment_instrument_id' => 'instrument_id',
- );
+ ];
foreach ($outputAliases as $returnName => $copyTo) {
if (array_key_exists($returnName, $contribution)) {
$contribution[$copyTo] = $contribution[$returnName];
* @return int
*/
function civicrm_api3_contribution_getcount($params) {
- $count = _civicrm_api3_get_using_query_object('Contribution', $params, array(), TRUE, CRM_Contact_BAO_Query::MODE_CONTRIBUTE);
+ $count = _civicrm_api3_get_using_query_object('Contribution', $params, [], TRUE, CRM_Contact_BAO_Query::MODE_CONTRIBUTE);
return (int) $count;
}
* Array of parameters determined by getfields.
*/
function _civicrm_api3_contribution_get_spec(&$params) {
- $params['contribution_test'] = array(
+ $params['contribution_test'] = [
'api.default' => 0,
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => 'Get Test Contributions?',
- 'api.aliases' => array('is_test'),
- );
+ 'api.aliases' => ['is_test'],
+ ];
- $params['financial_type_id']['api.aliases'] = array('contribution_type_id');
- $params['payment_instrument_id']['api.aliases'] = array('contribution_payment_instrument', 'payment_instrument');
+ $params['financial_type_id']['api.aliases'] = ['contribution_type_id'];
+ $params['payment_instrument_id']['api.aliases'] = ['contribution_payment_instrument', 'payment_instrument'];
$params['contact_id'] = CRM_Utils_Array::value('contribution_contact_id', $params);
- $params['contact_id']['api.aliases'] = array('contribution_contact_id');
+ $params['contact_id']['api.aliases'] = ['contribution_contact_id'];
unset($params['contribution_contact_id']);
}
function _civicrm_api3_contribute_format_params($params, &$values) {
//legacy way of formatting from v2 api - v3 way is to define metadata & do it in the api layer
_civicrm_api3_filter_fields_for_bao('Contribution', $params, $values);
- return array();
+ return [];
}
/**
* Array of parameters determined by getfields.
*/
function _civicrm_api3_contribution_transact_spec(&$params) {
- $fields = civicrm_api3('Contribution', 'getfields', array('action' => 'create'));
+ $fields = civicrm_api3('Contribution', 'getfields', ['action' => 'create']);
$params = array_merge($params, $fields['values']);
$params['receive_date']['api.default'] = 'now';
}
* @throws Exception
*/
function civicrm_api3_contribution_sendconfirmation($params) {
- $ids = $values = array();
- $allowedParams = array(
+ $ids = $values = [];
+ $allowedParams = [
'receipt_from_email',
'receipt_from_name',
'receipt_update',
'bcc_receipt',
'receipt_text',
'payment_processor_id',
- );
+ ];
$input = array_intersect_key($params, array_flip($allowedParams));
$input['is_email_receipt'] = TRUE;
CRM_Contribute_BAO_Contribution::sendMail($input, $ids, $params['id'], $values);
* Array of parameters determined by getfields.
*/
function _civicrm_api3_contribution_sendconfirmation_spec(&$params) {
- $params['id'] = array(
+ $params['id'] = [
'api.required' => 1,
'title' => ts('Contribution ID'),
'type' => CRM_Utils_Type::T_INT,
- );
- $params['receipt_from_email'] = array(
+ ];
+ $params['receipt_from_email'] = [
'title' => ts('From Email address (string)'),
'type' => CRM_Utils_Type::T_STRING,
- );
- $params['receipt_from_name'] = array(
+ ];
+ $params['receipt_from_name'] = [
'title' => ts('From Name (string)'),
'type' => CRM_Utils_Type::T_STRING,
- );
- $params['cc_receipt'] = array(
+ ];
+ $params['cc_receipt'] = [
'title' => ts('CC Email address (string)'),
'type' => CRM_Utils_Type::T_STRING,
- );
- $params['bcc_receipt'] = array(
+ ];
+ $params['bcc_receipt'] = [
'title' => ts('BCC Email address (string)'),
'type' => CRM_Utils_Type::T_STRING,
- );
- $params['receipt_text'] = array(
+ ];
+ $params['receipt_text'] = [
'title' => ts('Message (string)'),
'type' => CRM_Utils_Type::T_STRING,
- );
- $params['receipt_update'] = array(
+ ];
+ $params['receipt_update'] = [
'title' => ts('Update the Receipt Date'),
'type' => CRM_Utils_Type::T_BOOLEAN,
'api.default' => TRUE,
- );
- $params['payment_processor_id'] = array(
+ ];
+ $params['payment_processor_id'] = [
'title' => ts('Payment processor Id (avoids mis-guesses)'),
'type' => CRM_Utils_Type::T_INT,
- );
+ ];
}
/**
* @throws \Exception
*/
function civicrm_api3_contribution_completetransaction(&$params) {
- $input = $ids = array();
+ $input = $ids = [];
if (isset($params['payment_processor_id'])) {
$input['payment_processor_id'] = $params['payment_processor_id'];
}
* @param array $params
*/
function _civicrm_api3_contribution_completetransaction_spec(&$params) {
- $params['id'] = array(
+ $params['id'] = [
'title' => 'Contribution ID',
'type' => CRM_Utils_Type::T_INT,
'api.required' => TRUE,
- );
- $params['trxn_id'] = array(
+ ];
+ $params['trxn_id'] = [
'title' => 'Transaction ID',
'type' => CRM_Utils_Type::T_STRING,
- );
- $params['is_email_receipt'] = array(
+ ];
+ $params['is_email_receipt'] = [
'title' => 'Send email Receipt?',
'type' => CRM_Utils_Type::T_BOOLEAN,
- );
- $params['receipt_from_email'] = array(
+ ];
+ $params['receipt_from_email'] = [
'title' => 'Email to send receipt from.',
'description' => 'If not provided this will default to being based on domain mail or contribution page',
'type' => CRM_Utils_Type::T_EMAIL,
- );
- $params['receipt_from_name'] = array(
+ ];
+ $params['receipt_from_name'] = [
'title' => 'Name to send receipt from',
'description' => '. If not provided this will default to domain mail or contribution page',
'type' => CRM_Utils_Type::T_STRING,
- );
- $params['payment_processor_id'] = array(
+ ];
+ $params['payment_processor_id'] = [
'title' => 'Payment processor ID',
'description' => 'Providing this is strongly recommended, as not possible to calculate it accurately always',
'type' => CRM_Utils_Type::T_INT,
- );
- $params['fee_amount'] = array(
+ ];
+ $params['fee_amount'] = [
'title' => 'Fee charged on transaction',
'description' => 'If a fee has been charged then the amount',
'type' => CRM_Utils_Type::T_FLOAT,
- );
- $params['trxn_date'] = array(
+ ];
+ $params['trxn_date'] = [
'title' => 'Transaction Date',
'description' => 'Date this transaction occurred',
'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
- );
- $params['card_type_id'] = array(
+ ];
+ $params['card_type_id'] = [
'title' => 'Card Type ID',
'description' => 'Providing Credit Card Type ID',
'type' => CRM_Utils_Type::T_INT,
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'optionGroupName' => 'accept_creditcard',
- ),
- );
+ ],
+ ];
}
/**
* @throws API_Exception
*/
function civicrm_api3_contribution_repeattransaction(&$params) {
- $input = $ids = array();
- civicrm_api3_verify_one_mandatory($params, NULL, array('contribution_recur_id', 'original_contribution_id'));
+ $input = $ids = [];
+ civicrm_api3_verify_one_mandatory($params, NULL, ['contribution_recur_id', 'original_contribution_id']);
if (empty($params['original_contribution_id'])) {
// CRM-19873 call with test mode.
- $params['original_contribution_id'] = civicrm_api3('contribution', 'getvalue', array(
+ $params['original_contribution_id'] = civicrm_api3('contribution', 'getvalue', [
'return' => 'id',
- 'contribution_status_id' => array('IN' => array('Completed')),
+ 'contribution_status_id' => ['IN' => ['Completed']],
'contribution_recur_id' => $params['contribution_recur_id'],
'contribution_test' => CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionRecur', $params['contribution_recur_id'], 'is_test'),
- 'options' => array('limit' => 1, 'sort' => 'id DESC'),
- ));
+ 'options' => ['limit' => 1, 'sort' => 'id DESC'],
+ ]);
}
$contribution = new CRM_Contribute_BAO_Contribution();
$contribution->id = $params['original_contribution_id'];
'A valid original contribution ID is required', 'invalid_data');
}
$original_contribution = clone $contribution;
- $input['payment_processor_id'] = civicrm_api3('contributionRecur', 'getvalue', array(
+ $input['payment_processor_id'] = civicrm_api3('contributionRecur', 'getvalue', [
'return' => 'payment_processor_id',
'id' => $contribution->contribution_recur_id,
- ));
+ ]);
try {
if (!$contribution->loadRelatedObjects($input, $ids, TRUE)) {
throw new API_Exception('failed to load related objects');
unset($contribution->id, $contribution->receive_date, $contribution->invoice_id);
$contribution->receive_date = $params['receive_date'];
- $passThroughParams = array(
+ $passThroughParams = [
'trxn_id',
'total_amount',
'campaign_id',
'fee_amount',
'financial_type_id',
'contribution_status_id',
- );
+ ];
$input = array_intersect_key($params, array_fill_keys($passThroughParams, NULL));
return _ipn_process_transaction($params, $contribution, $input, $ids, $original_contribution);
* @param array $params
*/
function _civicrm_api3_contribution_repeattransaction_spec(&$params) {
- $params['original_contribution_id'] = array(
+ $params['original_contribution_id'] = [
'title' => 'Original Contribution ID',
'description' => 'Contribution ID to copy (will be calculated from recurring contribution if not provided)',
'type' => CRM_Utils_Type::T_INT,
- );
- $params['contribution_recur_id'] = array(
+ ];
+ $params['contribution_recur_id'] = [
'title' => 'Recurring contribution ID',
'type' => CRM_Utils_Type::T_INT,
- );
- $params['trxn_id'] = array(
+ ];
+ $params['trxn_id'] = [
'title' => 'Transaction ID',
'type' => CRM_Utils_Type::T_STRING,
- );
- $params['is_email_receipt'] = array(
+ ];
+ $params['is_email_receipt'] = [
'title' => 'Send email Receipt?',
'type' => CRM_Utils_Type::T_BOOLEAN,
- );
- $params['contribution_status_id'] = array(
+ ];
+ $params['contribution_status_id'] = [
'title' => 'Contribution Status ID',
'name' => 'contribution_status_id',
'type' => CRM_Utils_Type::T_INT,
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'optionGroupName' => 'contribution_status',
- ),
+ ],
'api.required' => TRUE,
- );
- $params['receive_date'] = array(
+ ];
+ $params['receive_date'] = [
'title' => 'Contribution Receive Date',
'name' => 'receive_date',
'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
'api.default' => 'now',
- );
- $params['trxn_id'] = array(
+ ];
+ $params['trxn_id'] = [
'title' => 'Transaction ID',
'name' => 'trxn_id',
'type' => CRM_Utils_Type::T_STRING,
- );
- $params['campaign_id'] = array(
+ ];
+ $params['campaign_id'] = [
'title' => 'Campaign ID',
'name' => 'campaign_id',
'type' => CRM_Utils_Type::T_INT,
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'table' => 'civicrm_campaign',
'keyColumn' => 'id',
'labelColumn' => 'title',
- ),
- );
- $params['financial_type_id'] = array(
+ ],
+ ];
+ $params['financial_type_id'] = [
'title' => 'Financial ID (ignored if more than one line item)',
'name' => 'financial_type_id',
'type' => CRM_Utils_Type::T_INT,
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'table' => 'civicrm_financial_type',
'keyColumn' => 'id',
'labelColumn' => 'name',
- ),
- );
- $params['payment_processor_id'] = array(
+ ],
+ ];
+ $params['payment_processor_id'] = [
'description' => ts('Payment processor ID, will be loaded from contribution_recur if not provided'),
'title' => 'Payment processor ID',
'name' => 'payment_processor_id',
'type' => CRM_Utils_Type::T_INT,
- );
+ ];
}
*/
function _civicrm_api3_contribution_page_create_spec(&$params) {
$params['financial_type_id']['api.required'] = 1;
- $params['payment_processor']['api.aliases'] = array('payment_processor_id');
+ $params['payment_processor']['api.aliases'] = ['payment_processor_id'];
$params['is_active']['api.default'] = 1;
}
* @return array
*/
function _civicrm_api3_contribution_page_getlist_defaults(&$request) {
- return array(
- 'description_field' => array(
+ return [
+ 'description_field' => [
'intro_text',
- ),
- 'params' => array(
+ ],
+ 'params' => [
'is_active' => 1,
- ),
- );
+ ],
+ ];
}
* returns true is successfully cancelled
*/
function civicrm_api3_contribution_recur_cancel($params) {
- civicrm_api3_verify_one_mandatory($params, NULL, array('id'));
+ civicrm_api3_verify_one_mandatory($params, NULL, ['id']);
return CRM_Contribute_BAO_ContributionRecur::cancelRecurContribution($params['id']) ? civicrm_api3_create_success() : civicrm_api3_create_error(ts('Error while cancelling recurring contribution'));
}
foreach ($params['option_values'] as $key => $value) {
// Translate simple key/value pairs into full-blown option values
if (!is_array($value)) {
- $value = array(
+ $value = [
'label' => $value,
'value' => $key,
'is_active' => 1,
'weight' => $weight,
- );
+ ];
$key = $weight++;
}
$params['option_label'][$key] = $value['label'];
$params['option_weight'][$key] = $value['weight'];
}
}
- $values = array();
+ $values = [];
$customField = CRM_Core_BAO_CustomField::create($params);
_civicrm_api3_object_to_array_unique_fields($customField, $values[$customField->id]);
_civicrm_api3_custom_field_flush_static_caches();
* Flush static caches in functions that might have stored available custom fields.
*/
function _civicrm_api3_custom_field_flush_static_caches() {
- civicrm_api('CustomField', 'getfields', array('version' => 3, 'cache_clear' => 1));
+ civicrm_api('CustomField', 'getfields', ['version' => 3, 'cache_clear' => 1]);
CRM_Core_BAO_UFField::getAvailableFieldsFlat(TRUE);
}
$params['label']['api.required'] = 1;
$params['custom_group_id']['api.required'] = 1;
$params['is_active']['api.default'] = 1;
- $params['option_values'] = array(
+ $params['option_values'] = [
'title' => 'Option Values',
'description' => "Pass an array of options (value => label) to create this field's option values",
- );
+ ];
// TODO: Why expose this to the api at all?
- $params['option_type'] = array(
+ $params['option_type'] = [
'title' => 'Option Type',
'description' => 'This (boolean) field tells the BAO to create an option group for the field if the field type is appropriate',
'api.default' => 1,
'type' => CRM_Utils_Type::T_BOOLEAN,
- );
+ ];
$params['data_type']['api.default'] = 'String';
$params['is_active']['api.default'] = 1;
}
$field->id = $params['id'];
$field->find(TRUE);
$customFieldDelete = CRM_Core_BAO_CustomField::deleteField($field);
- civicrm_api('CustomField', 'getfields', array('version' => 3, 'cache_clear' => 1));
+ civicrm_api('CustomField', 'getfields', ['version' => 3, 'cache_clear' => 1]);
return $customFieldDelete ? civicrm_api3_create_error('Error while deleting custom field') : civicrm_api3_create_success();
}
* @todo remove this function - not in use but need to review functionality before
* removing as it might be useful in wrapper layer
*/
-function _civicrm_api3_custom_field_validate_field($fieldName, $value, $fieldDetails, &$errors = array()) {
+function _civicrm_api3_custom_field_validate_field($fieldName, $value, $fieldDetails, &$errors = []) {
return NULL;
//see comment block
if (!$value) {
}
if (!is_array($value)) {
- $value = array($value);
+ $value = [$value];
}
$query = "SELECT count(*) FROM civicrm_country WHERE id IN (" . implode(',', $value) . ")";
}
if (!is_array($value)) {
- $value = array($value);
+ $value = [$value];
}
$query = "
break;
}
- if (in_array($htmlType, array(
- 'Select', 'Multi-Select', 'CheckBox', 'Radio')) &&
+ if (in_array($htmlType, [
+ 'Select', 'Multi-Select', 'CheckBox', 'Radio']) &&
!isset($errors[$fieldName])
) {
$options = CRM_Core_OptionGroup::valuesByID($fieldDetails['option_group_id']);
if (!is_array($value)) {
- $value = array($value);
+ $value = [$value];
}
$invalidOptions = array_diff($value, array_keys($options));
*/
function civicrm_api3_custom_field_setvalue($params) {
require_once 'api/v3/Generic/Setvalue.php';
- $result = civicrm_api3_generic_setValue(array("entity" => 'CustomField', 'params' => $params));
+ $result = civicrm_api3_generic_setValue(["entity" => 'CustomField', 'params' => $params]);
if (empty($result['is_error'])) {
CRM_Utils_System::flushCache();
}
*/
function civicrm_api3_custom_group_setvalue($params) {
require_once 'api/v3/Generic/Setvalue.php';
- $result = civicrm_api3_generic_setValue(array("entity" => 'CustomGroup', 'params' => $params));
+ $result = civicrm_api3_generic_setValue(["entity" => 'CustomGroup', 'params' => $params]);
if (empty($result['is_error'])) {
CRM_Utils_System::flushCache();
}
$params['option_group_id']['api.default'] = CRM_Core_DAO::getFieldValue(
'CRM_Core_DAO_OptionGroup', 'custom_search', 'id', 'name'
);
- $params['name']['api.aliases'] = array('class_name');
+ $params['name']['api.aliases'] = ['class_name'];
}
/**
if (!empty($params['entity_table']) && substr($params['entity_table'], 0, 7) == 'civicrm') {
$params['entity_table'] = substr($params['entity_table'], 8, 7);
}
- $create = array('entityID' => $params['entity_id']);
+ $create = ['entityID' => $params['entity_id']];
// Translate names and
//Convert arrays to multi-value strings
$sp = CRM_Core_DAO::VALUE_SEPARATOR;
*/
function civicrm_api3_custom_value_get($params) {
- $getParams = array(
+ $getParams = [
'entityID' => $params['entity_id'],
'entityType' => CRM_Utils_Array::value('entity_table', $params, ''),
- );
+ ];
if (strstr($getParams['entityType'], 'civicrm_')) {
$getParams['entityType'] = ucfirst(substr($getParams['entityType'], 8));
}
if ($result['is_error']) {
if ($result['error_message'] == "No values found for the specified entity ID and custom field(s).") {
- $values = array();
+ $values = [];
return civicrm_api3_create_success($values, $params, 'CustomValue');
}
else {
* @throws \CiviCRM_API3_Exception
*/
function _civicrm_api3_custom_value_gettree_spec(&$spec) {
- $spec['entity_id'] = array(
+ $spec['entity_id'] = [
'title' => 'Entity Id',
'description' => 'Id of entity',
'type' => CRM_Utils_Type::T_INT,
'api.required' => 1,
- );
+ ];
$entities = civicrm_api3('Entity', 'get');
$entities = array_diff($entities['values'], $entities['deprecated']);
- $spec['entity_type'] = array(
+ $spec['entity_type'] = [
'title' => 'Entity Type',
'description' => 'API name of entity type, e.g. "Contact"',
'type' => CRM_Utils_Type::T_STRING,
'api.required' => 1,
'options' => array_combine($entities, $entities),
- );
+ ];
// Return params for custom group, field & value
foreach (CRM_Core_DAO_CustomGroup::fields() as $field) {
$name = 'custom_group.' . $field['name'];
- $spec[$name] = array('name' => $name) + $field;
+ $spec[$name] = ['name' => $name] + $field;
}
foreach (CRM_Core_DAO_CustomField::fields() as $field) {
$name = 'custom_field.' . $field['name'];
- $spec[$name] = array('name' => $name) + $field;
+ $spec[$name] = ['name' => $name] + $field;
}
- $spec['custom_value.id'] = array(
+ $spec['custom_value.id'] = [
'title' => 'Custom Value Id',
'description' => 'Id of record in custom value table',
'type' => CRM_Utils_Type::T_INT,
- );
- $spec['custom_value.data'] = array(
+ ];
+ $spec['custom_value.data'] = [
'title' => 'Custom Value (Raw)',
'description' => 'Raw value as stored in the database',
'type' => CRM_Utils_Type::T_STRING,
- );
- $spec['custom_value.display'] = array(
+ ];
+ $spec['custom_value.display'] = [
'title' => 'Custom Value (Formatted)',
'description' => 'Custom value formatted for display',
'type' => CRM_Utils_Type::T_STRING,
- );
+ ];
}
/**
* @throws \CiviCRM_API3_Exception
*/
function civicrm_api3_custom_value_gettree($params) {
- $ret = array();
+ $ret = [];
$options = _civicrm_api3_get_options_from_params($params);
- $toReturn = array(
- 'custom_group' => array(),
- 'custom_field' => array(),
- 'custom_value' => array(),
- );
+ $toReturn = [
+ 'custom_group' => [],
+ 'custom_field' => [],
+ 'custom_value' => [],
+ ];
foreach (array_keys($options['return']) as $r) {
list($type, $field) = explode('.', $r);
if (isset($toReturn[$type])) {
}
switch ($params['entity_type']) {
case 'Contact':
- $ret = array('entityType' => 'contact_type', 'subTypes' => 'contact_sub_type');
+ $ret = ['entityType' => 'contact_type', 'subTypes' => 'contact_sub_type'];
break;
case 'Activity':
case 'Grant':
case 'Membership':
case 'Relationship':
- $ret = array('subTypes' => strtolower($params['entity_type']) . '_type_id');
+ $ret = ['subTypes' => strtolower($params['entity_type']) . '_type_id'];
break;
case 'Participant':
// todo
}
- $treeParams = array(
+ $treeParams = [
'entityType' => $params['entity_type'],
- 'subTypes' => array(),
+ 'subTypes' => [],
'subName' => NULL,
- );
+ ];
// Fetch entity data for custom group type/sub-type
// Also verify access permissions (api3 will throw an exception if permission denied)
if ($ret || !empty($params['check_permissions'])) {
- $entityData = civicrm_api3($params['entity_type'], 'getsingle', array(
+ $entityData = civicrm_api3($params['entity_type'], 'getsingle', [
'id' => $params['entity_id'],
'check_permissions' => !empty($params['check_permissions']),
- 'return' => array_merge(array('id'), array_values($ret)),
- ));
+ 'return' => array_merge(['id'], array_values($ret)),
+ ]);
foreach ($ret as $param => $key) {
if (isset($entityData[$key])) {
$treeParams[$param] = $entityData[$key];
}
$tree = CRM_Core_BAO_CustomGroup::getTree($treeParams['entityType'], $toReturn, $params['entity_id'], NULL, $treeParams['subTypes'], $treeParams['subName'], TRUE, NULL, FALSE, CRM_Utils_Array::value('check_permissions', $params, TRUE));
unset($tree['info']);
- $result = array();
+ $result = [];
foreach ($tree as $group) {
- $result[$group['name']] = array();
+ $result[$group['name']] = [];
$groupToReturn = $toReturn['custom_group'] ? $toReturn['custom_group'] : array_keys($group);
foreach ($groupToReturn as $item) {
$result[$group['name']][$item] = CRM_Utils_Array::value($item, $group);
}
- $result[$group['name']]['fields'] = array();
+ $result[$group['name']]['fields'] = [];
foreach ($group['fields'] as $fieldInfo) {
- $field = array('value' => NULL);
+ $field = ['value' => NULL];
$fieldToReturn = $toReturn['custom_field'] ? $toReturn['custom_field'] : array_keys($fieldInfo);
foreach ($fieldToReturn as $item) {
$field[$item] = CRM_Utils_Array::value($item, $fieldInfo);
function _civicrm_api3_cxn_register_spec(&$spec) {
$daoFields = CRM_Cxn_DAO_Cxn::fields();
$spec['app_guid'] = $daoFields['app_guid'];
- $spec['app_meta_url'] = array(
+ $spec['app_meta_url'] = [
'name' => 'app_meta_url',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Application Metadata URL'),
'description' => 'Application Metadata URL',
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
- );
+ ];
}
/**
}
}
elseif (!empty($params['app_guid'])) {
- $appMeta = civicrm_api3('CxnApp', 'getsingle', array(
+ $appMeta = civicrm_api3('CxnApp', 'getsingle', [
'appId' => $params['app_guid'],
- ));
+ ]);
}
if (empty($appMeta) || !is_array($appMeta)) {
$daoFields = CRM_Cxn_DAO_Cxn::fields();
$spec['cxn_guid'] = $daoFields['cxn_guid'];
$spec['app_guid'] = $daoFields['app_guid'];
- $spec['force'] = array(
+ $spec['force'] = [
'name' => 'force',
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => ts('Force'),
'description' => 'Destroy connection even if the remote application is non-responsive.',
'default' => '0',
- );
+ ];
}
/**
$cxnId = $params['cxn_guid'];
}
elseif (!empty($params['app_guid'])) {
- $cxnId = CRM_Core_DAO::singleValueQuery('SELECT cxn_guid FROM civicrm_cxn WHERE app_guid = %1', array(
- 1 => array($params['app_guid'], 'String'),
- ));
+ $cxnId = CRM_Core_DAO::singleValueQuery('SELECT cxn_guid FROM civicrm_cxn WHERE app_guid = %1', [
+ 1 => [$params['app_guid'], 'String'],
+ ]);
if (!$cxnId) {
throw new API_Exception("The app_guid does not correspond to an active connection.");
}
$daoFields = CRM_Cxn_DAO_Cxn::fields();
$spec['app_guid'] = $daoFields['app_guid'];
$spec['cxn_guid'] = $daoFields['cxn_guid'];
- $spec['page_name'] = array(
+ $spec['page_name'] = [
'name' => 'page_name',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Page Type'),
'description' => 'The type of page (eg "settings")',
'maxlength' => 63,
'size' => CRM_Utils_Type::HUGE,
- 'api.aliases' => array('page'),
- );
+ 'api.aliases' => ['page'],
+ ];
}
/**
/** @var \Civi\Cxn\Rpc\RegistrationClient $client */
$client = \Civi::service('cxn_reg_client');
- return $client->call($appMeta, 'Cxn', 'getlink', array(
+ return $client->call($appMeta, 'Cxn', 'getlink', [
'page' => $params['page_name'],
- ));
+ ]);
}
/**
* @throws Exception
*/
function civicrm_api3_cxn_getcfg($params) {
- $result = array(
+ $result = [
'CIVICRM_CXN_CA' => defined('CIVICRM_CXN_CA') ? CIVICRM_CXN_CA : NULL,
'CIVICRM_CXN_VIA' => defined('CIVICRM_CXN_VIA') ? CIVICRM_CXN_VIA : NULL,
'CIVICRM_CXN_APPS_URL' => defined('CIVICRM_CXN_APPS_URL') ? CIVICRM_CXN_APPS_URL : NULL,
'siteCallbackUrl' => CRM_Cxn_BAO_Cxn::getSiteCallbackUrl(),
- );
+ ];
return civicrm_api3_create_success($result);
}
* List of fields.
*/
function _civicrm_api3_cxn_app_get_spec(&$spec) {
- $spec['appCert'] = array(
+ $spec['appCert'] = [
'name' => 'appCert',
'type' => CRM_Utils_Type::T_TEXT,
'title' => ts('Certificate'),
'description' => 'PEM-encoded certificate',
- );
- $spec['appId'] = array(
+ ];
+ $spec['appId'] = [
'name' => 'appId',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Application GUID'),
'description' => 'Application GUID',
'maxlength' => 128,
'size' => CRM_Utils_Type::HUGE,
- );
- $spec['appUrl'] = array(
+ ];
+ $spec['appUrl'] = [
'name' => 'appUrl',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Registration URL'),
'description' => 'An endpoint to notify when performing registration',
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
- );
- $spec['desc'] = array(
+ ];
+ $spec['desc'] = [
'name' => 'desc',
'type' => CRM_Utils_Type::T_TEXT,
'title' => ts('Description'),
'description' => 'Description',
- );
+ ];
//$spec['perm'] = array(
// 'name' => 'perm',
// 'type' => CRM_Utils_Type::T_TEXT,
$agent = new \Civi\Cxn\Rpc\Agent(NULL, NULL);
$agent->setCertValidator(CRM_Cxn_BAO_Cxn::createCertificateValidator());
- $message = $agent->decode(array(AppMetasMessage::NAME, GarbledMessage::NAME), $blob);
+ $message = $agent->decode([AppMetasMessage::NAME, GarbledMessage::NAME], $blob);
if ($message instanceof AppMetasMessage) {
return _civicrm_api3_basic_array_get('CxnApp', $params, $message->getData(), 'appId',
- array('appId', 'appUrl', 'desc', 'appCert', 'perm'));
+ ['appId', 'appUrl', 'desc', 'appCert', 'perm']);
}
elseif ($message instanceof GarbledMessage) {
- return civicrm_api3_create_error('Received garbled response', array(
+ return civicrm_api3_create_error('Received garbled response', [
'garbled_message' => $message->getData(),
- ));
+ ]);
}
else {
return civicrm_api3_create_error("Unrecognized message");
* Array containing 'is_error' to denote success or failure and details of the created activity
*/
function civicrm_api3_dashboard_create($params) {
- civicrm_api3_verify_one_mandatory($params, NULL, array(
+ civicrm_api3_verify_one_mandatory($params, NULL, [
'name',
'label',
'url',
'fullscreen_url',
- )
+ ]
);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Dashboard');
}
if (empty($params['id'])) {
civicrm_api3_verify_one_mandatory($params,
NULL,
- array(
+ [
'dashboard_id',
- )
+ ]
);
}
$errors = _civicrm_api3_dashboard_contact_check_params($params);
foreach ($domains as $domain) {
if (!empty($domain['contact_id'])) {
- $values = array();
- $locparams = array(
+ $values = [];
+ $locparams = [
'contact_id' => $domain['contact_id'],
- );
+ ];
$values['location'] = CRM_Core_BAO_Location::getValues($locparams, TRUE);
- $address_array = array(
+ $address_array = [
'street_address', 'supplemental_address_1', 'supplemental_address_2', 'supplemental_address_3',
'city', 'state_province_id', 'postal_code', 'country_id',
'geo_code_1', 'geo_code_2',
- );
+ ];
if (!empty($values['location']['email'])) {
$domain['domain_email'] = CRM_Utils_Array::value('email', $values['location']['email'][1]);
}
if (!empty($values['location']['phone'])) {
- $domain['domain_phone'] = array(
+ $domain['domain_phone'] = [
'phone_type' => CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_Phone', 'phone_type_id',
CRM_Utils_Array::value(
'phone_type_id',
'phone',
$values['location']['phone'][1]
),
- );
+ ];
}
if (!empty($values['location']['address'])) {
* Array of parameters determined by getfields.
*/
function _civicrm_api3_domain_get_spec(&$params) {
- $params['current_domain'] = array(
+ $params['current_domain'] = [
'title' => "Current Domain",
'description' => "get loaded domain",
- );
+ ];
}
/**
* Array of parameters determined by getfields.
*/
function _civicrm_api3_domain_create_spec(&$params) {
- $params['domain_version'] = array(
+ $params['domain_version'] = [
'title' => "CiviCRM Version",
'description' => "The civicrm version this instance is running",
'type' => CRM_Utils_Type::T_STRING,
- );
+ ];
$params['domain_version']['api.required'] = 1;
unset($params['version']);
$params['name']['api.required'] = 1;
* Array of deprecated api entities
*/
function _civicrm_api3_entity_deprecation($entities) {
- $deprecated = array();
+ $deprecated = [];
if (!empty($entities['values'])) {
foreach ($entities['values'] as $entity) {
if (is_string(_civicrm_api3_deprecation_check($entity))) {
function civicrm_api3_entity_getfields($params) {
// we return an empty array so it makes it easier to write generic getdefaults / required tests
// without putting an exception in for entity
- return civicrm_api3_create_success(array());
+ return civicrm_api3_create_success([]);
}
* Array of parameters determined by getfields.
*/
function _civicrm_api3_entity_tag_get_spec(&$params) {
- $params['entity_id']['api.aliases'] = array('contact_id');
+ $params['entity_id']['api.aliases'] = ['contact_id'];
$params['entity_table']['api.default'] = 'civicrm_contact';
}
*/
function _civicrm_api3_entity_tag_common($params, $op = 'add') {
- $entityIDs = $tagIDs = array();
+ $entityIDs = $tagIDs = [];
$entityTable = 'civicrm_contact';
if (is_array($params)) {
foreach ($params as $n => $v) {
}
}
- $values = array('is_error' => 0);
+ $values = ['is_error' => 0];
if ($op == 'add') {
$values['total_count'] = $values['added'] = $values['not_added'] = 0;
foreach ($tagIDs as $tagID) {
function civicrm_api3_event_create($params) {
// Required fields for creating an event
if (empty($params['id']) && empty($params['is_template'])) {
- civicrm_api3_verify_mandatory($params, NULL, array(
+ civicrm_api3_verify_mandatory($params, NULL, [
'start_date',
'title',
- array('event_type_id', 'template_id'),
- ));
+ ['event_type_id', 'template_id'],
+ ]);
}
// Required fields for creating an event template
elseif (empty($params['id']) && !empty($params['is_template'])) {
- civicrm_api3_verify_mandatory($params, NULL, array(
+ civicrm_api3_verify_mandatory($params, NULL, [
'template_title',
- ));
+ ]);
}
// Clone event from template
*/
function _civicrm_api3_event_create_spec(&$params) {
$params['is_active']['api.default'] = 1;
- $params['financial_type_id']['api.aliases'] = array('contribution_type_id');
+ $params['financial_type_id']['api.aliases'] = ['contribution_type_id'];
$params['is_template']['api.default'] = 0;
}
* Array of parameters determined by getfields.
*/
function _civicrm_api3_event_get_spec(&$params) {
- $params['financial_type_id']['api.aliases'] = array('contribution_type_id');
+ $params['financial_type_id']['api.aliases'] = ['contribution_type_id'];
}
/**
* @param array $request
*/
function _civicrm_api3_event_getlist_params(&$request) {
- $fieldsToReturn = array('start_date', 'event_type_id', 'title', 'summary');
+ $fieldsToReturn = ['start_date', 'event_type_id', 'title', 'summary'];
$request['params']['return'] = array_unique(array_merge($fieldsToReturn, $request['extra']));
$request['params']['options']['sort'] = 'start_date DESC';
if (empty($request['params']['id'])) {
- $request['params'] += array(
+ $request['params'] += [
'is_template' => 0,
'is_active' => 1,
- );
+ ];
}
}
* @return array
*/
function _civicrm_api3_event_getlist_output($result, $request) {
- $output = array();
+ $output = [];
if (!empty($result['values'])) {
foreach ($result['values'] as $row) {
- $data = array(
+ $data = [
'id' => $row[$request['id_field']],
'label' => $row[$request['label_field']],
- 'description' => array(
+ 'description' => [
CRM_Core_Pseudoconstant::getLabel(
'CRM_Event_BAO_Event',
'event_type_id',
$row['event_type_id']
),
- ),
- );
+ ],
+ ];
if (!empty($row['start_date'])) {
$data['description'][0] .= ': ' . CRM_Utils_Date::customFormat($row['start_date']);
}
$repeat = CRM_Core_BAO_RecurringEntity::getPositionAndCount($row['id'], 'civicrm_event');
$data['extra']['is_recur'] = FALSE;
if ($repeat) {
- $data['suffix'] = ts('(%1 of %2)', array(1 => $repeat[0], 2 => $repeat[1]));
+ $data['suffix'] = ts('(%1 of %2)', [1 => $repeat[0], 2 => $repeat[1]]);
$data['extra']['is_recur'] = TRUE;
}
$output[] = $data;
* @param $fields
*/
function _civicrm_api3_extension_install_spec(&$fields) {
- $fields['keys'] = array(
+ $fields['keys'] = [
'title' => 'Extension Key(s)',
- 'api.aliases' => array('key'),
+ 'api.aliases' => ['key'],
'type' => CRM_Utils_Type::T_STRING,
'description' => 'Fully qualified name of one or more extensions',
- );
- $fields['path'] = array(
+ ];
+ $fields['path'] = [
'title' => 'Extension Path',
'type' => CRM_Utils_Type::T_STRING,
'description' => 'The path to the extension. May use wildcard ("*").',
- );
+ ];
}
/**
function civicrm_api3_extension_upgrade() {
CRM_Core_Invoke::rebuildMenuAndCaches(TRUE);
$queue = CRM_Extension_Upgrades::createQueue();
- $runner = new CRM_Queue_Runner(array(
+ $runner = new CRM_Queue_Runner([
'title' => 'Extension Upgrades',
'queue' => $queue,
'errorMode' => CRM_Queue_Runner::ERROR_ABORT,
- ));
+ ]);
try {
$result = $runner->runAll();
CRM_Extension_System::singleton()->getCache()->flush();
CRM_Extension_System::singleton(TRUE);
if (CRM_Utils_Array::value('install', $params, TRUE)) {
- CRM_Extension_System::singleton()->getManager()->install(array($params['key']));
+ CRM_Extension_System::singleton()->getManager()->install([$params['key']]);
}
return civicrm_api3_create_success();
* @param $fields
*/
function _civicrm_api3_extension_download_spec(&$fields) {
- $fields['key'] = array(
+ $fields['key'] = [
'title' => 'Extension Key',
'api.required' => 1,
'type' => CRM_Utils_Type::T_STRING,
'description' => 'Fully qualified name of the extension',
- );
- $fields['url'] = array(
+ ];
+ $fields['url'] = [
'title' => 'Download URL',
'type' => CRM_Utils_Type::T_STRING,
'description' => 'Optional as the system can determine the url automatically for public extensions',
- );
- $fields['install'] = array(
+ ];
+ $fields['install'] = [
'title' => 'Auto-install',
'type' => CRM_Utils_Type::T_STRING,
'description' => 'Automatically install the downloaded extension',
'api.default' => TRUE,
- );
+ ];
}
/**
* @param $fields
*/
function _civicrm_api3_extension_refresh_spec(&$fields) {
- $fields['local'] = array(
+ $fields['local'] = [
'title' => 'Rescan Local',
'api.default' => 1,
'type' => CRM_Utils_Type::T_BOOLEAN,
'description' => 'Whether to rescan the local filesystem (default TRUE)',
- );
- $fields['remote'] = array(
+ ];
+ $fields['remote'] = [
'title' => 'Rescan Remote',
'api.default' => 1,
'type' => CRM_Utils_Type::T_BOOLEAN,
'description' => 'Whether to rescan the remote repository (default TRUE)',
- );
+ ];
}
/**
$keys = array_merge($full_names, $keys);
$statuses = CRM_Extension_System::singleton()->getManager()->getStatuses();
$mapper = CRM_Extension_System::singleton()->getMapper();
- $result = array();
+ $result = [];
$id = 0;
foreach ($statuses as $key => $status) {
try {
$obj = $mapper->keyToInfo($key);
}
catch (CRM_Extension_Exception $ex) {
- CRM_Core_Session::setStatus(ts('Failed to read extension (%1). Please refresh the extension list.', array(1 => $key)));
+ CRM_Core_Session::setStatus(ts('Failed to read extension (%1). Please refresh the extension list.', [1 => $key]));
continue;
}
$info = CRM_Extension_System::createExtendedInfo($obj);
unset($params['keys']);
unset($params['full_name']);
- $filterableFields = array('id', 'type', 'status', 'path');
+ $filterableFields = ['id', 'type', 'status', 'path'];
return _civicrm_api3_basic_array_get('Extension', $params, $result, 'id', $filterableFields);
}
*/
function civicrm_api3_extension_getremote($params) {
$extensions = CRM_Extension_System::singleton()->getBrowser()->getExtensions();
- $result = array();
+ $result = [];
$id = 0;
foreach ($extensions as $key => $obj) {
- $info = array();
+ $info = [];
$info['id'] = $id++; // backward compatibility with indexing scheme
$info = array_merge($info, (array) $obj);
$result[] = $info;
}
- return _civicrm_api3_basic_array_get('Extension', $params, $result, 'id', CRM_Utils_Array::value('return', $params, array()));
+ return _civicrm_api3_basic_array_get('Extension', $params, $result, 'id', CRM_Utils_Array::value('return', $params, []));
}
/**
return $params[$key];
}
if ($params[$key] == '') {
- return array();
+ return [];
}
return explode(API_V3_EXTENSION_DELIMITER, $params[$key]);
}
else {
- return array();
+ return [];
}
}
*/
function civicrm_api3_file_create($params) {
- civicrm_api3_verify_mandatory($params, 'CRM_Core_DAO_File', array('uri'));
+ civicrm_api3_verify_mandatory($params, 'CRM_Core_DAO_File', ['uri']);
if (!isset($params['upload_date'])) {
$params['upload_date'] = date("Ymd");
}
$fileDAO = new CRM_Core_DAO_File();
- $properties = array(
+ $properties = [
'id',
'file_type_id',
'mime_type',
'document',
'description',
'upload_date',
- );
+ ];
foreach ($properties as $name) {
if (array_key_exists($name, $params)) {
$fileDAO->save();
- $file = array();
+ $file = [];
_civicrm_api3_object_to_array($fileDAO, $file);
return civicrm_api3_create_success($file, $params, 'File', 'create', $fileDAO);
}
$fileDAO->save();
}
- $file = array();
+ $file = [];
$cloneDAO = clone($fileDAO);
_civicrm_api3_object_to_array($cloneDAO, $file);
return $file;
*/
function civicrm_api3_file_delete($params) {
- civicrm_api3_verify_mandatory($params, NULL, array('id'));
+ civicrm_api3_verify_mandatory($params, NULL, ['id']);
if (CRM_Core_BAO_File::deleteEntityFile('*', $params['id'])) {
return civicrm_api3_create_success();
}
* API success object
*/
function civicrm_api3_generic_getfields($apiRequest, $unique = TRUE) {
- static $results = array();
+ static $results = [];
if ((CRM_Utils_Array::value('cache_clear', $apiRequest['params']))) {
- $results = array();
+ $results = [];
// we will also clear pseudoconstants here - should potentially be moved to relevant BAO classes
CRM_Core_PseudoConstant::flush();
if (!empty($apiRequest['params']['fieldname'])) {
CRM_Utils_PseudoConstant::flushConstant($apiRequest['params']['fieldname']);
}
if (!empty($apiRequest['params']['option_group_id'])) {
- $optionGroupName = civicrm_api('option_group', 'getvalue', array(
+ $optionGroupName = civicrm_api('option_group', 'getvalue', [
'version' => 3,
'id' => $apiRequest['params']['option_group_id'],
'return' => 'name',
- ));
+ ]);
if (is_string($optionGroupName)) {
CRM_Utils_PseudoConstant::flushConstant(_civicrm_api_get_camel_name($optionGroupName));
}
$subentity = CRM_Utils_Array::value('contact_type', $apiRequest['params']);
$action = CRM_Utils_Array::value('action', $apiRequest['params']);
$sequential = empty($apiRequest['params']['sequential']) ? 0 : 1;
- $apiRequest['params']['options'] = CRM_Utils_Array::value('options', $apiRequest['params'], array());
- $optionsToResolve = (array) CRM_Utils_Array::value('get_options', $apiRequest['params']['options'], array());
+ $apiRequest['params']['options'] = CRM_Utils_Array::value('options', $apiRequest['params'], []);
+ $optionsToResolve = (array) CRM_Utils_Array::value('get_options', $apiRequest['params']['options'], []);
if (!$action || $action == 'getvalue' || $action == 'getcount') {
$action = 'get';
if (!empty($metadata[strtolower($apiRequest['entity']) . '_id'])) {
$metadata['id'] = $metadata[$lowercase_entity . '_id'];
unset($metadata[$lowercase_entity . '_id']);
- $metadata['id']['api.aliases'] = array($lowercase_entity . '_id');
+ $metadata['id']['api.aliases'] = [$lowercase_entity . '_id'];
}
}
else {
// (note) or setting for all api where fields is returning 'id' & we want to accept 'note_id' @ the api layer
// nb we don't officially accept note_id anyway - rationale here is more about centralising a now-tested
// inconsistency
- $metadata['id']['api.aliases'] = array($lowercase_entity . '_id');
+ $metadata['id']['api.aliases'] = [$lowercase_entity . '_id'];
}
break;
case 'delete':
- $metadata = array(
- 'id' => array(
+ $metadata = [
+ 'id' => [
'title' => $entity . ' ID',
'api.required' => 1,
- 'api.aliases' => array($lowercase_entity . '_id'),
+ 'api.aliases' => [$lowercase_entity . '_id'],
'type' => CRM_Utils_Type::T_INT,
- ));
+ ]];
break;
// Note: adding setvalue case here instead of in a generic spec function because
// some APIs override the generic setvalue fn which causes the generic spec to be overlooked.
case 'setvalue':
- $metadata = array(
- 'field' => array(
+ $metadata = [
+ 'field' => [
'title' => 'Field name',
'api.required' => 1,
'type' => CRM_Utils_Type::T_STRING,
- ),
- 'id' => array(
+ ],
+ 'id' => [
'title' => $entity . ' ID',
'api.required' => 1,
'type' => CRM_Utils_Type::T_INT,
- ),
- 'value' => array(
+ ],
+ 'value' => [
'title' => 'Value',
'description' => "Field value to set",
'api.required' => 1,
- ),
- );
- if (array_intersect(array('all', 'field'), $optionsToResolve)) {
- $options = civicrm_api3_generic_getfields(array('entity' => $entity, array('params' => array('action' => 'create'))));
+ ],
+ ];
+ if (array_intersect(['all', 'field'], $optionsToResolve)) {
+ $options = civicrm_api3_generic_getfields(['entity' => $entity, ['params' => ['action' => 'create']]]);
$metadata['field']['options'] = CRM_Utils_Array::collect('title', $options['values']);
}
break;
default:
// oddballs are on their own
- $metadata = array();
+ $metadata = [];
}
// Hack for product api to pass tests.
}
// find any supplemental information
- $hypApiRequest = array('entity' => $apiRequest['entity'], 'action' => $action, 'version' => $apiRequest['version']);
+ $hypApiRequest = ['entity' => $apiRequest['entity'], 'action' => $action, 'version' => $apiRequest['version']];
if ($action == 'getsingle') {
$hypApiRequest['action'] = 'get';
}
* @throws \Exception
*/
function _civicrm_api3_generic_getfield_spec(&$params, $apiRequest) {
- $params = array(
- 'name' => array(
+ $params = [
+ 'name' => [
'title' => 'Field name',
'description' => 'Name or alias of field to lookup',
'api.required' => 1,
'type' => CRM_Utils_Type::T_STRING,
- ),
- 'action' => array(
+ ],
+ 'action' => [
'title' => 'API Action',
'api.required' => 1,
'type' => CRM_Utils_Type::T_STRING,
- 'api.aliases' => array('api_action'),
- ),
- 'get_options' => array(
+ 'api.aliases' => ['api_action'],
+ ],
+ 'get_options' => [
'title' => 'Get Options',
'description' => 'Context for which to get field options, or null to skip fetching options.',
'type' => CRM_Utils_Type::T_STRING,
'options' => CRM_Core_DAO::buildOptionsContext(),
- 'api.aliases' => array('context'),
- ),
- );
+ 'api.aliases' => ['context'],
+ ],
+ ];
// Add available options to these params if requested
- if (array_intersect(array('all', 'action'), $apiRequest['params']['options']['get_options'])) {
+ if (array_intersect(['all', 'action'], $apiRequest['params']['options']['get_options'])) {
$actions = civicrm_api3($apiRequest['entity'], 'getactions');
$actions = array_combine($actions['values'], $actions['values']);
// Let's not go meta-crazy
return $result['values'][0];
}
if ($result['count'] !== 1) {
- return civicrm_api3_create_error("Expected one " . $apiRequest['entity'] . " but found " . $result['count'], array('count' => $result['count']));
+ return civicrm_api3_create_error("Expected one " . $apiRequest['entity'] . " but found " . $result['count'], ['count' => $result['count']]);
}
return civicrm_api3_create_error("Undefined behavior");
}
return $result;
}
if ($result['count'] !== 1) {
- $result = civicrm_api3_create_error("Expected one " . $apiRequest['entity'] . " but found " . $result['count'], array('count' => $result['count']));
+ $result = civicrm_api3_create_error("Expected one " . $apiRequest['entity'] . " but found " . $result['count'], ['count' => $result['count']]);
return $result;
}
// we only take "return=" as valid options
if (!empty($apiRequest['params']['return'])) {
if (!isset($result['values'][0][$apiRequest['params']['return']])) {
- return civicrm_api3_create_error("field " . $apiRequest['params']['return'] . " unset or not existing", array('invalid_field' => $apiRequest['params']['return']));
+ return civicrm_api3_create_error("field " . $apiRequest['params']['return'] . " unset or not existing", ['invalid_field' => $apiRequest['params']['return']]);
}
return $result['values'][0][$apiRequest['params']['return']];
}
- return civicrm_api3_create_error("missing param return=field you want to read the value of", array('error_type' => 'mandatory_missing', 'missing_param' => 'return'));
+ return civicrm_api3_create_error("missing param return=field you want to read the value of", ['error_type' => 'mandatory_missing', 'missing_param' => 'return']);
}
/**
return civicrm_api3_create_success($dao->getReferenceCounts());
}
else {
- return civicrm_api3_create_success(array());
+ return civicrm_api3_create_success([]);
}
}
* @param $apiRequest
*/
function _civicrm_api3_generic_getoptions_spec(&$params, $apiRequest) {
- $params += array(
- 'field' => array(
+ $params += [
+ 'field' => [
'title' => 'Field name',
'api.required' => 1,
'type' => CRM_Utils_Type::T_STRING,
- ),
- 'context' => array(
+ ],
+ 'context' => [
'title' => 'Context',
'type' => CRM_Utils_Type::T_STRING,
'options' => CRM_Core_DAO::buildOptionsContext(),
- ),
- );
+ ],
+ ];
// Add available fields if requested
- if (array_intersect(array('all', 'field'), $apiRequest['params']['options']['get_options'])) {
- $fields = civicrm_api3_generic_getfields(array('entity' => $apiRequest['entity'], array('params' => array('action' => 'create'))));
- $params['field']['options'] = array();
+ if (array_intersect(['all', 'field'], $apiRequest['params']['options']['get_options'])) {
+ $fields = civicrm_api3_generic_getfields(['entity' => $apiRequest['entity'], ['params' => ['action' => 'create']]]);
+ $params['field']['options'] = [];
foreach ($fields['values'] as $name => $field) {
if (isset($field['pseudoconstant']) || CRM_Utils_Array::value('type', $field) == CRM_Utils_Type::T_BOOLEAN) {
$params['field']['options'][$name] = CRM_Utils_Array::value('title', $field, $name);
}
}
- $options = civicrm_api($apiRequest['entity'], 'getoptions', array('version' => 3, 'field' => $fieldname, 'context' => $context));
+ $options = civicrm_api($apiRequest['entity'], 'getoptions', ['version' => 3, 'field' => $fieldname, 'context' => $context]);
if (is_array(CRM_Utils_Array::value('values', $options))) {
$metadata[$fieldname]['options'] = $options['values'];
}
* @throws API_Exception
*/
function civicrm_api3_generic_getActions($apiRequest) {
- civicrm_api3_verify_mandatory($apiRequest, NULL, array('entity'));
+ civicrm_api3_verify_mandatory($apiRequest, NULL, ['entity']);
$mfp = \Civi::service('magic_function_provider');
$actions = $mfp->getActionNames($apiRequest['version'], $apiRequest['entity']);
return civicrm_api3_create_success($actions, $apiRequest['params'], $apiRequest['entity'], 'getactions');
function civicrm_api3_generic_getList($apiRequest) {
$entity = _civicrm_api_get_entity_name_from_camel($apiRequest['entity']);
$request = $apiRequest['params'];
- $meta = civicrm_api3_generic_getfields(array('action' => 'get') + $apiRequest, FALSE);
+ $meta = civicrm_api3_generic_getfields(['action' => 'get'] + $apiRequest, FALSE);
// Hey api, would you like to provide default values?
$fnName = "_civicrm_api3_{$entity}_getlist_defaults";
- $defaults = function_exists($fnName) ? $fnName($request) : array();
+ $defaults = function_exists($fnName) ? $fnName($request) : [];
_civicrm_api3_generic_getList_defaults($entity, $request, $defaults, $meta['values']);
// Hey api, would you like to format the search params?
_civicrm_api3_generic_getlist_postprocess($result, $request, $values);
- $output = array('page_num' => $request['page_num']);
+ $output = ['page_num' => $request['page_num']];
// Limit is set for searching but not fetching by id
if (!empty($request['params']['options']['limit'])) {
* @param array $fields
*/
function _civicrm_api3_generic_getList_defaults($entity, &$request, $apiDefaults, $fields) {
- $defaults = array(
+ $defaults = [
'page_num' => 1,
'input' => '',
'image_field' => NULL,
'color_field' => isset($fields['color']) ? 'color' : NULL,
'id_field' => $entity == 'option_value' ? 'value' : 'id',
- 'description_field' => array(),
+ 'description_field' => [],
'add_wildcard' => Civi::settings()->get('includeWildCardInName'),
- 'params' => array(),
- 'extra' => array(),
- );
+ 'params' => [],
+ 'extra' => [],
+ ];
// Find main field from meta
- foreach (array('sort_name', 'title', 'label', 'name', 'subject') as $field) {
+ foreach (['sort_name', 'title', 'label', 'name', 'subject'] as $field) {
if (isset($fields[$field])) {
$defaults['label_field'] = $defaults['search_field'] = $field;
break;
}
}
// Find fields to be used for the description
- foreach (array('description') as $field) {
+ foreach (['description'] as $field) {
if (isset($fields[$field])) {
$defaults['description_field'][] = $field;
}
}
$request += $apiDefaults + $defaults;
// Default api params
- $params = array(
+ $params = [
'sequential' => 1,
- 'options' => array(),
- );
+ 'options' => [],
+ ];
// When searching e.g. autocomplete
if ($request['input']) {
- $params[$request['search_field']] = array('LIKE' => ($request['add_wildcard'] ? '%' : '') . $request['input'] . '%');
+ $params[$request['search_field']] = ['LIKE' => ($request['add_wildcard'] ? '%' : '') . $request['input'] . '%'];
}
// When looking up a field e.g. displaying existing record
if (!empty($request['id'])) {
// Don't run into search limits when prefilling selection
$params['options']['limit'] = NULL;
unset($params['options']['offset'], $request['params']['options']['limit'], $request['params']['options']['offset']);
- $params[$request['id_field']] = is_array($request['id']) ? array('IN' => $request['id']) : $request['id'];
+ $params[$request['id_field']] = is_array($request['id']) ? ['IN' => $request['id']] : $request['id'];
}
$request['params'] += $params;
- $request['params']['options'] += array(
+ $request['params']['options'] += [
// Add pagination parameters
'sort' => $request['label_field'],
// Adding one extra result allows us to see if there are any more
'limit' => $resultsPerPage + 1,
// Because sql is zero-based
'offset' => ($request['page_num'] - 1) * $resultsPerPage,
- );
+ ];
}
/**
* @param array $request
*/
function _civicrm_api3_generic_getlist_params(&$request) {
- $fieldsToReturn = array($request['id_field'], $request['label_field']);
+ $fieldsToReturn = [$request['id_field'], $request['label_field']];
if (!empty($request['image_field'])) {
$fieldsToReturn[] = $request['image_field'];
}
* @return array
*/
function _civicrm_api3_generic_getlist_output($result, $request, $entity, $fields) {
- $output = array();
+ $output = [];
if (!empty($result['values'])) {
foreach ($result['values'] as $row) {
- $data = array(
+ $data = [
'id' => $row[$request['id_field']],
'label' => $row[$request['label_field']],
- );
+ ];
if (!empty($request['description_field'])) {
- $data['description'] = array();
+ $data['description'] = [];
foreach ((array) $request['description_field'] as $field) {
if (!empty($row[$field])) {
if (!isset($fields[$field]['pseudoconstant'])) {
* @param $values
*/
function _civicrm_api3_generic_getlist_postprocess($result, $request, &$values) {
- $chains = array();
+ $chains = [];
foreach ($request['params'] as $field => $param) {
if (substr($field, 0, 4) === 'api.') {
$chains[] = $field;
* @param array $apiRequest
*/
function _civicrm_api3_generic_getlist_spec(&$params, $apiRequest) {
- $params += array(
- 'page_num' => array(
+ $params += [
+ 'page_num' => [
'title' => 'Page Number',
'description' => "Current page of a multi-page lookup",
'type' => CRM_Utils_Type::T_INT,
- ),
- 'input' => array(
+ ],
+ 'input' => [
'title' => 'Search Input',
'description' => "String to search on",
'type' => CRM_Utils_Type::T_TEXT,
- ),
- 'params' => array(
+ ],
+ 'params' => [
'title' => 'API Params',
'description' => "Additional filters to send to the {$apiRequest['entity']} API.",
- ),
- 'extra' => array(
+ ],
+ 'extra' => [
'title' => 'Extra',
'description' => 'Array of additional fields to return.',
- ),
- 'image_field' => array(
+ ],
+ 'image_field' => [
'title' => 'Image Field',
'description' => "Field that this entity uses to store icons (usually automatic)",
'type' => CRM_Utils_Type::T_TEXT,
- ),
- 'id_field' => array(
+ ],
+ 'id_field' => [
'title' => 'ID Field',
'description' => "Field that uniquely identifies this entity (usually automatic)",
'type' => CRM_Utils_Type::T_TEXT,
- ),
- 'description_field' => array(
+ ],
+ 'description_field' => [
'title' => 'Description Field',
'description' => "Field that this entity uses to store summary text (usually automatic)",
'type' => CRM_Utils_Type::T_TEXT,
- ),
- 'label_field' => array(
+ ],
+ 'label_field' => [
'title' => 'Label Field',
'description' => "Field to display as title of results (usually automatic)",
'type' => CRM_Utils_Type::T_TEXT,
- ),
- 'search_field' => array(
+ ],
+ 'search_field' => [
'title' => 'Search Field',
'description' => "Field to search on (assumed to be the same as label field unless otherwise specified)",
'type' => CRM_Utils_Type::T_TEXT,
- ),
- );
+ ],
+ ];
}
*/
function civicrm_api3_generic_getunique($apiRequest) {
$entity = _civicrm_api_get_entity_name_from_camel($apiRequest['entity']);
- $uniqueFields = array();
+ $uniqueFields = [];
$dao = _civicrm_api3_get_DAO($entity);
$uFields = $dao::indices();
$params = $apiRequest['params'];
$id = $params['id'];
if (!is_numeric($id)) {
- return civicrm_api3_create_error(ts('Please enter a number'), array(
+ return civicrm_api3_create_error(ts('Please enter a number'), [
'error_code' => 'NaN',
'field' => "id",
- ));
+ ]);
}
$field = CRM_Utils_String::munge($params['field']);
$value = $params['value'];
- $fields = civicrm_api($entity, 'getFields', array(
+ $fields = civicrm_api($entity, 'getFields', [
'version' => 3,
'action' => 'create',
- "sequential")
+ "sequential"]
);
// getfields error, shouldn't happen.
if ($fields['is_error']) {
// Trim off the id portion of a multivalued custom field name
$fieldKey = $isCustom && substr_count($field, '_') > 1 ? rtrim(rtrim($field, '1234567890'), '_') : $field;
if (!array_key_exists($fieldKey, $fields)) {
- return civicrm_api3_create_error("Param 'field' ($field) is invalid. must be an existing field", array("error_code" => "invalid_field", "fields" => array_keys($fields)));
+ return civicrm_api3_create_error("Param 'field' ($field) is invalid. must be an existing field", ["error_code" => "invalid_field", "fields" => array_keys($fields)]);
}
$def = $fields[$fieldKey];
// TODO: create a utility for this since it's needed in many places
if (!empty($def['required']) || !empty($def['is_required'])) {
if ((empty($value) || $value === 'null') && $value !== '0' && $value !== 0) {
- return civicrm_api3_create_error(ts('%1 is a required field.', array(1 => $title)), array("error_code" => "required", "field" => $field));
+ return civicrm_api3_create_error(ts('%1 is a required field.', [1 => $title]), ["error_code" => "required", "field" => $field]);
}
}
switch ($def['type']) {
case CRM_Utils_Type::T_FLOAT:
if (!is_numeric($value) && !empty($value) && $value !== 'null') {
- return civicrm_api3_create_error(ts('%1 must be a number.', array(1 => $title)), array('error_code' => 'NaN'));
+ return civicrm_api3_create_error(ts('%1 must be a number.', [1 => $title]), ['error_code' => 'NaN']);
}
break;
case CRM_Utils_Type::T_INT:
if (!CRM_Utils_Rule::integer($value) && !empty($value) && $value !== 'null') {
- return civicrm_api3_create_error(ts('%1 must be a number.', array(1 => $title)), array('error_code' => 'NaN'));
+ return civicrm_api3_create_error(ts('%1 must be a number.', [1 => $title]), ['error_code' => 'NaN']);
}
break;
case CRM_Utils_Type::T_STRING:
case CRM_Utils_Type::T_TEXT:
if (!CRM_Utils_Rule::xssString($value)) {
- return civicrm_api3_create_error(ts('Illegal characters in input (potential scripting attack)'), array('error_code' => 'XSS'));
+ return civicrm_api3_create_error(ts('Illegal characters in input (potential scripting attack)'), ['error_code' => 'XSS']);
}
if (array_key_exists('maxlength', $def)) {
$value = substr($value, 0, $def['maxlength']);
break;
default:
- return civicrm_api3_create_error("Param '$field' is of a type not managed yet (" . $def['type'] . "). Join the API team and help us implement it", array('error_code' => 'NOT_IMPLEMENTED'));
+ return civicrm_api3_create_error("Param '$field' is of a type not managed yet (" . $def['type'] . "). Join the API team and help us implement it", ['error_code' => 'NOT_IMPLEMENTED']);
}
$dao_name = _civicrm_api3_get_DAO($entity);
- $params = array('id' => $id, $field => $value);
+ $params = ['id' => $id, $field => $value];
if ((!empty($def['pseudoconstant']) || !empty($def['option_group_id'])) && $value !== '' && $value !== 'null') {
_civicrm_api3_api_match_pseudoconstant($params[$field], $entity, $field, $def);
if (strtolower($apiRequest['entity']) == 'contribution') {
return civicrm_api($apiRequest['entity'], 'create', $apiRequest['params']);
}
- $seek = array($key_id => $apiRequest['params'][$key_id], 'version' => $apiRequest['version']);
+ $seek = [$key_id => $apiRequest['params'][$key_id], 'version' => $apiRequest['version']];
$existing = civicrm_api($apiRequest['entity'], 'get', $seek);
if ($existing['is_error']) {
return $existing;
$params['grant_type_id']['api.required'] = 1;
$params['status_id']['api.required'] = 1;
$params['amount_total']['api.required'] = 1;
- $params['status_id']['api.aliases'] = array('grant_status');
+ $params['status_id']['api.aliases'] = ['grant_status'];
}
/**
* @throws API_Exception
*/
function civicrm_api3_group_delete($params) {
- $group = civicrm_api3_group_get(array('id' => $params['id']));
+ $group = civicrm_api3_group_get(['id' => $params['id']]);
if ($group['count'] == 0) {
throw new API_Exception('Could not delete group ' . $params['id']);
}
function civicrm_api3_group_contact_create($params) {
// Nonstandard bao - doesn't accept ID as a param, so convert id to group_id + contact_id
if (!empty($params['id'])) {
- $getParams = array('id' => $params['id']);
+ $getParams = ['id' => $params['id']];
$info = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $getParams);
if (!empty($info['values'][$params['id']])) {
$params['group_id'] = $info['values'][$params['id']]['group_id'];
*/
function civicrm_api3_group_contact_delete($params) {
$checkParams = $params;
- if (!empty($checkParams['status']) && in_array($checkParams['status'], array('Removed', 'Deleted'))) {
- $checkParams['status'] = array('IN' => array('Added', 'Pending'));
+ if (!empty($checkParams['status']) && in_array($checkParams['status'], ['Removed', 'Deleted'])) {
+ $checkParams['status'] = ['IN' => ['Added', 'Pending']];
}
elseif (!empty($checkParams['status']) && $checkParams['status'] == 'Added') {
- $checkParams['status'] = array('IN' => array('Pending', 'Removed'));
+ $checkParams['status'] = ['IN' => ['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'] = array('IN' => array('Removed', 'Pending'));
+ $checkParams['status'] = ['IN' => ['Removed', 'Pending']];
}
$groupContact2 = civicrm_api3('GroupContact', 'get', $checkParams);
if ($groupContact['count'] == 0 && $groupContact2['count'] == 0) {
*/
function _civicrm_api3_group_contact_common($params, $op = 'Added') {
- $contactIDs = array();
- $groupIDs = array();
+ $contactIDs = [];
+ $groupIDs = [];
// CRM-16959: Handle multiple Contact IDs and Group IDs in legacy format
// (contact_id.1, contact_id.2) or as an array
$tracking = CRM_Utils_Array::value('tracking', $params);
if ($op == 'Added' || $op == 'Pending') {
- $extraReturnValues = array(
+ $extraReturnValues = [
'total_count' => 0,
'added' => 0,
'not_added' => 0,
- );
+ ];
foreach ($groupIDs as $groupID) {
list($tc, $a, $na) = CRM_Contact_BAO_GroupContact::addContactsToGroup($contactIDs,
$groupID,
}
}
else {
- $extraReturnValues = array(
+ $extraReturnValues = [
'total_count' => 0,
'removed' => 0,
'not_removed' => 0,
- );
+ ];
foreach ($groupIDs as $groupID) {
list($tc, $r, $nr) = CRM_Contact_BAO_GroupContact::removeContactsFromGroup($contactIDs, $groupID, $method, $status, $tracking);
$extraReturnValues['total_count'] += $tc;
*/
function civicrm_api3_group_contact_update_status($params) {
- civicrm_api3_verify_mandatory($params, NULL, array('contact_id', 'group_id'));
+ civicrm_api3_verify_mandatory($params, NULL, ['contact_id', 'group_id']);
CRM_Contact_BAO_GroupContact::addContactsToGroup(
- array($params['contact_id']),
+ [$params['contact_id']],
$params['group_id'],
CRM_Utils_Array::value('method', $params, 'API'),
'Added',
* Array of deprecated actions
*/
function _civicrm_api3_group_contact_deprecation() {
- return array(
+ return [
'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".',
- );
+ ];
}
$params['last_run'] = 'null';
$params['scheduled_run_date'] = 'null';
$newJobDAO = CRM_Core_BAO_Job::copy($id, $params);
- return civicrm_api3('Job', 'get', array('id' => $newJobDAO->id));
+ return civicrm_api3('Job', 'get', ['id' => $newJobDAO->id]);
}
/**
* @param array $params
*/
function _civicrm_api3_job_geocode_spec(&$params) {
- $params['start'] = array(
+ $params['start'] = [
'title' => 'Starting Contact ID',
'type' => CRM_Utils_Type::T_INT,
- );
- $params['end'] = array(
+ ];
+ $params['end'] = [
'title' => 'Ending Contact ID',
'type' => CRM_Utils_Type::T_INT,
- );
- $params['geocoding'] = array(
+ ];
+ $params['geocoding'] = [
'title' => 'Geocode address?',
'type' => CRM_Utils_Type::T_BOOLEAN,
- );
- $params['parse'] = array(
+ ];
+ $params['parse'] = [
'title' => 'Parse street address?',
'type' => CRM_Utils_Type::T_BOOLEAN,
- );
- $params['throttle'] = array(
+ ];
+ $params['throttle'] = [
'title' => 'Throttle?',
'description' => 'If enabled, geo-codes at a slow rate',
'type' => CRM_Utils_Type::T_BOOLEAN,
- );
+ ];
}
/**
function _civicrm_api3_job_send_reminder(&$params) {
//@todo this function will now take all fields in action_schedule as params
// as it is calling the api fn to set the filters - update getfields to reflect
- $params['id'] = array(
+ $params['id'] = [
'type' => CRM_Utils_Type::T_INT,
'title' => 'Action Schedule ID',
- );
+ ];
}
/**
* Execute a specific report instance and send the output via email.
* Array of parameters determined by getfields.
*/
function _civicrm_api3_job_update_greeting_spec(&$params) {
- $params['ct'] = array(
+ $params['ct'] = [
'api.required' => 1,
'title' => 'Contact Type',
'type' => CRM_Utils_Type::T_STRING,
- );
- $params['gt'] = array(
+ ];
+ $params['gt'] = [
'api.required' => 1,
'title' => 'Greeting Type',
'type' => CRM_Utils_Type::T_STRING,
- );
+ ];
}
/**
return civicrm_api3_create_error('Process Queue failed');
}
else {
- $values = array(
+ $values = [
'processed' => CRM_Mailing_BAO_MailingJob::$mailsProcessed - $mailsProcessedOrig,
- );
+ ];
return civicrm_api3_create_success($values, $params, 'Job', 'process_mailing');
}
}
return civicrm_api3_create_error('Process Queue failed');
}
else {
- $values = array(
+ $values = [
'processed' => CRM_Mailing_BAO_MailingJob::$mailsProcessed - $mailsProcessedOrig,
- );
+ ];
return civicrm_api3_create_success($values, $params, 'Job', 'process_sms');
}
}
* @param array $params
*/
function _civicrm_api3_job_fetch_bounces_spec(&$params) {
- $params['is_create_activities'] = array(
+ $params['is_create_activities'] = [
'api.default' => 0,
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => ts('Create activities for replies?'),
- );
+ ];
}
/**
try {
CRM_Utils_Mail_EmailProcessor::processActivities();
- $values = array();
+ $values = [];
$lock->release();
return civicrm_api3_create_success($values, $params, 'Job', 'fetch_activities');
}
function civicrm_api3_job_process_batch_merge($params) {
$rule_group_id = CRM_Utils_Array::value('rule_group_id', $params);
if (!$rule_group_id) {
- $rule_group_id = civicrm_api3('RuleGroup', 'getvalue', array(
+ $rule_group_id = civicrm_api3('RuleGroup', 'getvalue', [
'contact_type' => 'Individual',
'used' => 'Unsupervised',
'return' => 'id',
- 'options' => array('limit' => 1),
- ));
+ 'options' => ['limit' => 1],
+ ]);
}
$rgid = CRM_Utils_Array::value('rgid', $params);
$gid = CRM_Utils_Array::value('gid', $params);
$mode = CRM_Utils_Array::value('mode', $params, 'safe');
- $result = CRM_Dedupe_Merger::batchMerge($rule_group_id, $gid, $mode, 1, 2, CRM_Utils_Array::value('criteria', $params, array()), CRM_Utils_Array::value('check_permissions', $params));
+ $result = CRM_Dedupe_Merger::batchMerge($rule_group_id, $gid, $mode, 1, 2, CRM_Utils_Array::value('criteria', $params, []), CRM_Utils_Array::value('check_permissions', $params));
return civicrm_api3_create_success($result, $params);
}
* @param $params
*/
function _civicrm_api3_job_process_batch_merge_spec(&$params) {
- $params['rule_group_id'] = array(
+ $params['rule_group_id'] = [
'title' => 'Dedupe rule group id, defaults to Contact Unsupervised rule',
'type' => CRM_Utils_Type::T_INT,
- 'api.aliases' => array('rgid'),
- );
- $params['gid'] = array(
+ 'api.aliases' => ['rgid'],
+ ];
+ $params['gid'] = [
'title' => 'group id',
'type' => CRM_Utils_Type::T_INT,
- );
- $params['mode'] = array(
+ ];
+ $params['mode'] = [
'title' => 'Mode',
'description' => 'helps decide how to behave when there are conflicts. A \'safe\' value skips the merge if there are no conflicts. Does a force merge otherwise.',
'type' => CRM_Utils_Type::T_STRING,
- );
- $params['auto_flip'] = array(
+ ];
+ $params['auto_flip'] = [
'title' => 'Auto Flip',
'description' => 'let the api decide which contact to retain and which to delete?',
'type' => CRM_Utils_Type::T_BOOLEAN,
- );
+ ];
}
/**
'PaymentCron',
array_merge(
$params,
- array(
+ [
'caller' => 'api',
- )
+ ]
)
);
'PaymentCron',
array_merge(
$params,
- array(
+ [
'mode' => 'test',
- )
+ ]
)
);
}
* @throws \API_Exception
*/
function civicrm_api3_loc_block_create($params) {
- $entities = array();
- $any_mandatory = array(
+ $entities = [];
+ $any_mandatory = [
'address',
'address_id',
'phone',
'im_id',
'email',
'email_id',
- );
+ ];
civicrm_api3_verify_one_mandatory($params, NULL, $any_mandatory);
// Call the appropriate api to create entities if any are passed in the params.
// This is basically chaining but in reverse - we create the sub-entities first
// because chaining does not work in reverse, or with keys like 'email_2'.
- $items = array('address', 'email', 'phone', 'im');
+ $items = ['address', 'email', 'phone', 'im'];
foreach ($items as $item) {
- foreach (array('', '_2') as $suf) {
+ foreach (['', '_2'] as $suf) {
$key = $item . $suf;
if (!empty($params[$key]) && is_array($params[$key])) {
$info = $params[$key];
$dao->copyValues($params);
$dao->save();
if (!empty($dao->id)) {
- $values = array($dao->id => $entities);
+ $values = [$dao->id => $entities];
_civicrm_api3_object_to_array($dao, $values[$dao->id]);
return civicrm_api3_create_success($values, $params, 'LocBlock', 'create', $dao);
}
// This is a helper because api chaining does not work with a key like 'email_2'.
if (!empty($options['return'])) {
unset($params['return']);
- $values = array();
- $items = array('address', 'email', 'phone', 'im');
+ $values = [];
+ $items = ['address', 'email', 'phone', 'im'];
$returnAll = !empty($options['return']['all']);
foreach (_civicrm_api3_basic_get('CRM_Core_DAO_LocBlock', $params, FALSE) as $val) {
foreach ($items as $item) {
- foreach (array('', '_2') as $suf) {
+ foreach (['', '_2'] as $suf) {
$key = $item . $suf;
if (!empty($val[$key . '_id']) && ($returnAll || !empty($options['return'][$key]))) {
- $val[$key] = civicrm_api($item, 'getsingle', array('version' => 3, 'id' => $val[$key . '_id']));
+ $val[$key] = civicrm_api($item, 'getsingle', ['version' => 3, 'id' => $val[$key . '_id']]);
}
}
}
* @throws \Civi\API\Exception\UnauthorizedException
*/
function _civicrm_api3_logging_revert_spec(&$params) {
- $params['log_conn_id'] = array(
+ $params['log_conn_id'] = [
'title' => 'Logging Connection ID',
'type' => CRM_Utils_Type::T_STRING,
'api.required' => TRUE,
- );
- $params['log_date'] = array(
+ ];
+ $params['log_date'] = [
'title' => 'Logging Timestamp',
'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
- );
- $params['interval'] = array(
+ ];
+ $params['interval'] = [
'title' => ts('Interval (required if date is included)'),
'type' => CRM_Utils_Type::T_STRING,
'api.default' => '10 SECOND',
'description' => ts('Used when log_date is passed in'),
- );
+ ];
- $params['tables'] = array(
+ $params['tables'] = [
'title' => ts('Tables to revert'),
'type' => CRM_Utils_Type::T_STRING,
'description' => ts('Tables to revert, if not set all contact-referring entities will be reverted'),
- );
+ ];
}
/**
* @throws \Civi\API\Exception\UnauthorizedException
*/
function _civicrm_api3_logging_get_spec(&$params) {
- $params['log_conn_id'] = array(
+ $params['log_conn_id'] = [
'title' => 'Logging Connection ID',
'type' => CRM_Utils_Type::T_STRING,
'api.required' => TRUE,
- );
- $params['log_date'] = array(
+ ];
+ $params['log_date'] = [
'title' => 'Logging Timestamp',
'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
- );
- $params['interval'] = array(
+ ];
+ $params['interval'] = [
'title' => ts('Interval (required if date is included)'),
'type' => CRM_Utils_Type::T_STRING,
'api.default' => '10 SECOND',
'description' => ts('Used when log_date is passed in'),
- );
- $params['tables'] = array(
+ ];
+ $params['tables'] = [
'title' => ts('Tables to query'),
'type' => CRM_Utils_Type::T_STRING,
'description' => ts('Tables to query, if not set all contact-referring entities will be queried'),
- );
+ ];
}
*/
function civicrm_api3_mailing_create($params) {
if (isset($params['template_options']) && is_array($params['template_options'])) {
- $params['template_options'] = ($params['template_options'] === array()) ? '{}' : json_encode($params['template_options']);
+ $params['template_options'] = ($params['template_options'] === []) ? '{}' : json_encode($params['template_options']);
}
if (CRM_Mailing_Info::workflowEnabled()) {
// Note: 'schedule mailings' and 'approve mailings' can update certain fields, but can't create.
}
}
- $safeParams = array();
+ $safeParams = [];
$fieldPerms = CRM_Mailing_BAO_Mailing::getWorkflowFieldPerms();
foreach (array_keys($params) as $field) {
if (CRM_Core_Permission::check($fieldPerms[$field])) {
* @throws \API_Exception
*/
function civicrm_api3_mailing_gettokens($params) {
- $tokens = array();
+ $tokens = [];
foreach ((array) $params['entity'] as $ent) {
$func = lcfirst($ent) . 'Tokens';
if (!method_exists('CRM_Core_SelectValues', $func)) {
* Array of parameters determined by getfields.
*/
function _civicrm_api3_mailing_gettokens_spec(&$params) {
- $params['entity'] = array(
- 'api.default' => array('contact'),
+ $params['entity'] = [
+ 'api.default' => ['contact'],
'api.required' => 1,
'api.multiple' => 1,
'title' => 'Entity',
- 'options' => array(),
- );
+ 'options' => [],
+ ];
// Fetch a list of token functions and format to look like entity names
foreach (get_class_methods('CRM_Core_SelectValues') as $func) {
if (strpos($func, 'Tokens')) {
* @throws \CiviCRM_API3_Exception
*/
function civicrm_api3_mailing_clone($params) {
- $BLACKLIST = array(
+ $BLACKLIST = [
'id',
'is_completed',
'created_id',
'is_archived',
'hash',
'mailing_type',
- );
+ ];
- $get = civicrm_api3('Mailing', 'getsingle', array('id' => $params['id']));
+ $get = civicrm_api3('Mailing', 'getsingle', ['id' => $params['id']]);
- $newParams = array();
+ $newParams = [];
$newParams['debug'] = CRM_Utils_Array::value('debug', $params);
- $newParams['groups']['include'] = array();
- $newParams['groups']['exclude'] = array();
- $newParams['mailings']['include'] = array();
- $newParams['mailings']['exclude'] = array();
+ $newParams['groups']['include'] = [];
+ $newParams['groups']['exclude'] = [];
+ $newParams['mailings']['include'] = [];
+ $newParams['mailings']['exclude'] = [];
foreach ($get as $field => $value) {
if (!in_array($field, $BLACKLIST)) {
$newParams[$field] = $value;
* @throws API_Exception
*/
function civicrm_api3_mailing_submit($params) {
- civicrm_api3_verify_mandatory($params, 'CRM_Mailing_DAO_Mailing', array('id'));
+ civicrm_api3_verify_mandatory($params, 'CRM_Mailing_DAO_Mailing', ['id']);
if (!isset($params['scheduled_date']) && !isset($updateParams['approval_date'])) {
throw new API_Exception("Missing parameter scheduled_date and/or approval_date");
throw new API_Exception("Failed to determine current user");
}
- $updateParams = array();
+ $updateParams = [];
$updateParams['id'] = $params['id'];
// Note: we'll pass along scheduling/approval fields, but they may get ignored
* Array of deprecated actions
*/
function _civicrm_api3_mailing_deprecation() {
- return array('event_confirm' => 'Mailing api "event_confirm" action is deprecated. Use the mailing_event_confirm api instead.');
+ return ['event_confirm' => 'Mailing api "event_confirm" action is deprecated. Use the mailing_event_confirm api instead.'];
}
/**
function civicrm_api3_mailing_event_click($params) {
civicrm_api3_verify_mandatory($params,
'CRM_Mailing_Event_DAO_TrackableURLOpen',
- array('event_queue_id', 'url_id'),
+ ['event_queue_id', 'url_id'],
FALSE
);
$url = CRM_Mailing_Event_BAO_TrackableURLOpen::track($queue, $url_id);
- $values = array();
+ $values = [];
$values['url'] = $url;
$values['is_error'] = 0;
civicrm_api3_verify_mandatory($params,
'CRM_Mailing_Event_DAO_Opened',
- array('event_queue_id'),
+ ['event_queue_id'],
FALSE
);
if (!$contactID) {
$contactID = $session->get('userID');
}
- $mailingParams = array('contact_id' => $contactID);
+ $mailingParams = ['contact_id' => $contactID];
$details = CRM_Utils_Token::getTokenDetails($mailingParams, $returnProperties, TRUE, TRUE, NULL, $mailing->getFlattenedTokens());
TRUE, $details[0][$contactID], $attachments
);
- return civicrm_api3_create_success(array(
+ return civicrm_api3_create_success([
'id' => $params['id'],
'contact_id' => $contactID,
'subject' => $mime->headers()['Subject'],
'body_html' => $mime->getHTMLBody(),
'body_text' => $mime->getTXTBody(),
- ));
+ ]);
}
/**
}
civicrm_api3_verify_mandatory($params,
'CRM_Mailing_DAO_MailingJob',
- array('mailing_id'),
+ ['mailing_id'],
FALSE
);
$testEmailParams['emails'] = array_key_exists('test_email', $testEmailParams) ? explode(',', strtolower($testEmailParams['test_email'])) : NULL;
if (!empty($params['test_email'])) {
$query = CRM_Utils_SQL_Select::from('civicrm_email e')
- ->select(array('e.id', 'e.contact_id', 'e.email'))
+ ->select(['e.id', 'e.contact_id', 'e.email'])
->join('c', 'INNER JOIN civicrm_contact c ON e.contact_id = c.id')
- ->where('e.email IN (@emails)', array('@emails' => $testEmailParams['emails']))
+ ->where('e.email IN (@emails)', ['@emails' => $testEmailParams['emails']])
->where('e.on_hold = 0')
->where('c.is_opt_out = 0')
->where('c.do_not_email = 0')
->where('c.is_deceased = 0')
->where('c.is_deleted = 0')
->groupBy('e.id')
- ->orderBy(array('e.is_bulkmail DESC', 'e.is_primary DESC'))
+ ->orderBy(['e.is_bulkmail DESC', 'e.is_primary DESC'])
->toSQL();
$dao = CRM_Core_DAO::executeQuery($query);
- $emailDetail = array();
+ $emailDetail = [];
// fetch contact_id and email id for all existing emails
while ($dao->fetch()) {
- $emailDetail[strtolower($dao->email)] = array(
+ $emailDetail[strtolower($dao->email)] = [
'contact_id' => $dao->contact_id,
'email_id' => $dao->id,
- );
+ ];
}
foreach ($testEmailParams['emails'] as $key => $email) {
$email = trim($email);
if (!$contactId) {
//create new contact.
$contact = civicrm_api3('Contact', 'create',
- array(
+ [
'contact_type' => 'Individual',
'email' => $email,
- 'api.Email.get' => array('return' => 'id'),
- )
+ 'api.Email.get' => ['return' => 'id'],
+ ]
);
$contactId = $contact['id'];
$emailId = $contact['values'][$contactId]['api.Email.get']['id'];
}
civicrm_api3('MailingEventQueue', 'create',
- array(
+ [
'job_id' => $job['id'],
'email_id' => $emailId,
'contact_id' => $contactId,
- )
+ ]
);
}
}
function civicrm_api3_mailing_stats($params) {
civicrm_api3_verify_mandatory($params,
'CRM_Mailing_DAO_MailingJob',
- array('mailing_id'),
+ ['mailing_id'],
FALSE
);
$params['date'] = CRM_Utils_Date::processDate($params['date'] . ' ' . $params['date_time']);
}
- $stats[$params['mailing_id']] = array();
+ $stats[$params['mailing_id']] = [];
if (empty($params['job_id'])) {
$params['job_id'] = NULL;
}
- foreach (array('Delivered', 'Bounces', 'Unsubscribers', 'Unique Clicks', 'Opened') as $detail) {
+ foreach (['Delivered', 'Bounces', 'Unsubscribers', 'Unique Clicks', 'Opened'] as $detail) {
switch ($detail) {
case 'Delivered':
- $stats[$params['mailing_id']] += array(
+ $stats[$params['mailing_id']] += [
$detail => CRM_Mailing_Event_BAO_Delivered::getTotalCount($params['mailing_id'], $params['job_id'], (bool) $params['is_distinct'], $params['date']),
- );
+ ];
break;
case 'Bounces':
- $stats[$params['mailing_id']] += array(
+ $stats[$params['mailing_id']] += [
$detail => CRM_Mailing_Event_BAO_Bounce::getTotalCount($params['mailing_id'], $params['job_id'], (bool) $params['is_distinct'], $params['date']),
- );
+ ];
break;
case 'Unsubscribers':
- $stats[$params['mailing_id']] += array(
+ $stats[$params['mailing_id']] += [
$detail => CRM_Mailing_Event_BAO_Unsubscribe::getTotalCount($params['mailing_id'], $params['job_id'], (bool) $params['is_distinct'], NULL, $params['date']),
- );
+ ];
break;
case 'Unique Clicks':
- $stats[$params['mailing_id']] += array(
+ $stats[$params['mailing_id']] += [
$detail => CRM_Mailing_Event_BAO_TrackableURLOpen::getTotalCount($params['mailing_id'], $params['job_id'], (bool) $params['is_distinct'], NULL, $params['date']),
- );
+ ];
break;
case 'Opened':
- $stats[$params['mailing_id']] += array(
+ $stats[$params['mailing_id']] += [
$detail => CRM_Mailing_Event_BAO_Opened::getTotalCount($params['mailing_id'], $params['job_id'], (bool) $params['is_distinct'], $params['date']),
- );
+ ];
break;
}
}
* @throws API_Exception
*/
function civicrm_api3_mailing_a_b_submit($params) {
- civicrm_api3_verify_mandatory($params, 'CRM_Mailing_DAO_MailingAB', array('id', 'status'));
+ civicrm_api3_verify_mandatory($params, 'CRM_Mailing_DAO_MailingAB', ['id', 'status']);
if (!isset($params['scheduled_date']) && !isset($updateParams['approval_date'])) {
throw new API_Exception("Missing parameter scheduled_date and/or approval_date");
throw new API_Exception("Missing mailing IDs for A/B test");
}
- $submitParams = CRM_Utils_Array::subset($params, array(
+ $submitParams = CRM_Utils_Array::subset($params, [
'scheduled_date',
'approval_date',
'approval_note',
'approval_status_id',
- ));
+ ]);
switch ($params['status']) {
case 'Testing':
if (!empty($dao->status) && $dao->status != 'Draft') {
throw new API_Exception("Cannot transition to state 'Testing'");
}
- civicrm_api3('Mailing', 'submit', $submitParams + array(
+ civicrm_api3('Mailing', 'submit', $submitParams + [
'id' => $dao->mailing_id_a,
'_skip_evil_bao_auto_recipients_' => 0,
- ));
- civicrm_api3('Mailing', 'submit', $submitParams + array(
+ ]);
+ civicrm_api3('Mailing', 'submit', $submitParams + [
'id' => $dao->mailing_id_b,
'_skip_evil_bao_auto_recipients_' => 1,
- ));
+ ]);
CRM_Mailing_BAO_MailingAB::distributeRecipients($dao);
break;
if ($dao->status != 'Testing') {
throw new API_Exception("Cannot transition to state 'Final'");
}
- civicrm_api3('Mailing', 'submit', $submitParams + array(
+ civicrm_api3('Mailing', 'submit', $submitParams + [
'id' => $dao->mailing_id_c,
'_skip_evil_bao_auto_recipients_' => 1,
- ));
+ ]);
break;
default:
throw new API_Exception("Unrecognized submission status");
}
- return civicrm_api3('MailingAB', 'create', array(
+ return civicrm_api3('MailingAB', 'create', [
'id' => $dao->id,
'status' => $params['status'],
- 'options' => array(
+ 'options' => [
'reload' => 1,
- ),
- ));
+ ],
+ ]);
}
/**
* Array of parameters determined by getfields.
*/
function _civicrm_api3_mailing_a_b_graph_stats_spec(&$params) {
- $params['criteria'] = array(
+ $params['criteria'] = [
'title' => 'Criteria',
'default' => 'Open',
'type' => CRM_Utils_Type::T_STRING,
- );
+ ];
// mailing_ab_winner_criteria
$params['target_date']['title'] = 'Target Date';
$params['target_date']['type'] = CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME;
- $params['split_count'] = array(
+ $params['split_count'] = [
'title' => 'Split Count',
'api.default' => 6,
'type' => CRM_Utils_Type::T_INT,
- );
+ ];
$params['split_count_select']['title'] = 'Split Count Select';
$params['split_count_select']['api.required'] = 1;
$params['target_url']['title'] = 'Target URL';
function civicrm_api3_mailing_a_b_graph_stats($params) {
civicrm_api3_verify_mandatory($params,
'CRM_Mailing_DAO_MailingAB',
- array('id'),
+ ['id'],
FALSE
);
- $defaults = array(
+ $defaults = [
'criteria' => 'Open',
'target_date' => CRM_Utils_Time::getTime('YmdHis'),
'split_count' => 6,
'split_count_select' => 1,
- );
+ ];
$params = array_merge($defaults, $params);
- $mailingAB = civicrm_api3('MailingAB', 'getsingle', array('id' => $params['id']));
- $graphStats = array();
- $ABFormat = array('A' => 'mailing_id_a', 'B' => 'mailing_id_b');
+ $mailingAB = civicrm_api3('MailingAB', 'getsingle', ['id' => $params['id']]);
+ $graphStats = [];
+ $ABFormat = ['A' => 'mailing_id_a', 'B' => 'mailing_id_b'];
foreach ($ABFormat as $name => $column) {
switch (strtolower($params['criteria'])) {
$dateDuration = round(round(strtotime($targetDate) - strtotime($startDate)) / $params['split_count']);
$toDate = strtotime($startDate) + ($dateDuration * $params['split_count_select']);
$toDate = date('YmdHis', $toDate);
- $graphStats[$name] = array(
- $params['split_count_select'] => array(
+ $graphStats[$name] = [
+ $params['split_count_select'] => [
'count' => CRM_Mailing_Event_BAO_Opened::getTotalCount($mailingAB[$column], NULL, TRUE, $toDate),
'time' => CRM_Utils_Date::customFormat($toDate),
- ),
- );
+ ],
+ ];
break;
case 'total unique clicks':
$dateDuration = round(abs(strtotime($targetDate) - strtotime($startDate)) / $params['split_count']);
$toDate = strtotime($startDate) + ($dateDuration * $params['split_count_select']);
$toDate = date('YmdHis', $toDate);
- $graphStats[$name] = array(
- $params['split_count_select'] => array(
+ $graphStats[$name] = [
+ $params['split_count_select'] => [
'count' => CRM_Mailing_Event_BAO_TrackableURLOpen::getTotalCount($params['mailing_id'], NULL, FALSE, NULL, $toDate),
'time' => CRM_Utils_Date::customFormat($toDate),
- ),
- );
+ ],
+ ];
break;
case 'total clicks on a particular link':
$dateDuration = round(abs(strtotime($targetDate) - strtotime($startDate)) / $params['split_count']);
$toDate = strtotime($startDate) + ($dateDuration * $params['split_count_select']);
$toDate = CRM_Utils_Date::processDate($toDate);
- $graphStats[$name] = array(
- $params['split_count_select'] => array(
+ $graphStats[$name] = [
+ $params['split_count_select'] => [
'count' => CRM_Mailing_Event_BAO_TrackableURLOpen::getTotalCount($params['mailing_id'], NULL, FALSE, $url_id, $toDate),
'time' => CRM_Utils_Date::customFormat($toDate),
- ),
- );
+ ],
+ ];
break;
}
}
* Array of parameters determined by getfields.
*/
function _civicrm_api3_mailing_contact_get_spec(&$params) {
- $params['contact_id'] = array(
+ $params['contact_id'] = [
'api.required' => 1,
'title' => 'Contact ID',
'type' => CRM_Utils_Type::T_INT,
- );
+ ];
- $params['type'] = array(
+ $params['type'] = [
'api.default' => 'Delivered',
'title' => 'Type', // doesn't really explain the field - but not sure I understand it to explain it better
'type' => CRM_Utils_Type::T_STRING,
- 'options' => array(
+ 'options' => [
'Delivered' => 'Delivered',
'Bounced' => 'Bounced',
- ),
- );
+ ],
+ ];
}
/**
GROUP BY m.id
";
- $qParams = array(
- 1 => array($contactID, 'Integer'),
- );
+ $qParams = [
+ 1 => [$contactID, 'Integer'],
+ ];
$dao = CRM_Core_DAO::executeQuery($sql, $qParams);
$results = $dao->N;
}
else {
- $defaultFields = array(
+ $defaultFields = [
'm.id' => 'mailing_id',
'm.subject' => 'subject',
'c.id' => 'creator_id',
'c.sort_name' => 'creator_name',
- );
+ ];
if ($selectFields) {
$fields = array_merge($selectFields, $defaultFields);
$fields = $defaultFields;
}
- $select = array();
+ $select = [];
foreach ($fields as $n => $l) {
$select[] = "$n as $l";
}
";
}
- $qParams = array(
- 1 => array($contactID, 'Integer'),
- 2 => array($offset, 'Integer'),
- 3 => array($limit, 'Integer'),
- );
+ $qParams = [
+ 1 => [$contactID, 'Integer'],
+ 2 => [$offset, 'Integer'],
+ 3 => [$limit, 'Integer'],
+ ];
$dao = CRM_Core_DAO::executeQuery($sql, $qParams);
- $results = array();
+ $results = [];
while ($dao->fetch()) {
foreach ($fields as $n => $l) {
$results[$dao->mailing_id][$l] = $dao->$l;
$sort,
$getCount
) {
- $selectFields = array('med.time_stamp' => 'start_date');
+ $selectFields = ['med.time_stamp' => 'start_date'];
$fromClause = "
INNER JOIN civicrm_mailing_event_delivered med ON med.event_queue_id = meq.id
* Array of parameters determined by getfields.
*/
function _civicrm_api3_mailing_event_confirm_create_spec(&$params) {
- $params['contact_id'] = array(
+ $params['contact_id'] = [
'api.required' => 1,
'title' => 'Contact ID',
'type' => CRM_Utils_Type::T_INT,
- );
- $params['subscribe_id'] = array(
+ ];
+ $params['subscribe_id'] = [
'api.required' => 1,
'title' => 'Subscribe Event ID',
'type' => CRM_Utils_Type::T_INT,
- );
- $params['hash'] = array(
+ ];
+ $params['hash'] = [
'api.required' => 1,
'title' => 'Hash',
'type' => CRM_Utils_Type::T_STRING,
- );
+ ];
}
}
civicrm_api3_verify_mandatory($params,
'CRM_Mailing_DAO_MailingJob',
- array('job_id', 'contact_id'),
+ ['job_id', 'contact_id'],
FALSE
);
return _civicrm_api3_basic_create('CRM_Mailing_Event_BAO_Queue', $params, 'Queue');
* Array of parameters determined by getfields.
*/
function _civicrm_api3_mailing_event_resubscribe_create_spec(&$params) {
- $params['event_queue_id'] = array(
+ $params['event_queue_id'] = [
'api.required' => 1,
'title' => 'Event Queue ID',
'type' => CRM_Utils_Type::T_INT,
- );
- $params['job_id'] = array(
+ ];
+ $params['job_id'] = [
'api.required' => 1,
'title' => 'Job ID',
'type' => CRM_Utils_Type::T_INT,
- );
- $params['hash'] = array(
+ ];
+ $params['hash'] = [
'api.required' => 1,
'title' => 'Hash',
'type' => CRM_Utils_Type::T_STRING,
- );
+ ];
}
$subscribe->send_confirm_request($email);
- $values = array();
+ $values = [];
$values[$subscribe->id]['contact_id'] = $subscribe->contact_id;
$values[$subscribe->id]['subscribe_id'] = $subscribe->id;
$values[$subscribe->id]['hash'] = $subscribe->hash;
* Array of parameters determined by getfields.
*/
function _civicrm_api3_mailing_event_subscribe_create_spec(&$params) {
- $params['email'] = array(
+ $params['email'] = [
'api.required' => 1,
'title' => 'Unsubscribe Email',
'type' => CRM_Utils_Type::T_STRING,
- );
- $params['group_id'] = array(
+ ];
+ $params['group_id'] = [
'api.required' => 1,
'title' => 'Unsubscribe From Group',
'type' => CRM_Utils_Type::T_INT,
- );
+ ];
}
* Array of parameters determined by getfields.
*/
function _civicrm_api3_mailing_event_unsubscribe_create_spec(&$params) {
- $params['job_id'] = array(
+ $params['job_id'] = [
'api.required' => 1,
'title' => 'Mailing Job ID',
'type' => CRM_Utils_Type::T_INT,
- );
- $params['hash'] = array(
+ ];
+ $params['hash'] = [
'api.required' => 1,
'title' => 'Mailing Hash',
'type' => CRM_Utils_Type::T_STRING,
- );
- $params['event_queue_id'] = array(
+ ];
+ $params['event_queue_id'] = [
'api.required' => 1,
'title' => 'Mailing Queue ID',
'type' => CRM_Utils_Type::T_INT,
- );
+ ];
}
*/
function _civicrm_api3_mailing_group_deprecation() {
$message = 'This action is deprecated. Use the mailing_event API instead.';
- return array(
+ return [
'event_unsubscribe' => $message,
'event_domain_unsubscribe' => $message,
'event_resubscribe' => $message,
'event_subscribe' => $message,
- );
+ ];
}
/**
* Array of parameters determined by getfields.
*/
function _civicrm_api3_membership_delete_spec(&$params) {
- $params['preserve_contribution'] = array(
+ $params['preserve_contribution'] = [
'api.required' => 0,
'title' => 'Preserve Contribution',
'description' => 'By default this is 0, or 0 if not set. Set to 1 to preserve the associated contribution record when membership is deleted.',
'type' => CRM_Utils_Type::T_BOOLEAN,
- );
+ ];
}
/**
}
}
- $values = array();
+ $values = [];
_civicrm_api3_custom_format_params($params, $values, 'Membership');
$params = array_merge($params, $values);
$params['num_terms']
);
}
- foreach (array('join_date', 'start_date', 'end_date') as $date) {
+ foreach (['join_date', 'start_date', 'end_date'] as $date) {
if (empty($params[$date]) && isset($calcDates[$date])) {
$params[$date] = $calcDates[$date];
}
if (empty($params['id'])) {
$params['action'] = CRM_Core_Action::ADD;
// we need user id during add mode
- $ids = array();
+ $ids = [];
if (!empty($params['contact_id'])) {
$ids['userId'] = $params['contact_id'];
}
return civicrm_api3_create_error(ts('The membership can not be saved, no valid membership status for given dates'));
}
- $membership = array();
+ $membership = [];
_civicrm_api3_object_to_array($membershipBAO, $membership[$membershipBAO->id]);
return civicrm_api3_create_success($membership, $params, 'Membership', 'create', $membershipBAO);
$params['contact_id']['api.required'] = 1;
$params['membership_type_id']['api.required'] = 1;
$params['is_test']['api.default'] = 0;
- $params['membership_type_id']['api.aliases'] = array('membership_type');
- $params['status_id']['api.aliases'] = array('membership_status');
- $params['skipStatusCal'] = array(
+ $params['membership_type_id']['api.aliases'] = ['membership_type'];
+ $params['status_id']['api.aliases'] = ['membership_status'];
+ $params['skipStatusCal'] = [
'title' => 'Skip status calculation',
'description' => 'By default this is 0 if id is not set and 1 if it is set.',
'type' => CRM_Utils_Type::T_BOOLEAN,
- );
- $params['num_terms'] = array(
+ ];
+ $params['num_terms'] = [
'title' => 'Number of terms',
'description' => 'Terms to add/renew. If this parameter is passed, dates will be calculated automatically. If no id is passed (new membership) and no dates are given, num_terms will be assumed to be 1.',
'type' => CRM_Utils_Type::T_INT,
- );
+ ];
}
/**
* Array of parameters determined by getfields.
*/
function _civicrm_api3_membership_get_spec(&$params) {
- $params['membership_type_id']['api.aliases'] = array('membership_type');
- $params['active_only'] = array(
+ $params['membership_type_id']['api.aliases'] = ['membership_type'];
+ $params['active_only'] = [
'title' => 'Active Only',
'description' => 'Only retrieve active memberships',
'type' => CRM_Utils_Type::T_BOOLEAN,
- );
+ ];
}
/**
}
$activeOnly = CRM_Utils_Array::value('active_only', $params, $activeOnly);
if ($activeOnly && empty($params['status_id'])) {
- $params['status_id'] = array('IN' => CRM_Member_BAO_MembershipStatus::getMembershipStatusCurrent());
+ $params['status_id'] = ['IN' => CRM_Member_BAO_MembershipStatus::getMembershipStatusCurrent()];
}
$options = _civicrm_api3_get_options_from_params($params, TRUE, 'Membership', 'get');
*/
function _civicrm_api3_membership_get_customv2behaviour(&$params, $membershipTypeId, $activeOnly) {
// get the membership for the given contact ID
- $membershipParams = array('contact_id' => $params['contact_id']);
+ $membershipParams = ['contact_id' => $params['contact_id']];
if ($membershipTypeId) {
$membershipParams['membership_type_id'] = $membershipTypeId;
}
- $membershipValues = array();
+ $membershipValues = [];
CRM_Member_BAO_Membership::getValues($membershipParams, $membershipValues, $activeOnly);
return $membershipValues;
}
* result for calling function
*/
function _civicrm_api3_membership_relationsship_get_customv2behaviour(&$params, $membershipValues, $contactID) {
- $relationships = array();
+ $relationships = [];
foreach ($membershipValues as $membershipId => $values) {
// populate the membership type name for the membership type id
$membershipType = CRM_Member_BAO_MembershipType::getMembershipTypeDetails($values['membership_type_id']);
function _civicrm_api3_membership_payment_create_spec(&$params) {
$params['membership_id']['api.required'] = 1;
$params['contribution_id']['api.required'] = 1;
- $params['membership_type_id'] = array(
+ $params['membership_type_id'] = [
'title' => 'Membership type id',
'description' => 'The id of the membership type',
'type' => CRM_Utils_Type::T_INT,
- );
+ ];
}
/**
*/
function civicrm_api3_membership_status_update($params) {
- civicrm_api3_verify_mandatory($params, NULL, array('id'));
+ civicrm_api3_verify_mandatory($params, NULL, ['id']);
//don't allow duplicate names.
$name = CRM_Utils_Array::value('name', $params);
if ($name) {
}
$membershipStatusBAO->save();
}
- $membershipStatus = array();
+ $membershipStatus = [];
$cloneBAO = clone($membershipStatusBAO);
_civicrm_api3_object_to_array($cloneBAO, $membershipStatus);
$membershipStatus['is_error'] = 0;
WHERE id = %1
";
- $params = array(1 => array($membershipID, 'Integer'));
+ $params = [1 => [$membershipID, 'Integer']];
$dao = CRM_Core_DAO::executeQuery($query, $params);
if ($dao->fetch()) {
$membershipTypeID = empty($membershipParams['membership_type_id']) ? $dao->membership_type_id : $membershipParams['membership_type_id'];
*/
function civicrm_api3_membership_type_create($params) {
// Workaround for fields using nonstandard serialization
- foreach (array('relationship_type_id', 'relationship_direction') as $field) {
+ foreach (['relationship_type_id', 'relationship_direction'] as $field) {
if (isset($params[$field]) && is_array($params[$field])) {
$params[$field] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $params[$field]);
}
if (!empty($results['values']) && is_array($results['values'])) {
foreach ($results['values'] as &$item) {
// Workaround for fields using nonstandard serialization
- foreach (array('relationship_type_id', 'relationship_direction') as $field) {
+ foreach (['relationship_type_id', 'relationship_direction'] as $field) {
if (isset($item[$field]) && !is_array($item[$field])) {
$item[$field] = (array) $item[$field];
}
*/
function civicrm_api3_message_template_send($params) {
// Change external param names to internal ones
- $fieldSpec = array();
+ $fieldSpec = [];
_civicrm_api3_message_template_send_spec($fieldSpec);
foreach ($fieldSpec as $field => $spec) {
throw new API_Exception(
"Mandatory key(s) missing from params array: requires id or option_group_name + option_value_name",
"mandatory_missing",
- array("fields" => array('id', 'option_group_name', 'option_value_name'))
+ ["fields" => ['id', 'option_group_name', 'option_value_name']]
);
}
}
function _civicrm_api3_message_template_send_spec(&$params) {
$params['id']['description'] = 'ID of the template';
$params['id']['title'] = 'Message Template ID';
- $params['id']['api.aliases'] = array('messageTemplateID', 'message_template_id');
+ $params['id']['api.aliases'] = ['messageTemplateID', 'message_template_id'];
$params['id']['type'] = CRM_Utils_Type::T_INT;
$params['option_group_name']['description'] = 'option group name of the template (required if no id supplied)';
$params['option_group_name']['title'] = 'Option Group Name';
- $params['option_group_name']['api.aliases'] = array('groupName');
+ $params['option_group_name']['api.aliases'] = ['groupName'];
$params['option_group_name']['type'] = CRM_Utils_Type::T_STRING;
$params['option_value_name']['description'] = 'option value name of the template (required if no id supplied)';
$params['option_value_name']['title'] = 'Option Value Name';
- $params['option_value_name']['api.aliases'] = array('valueName');
+ $params['option_value_name']['api.aliases'] = ['valueName'];
$params['option_value_name']['type'] = CRM_Utils_Type::T_STRING;
$params['contact_id']['description'] = 'contact id if contact tokens are to be replaced';
$params['contact_id']['title'] = 'Contact ID';
- $params['contact_id']['api.aliases'] = array('contactId');
+ $params['contact_id']['api.aliases'] = ['contactId'];
$params['contact_id']['type'] = CRM_Utils_Type::T_INT;
$params['template_params']['description'] = 'additional template params (other than the ones already set in the template singleton)';
$params['template_params']['title'] = 'Template Params';
- $params['template_params']['api.aliases'] = array('tplParams');
+ $params['template_params']['api.aliases'] = ['tplParams'];
// FIXME: Type??
$params['from']['description'] = 'the From: header';
$params['to_name']['description'] = 'the recipient’s name';
$params['to_name']['title'] = 'Recipient Name';
- $params['to_name']['api.aliases'] = array('toName');
+ $params['to_name']['api.aliases'] = ['toName'];
$params['to_name']['type'] = CRM_Utils_Type::T_STRING;
$params['to_email']['description'] = 'the recipient’s email - mail is sent only if set';
$params['to_email']['title'] = 'Recipient Email';
- $params['to_email']['api.aliases'] = array('toEmail');
+ $params['to_email']['api.aliases'] = ['toEmail'];
$params['to_email']['type'] = CRM_Utils_Type::T_STRING;
$params['cc']['description'] = 'the Cc: header';
$params['reply_to']['description'] = 'the Reply-To: header';
$params['reply_to']['title'] = 'Reply To';
- $params['reply_to']['api.aliases'] = array('replyTo');
+ $params['reply_to']['api.aliases'] = ['replyTo'];
$params['reply_to']['type'] = CRM_Utils_Type::T_STRING;
$params['attachments']['description'] = 'email attachments';
$params['is_test']['description'] = 'whether this is a test email (and hence should include the test banner)';
$params['is_test']['title'] = 'Is Test';
- $params['is_test']['api.aliases'] = array('isTest');
+ $params['is_test']['api.aliases'] = ['isTest'];
$params['is_test']['type'] = CRM_Utils_Type::T_BOOLEAN;
$params['pdf_filename']['description'] = 'filename of optional PDF version to add as attachment (do not include path)';
$params['pdf_filename']['title'] = 'PDF Filename';
- $params['pdf_filename']['api.aliases'] = array('PDFFilename');
+ $params['pdf_filename']['api.aliases'] = ['PDFFilename'];
$params['pdf_filename']['type'] = CRM_Utils_Type::T_STRING;
}
$params['for']['api.required'] = TRUE;
$params['for']['title'] = "Is this reset for all navigation or reports";
$params['for']['type'] = CRM_Utils_Type::T_STRING;
- $params['for']['options'] = array(
+ $params['for']['options'] = [
'all' => 'General Navigation rebuild from xml',
'report' => 'Reset report menu to default structure',
- );
+ ];
$params['domain_id']['api.default'] = CRM_Core_Config::domainID();
$params['domain_id']['type'] = CRM_Utils_Type::T_INT;
$params['domain_id']['title'] = 'Domain ID';
* API result array.
*/
function civicrm_api3_navigation_create($params) {
- civicrm_api3_verify_one_mandatory($params, NULL, array('name', 'label'));
+ civicrm_api3_verify_one_mandatory($params, NULL, ['name', 'label']);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Navigation');
}
* Nested associative array beginning with direct children of given note.
*/
function civicrm_api3_note_tree_get($params) {
- civicrm_api3_verify_mandatory($params, NULL, array('id'));
+ civicrm_api3_verify_mandatory($params, NULL, ['id']);
if (!is_numeric($params['id'])) {
return civicrm_api3_create_error(ts("Invalid note ID"));
*/
function civicrm_api3_option_group_create($params) {
$result = _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'OptionGroup');
- civicrm_api('option_value', 'getfields', array('version' => 3, 'cache_clear' => 1));
+ civicrm_api('option_value', 'getfields', ['version' => 3, 'cache_clear' => 1]);
return $result;
}
* Array of parameters determined by getfields.
*/
function _civicrm_api3_option_value_get_spec(&$params) {
- $params['option_group_id']['api.aliases'] = array('option_group_name');
+ $params['option_group_id']['api.aliases'] = ['option_group_name'];
}
/**
$groupId = $params['option_group_id'];
}
- civicrm_api('option_value', 'getfields', array('version' => 3, 'cache_clear' => 1, 'option_group_id' => $groupId));
+ civicrm_api('option_value', 'getfields', ['version' => 3, 'cache_clear' => 1, 'option_group_id' => $groupId]);
return $result;
}
function _civicrm_api3_option_value_create_spec(&$params) {
$params['is_active']['api.default'] = 1;
//continue to support component
- $params['component_id']['api.aliases'] = array('component');
+ $params['component_id']['api.aliases'] = ['component'];
// $params['name']['api.aliases'] = array('label');
$params['option_group_id']['api.required'] = TRUE;
}
*/
function civicrm_api3_option_value_delete($params) {
// We will get the option group id before deleting so we can flush pseudoconstants.
- $optionGroupID = civicrm_api('option_value', 'getvalue', array('version' => 3, 'id' => $params['id'], 'return' => 'option_group_id'));
+ $optionGroupID = civicrm_api('option_value', 'getvalue', ['version' => 3, 'id' => $params['id'], 'return' => 'option_group_id']);
$result = CRM_Core_BAO_OptionValue::del($params['id']);
if ($result) {
- civicrm_api('option_value', 'getfields', array('version' => 3, 'cache_clear' => 1, 'option_group_id' => $optionGroupID));
+ civicrm_api('option_value', 'getfields', ['version' => 3, 'cache_clear' => 1, 'option_group_id' => $optionGroupID]);
return civicrm_api3_create_success();
}
else {
* Array of Order, if error an array with an error id and error message
*/
function civicrm_api3_order_get($params) {
- $contributions = array();
- $params['api.line_item.get'] = array('qty' => array('<>' => 0));
+ $contributions = [];
+ $params['api.line_item.get'] = ['qty' => ['<>' => 0]];
$isSequential = FALSE;
if (CRM_Utils_Array::value('sequential', $params)) {
$params['sequential'] = 0;
function civicrm_api3_order_create(&$params) {
$entity = NULL;
- $entityIds = array();
+ $entityIds = [];
if (CRM_Utils_Array::value('line_items', $params) && is_array($params['line_items'])) {
$priceSetID = NULL;
CRM_Contribute_BAO_Contribution::checkLineItems($params);
foreach ($params['line_items'] as $lineItems) {
- $entityParams = CRM_Utils_Array::value('params', $lineItems, array());
+ $entityParams = CRM_Utils_Array::value('params', $lineItems, []);
if (!empty($entityParams) && !empty($lineItems['line_item'])) {
$item = reset($lineItems['line_item']);
$entity = str_replace('civicrm_', '', $item['entity_table']);
}
if ($entityParams) {
- if (in_array($entity, array('participant', 'membership'))) {
+ if (in_array($entity, ['participant', 'membership'])) {
$entityParams['skipLineItem'] = TRUE;
$entityResult = civicrm_api3($entity, 'create', $entityParams);
$params['contribution_mode'] = $entity;
}
if (empty($priceSetID)) {
$item = reset($lineItems['line_item']);
- $priceSetID = civicrm_api3('PriceField', 'getvalue', array(
+ $priceSetID = civicrm_api3('PriceField', 'getvalue', [
'return' => 'price_set_id',
'id' => $item['price_field_id'],
- ));
- $params['line_item'][$priceSetID] = array();
+ ]);
+ $params['line_item'][$priceSetID] = [];
}
$params['line_item'][$priceSetID] = array_merge($params['line_item'][$priceSetID], $lineItems['line_item']);
}
// add payments
if ($entity && CRM_Utils_Array::value('id', $contribution)) {
foreach ($entityIds as $entityId) {
- $paymentParams = array(
+ $paymentParams = [
'contribution_id' => $contribution['id'],
$entity . '_id' => $entityId,
- );
+ ];
// if entity is pledge then build pledge param
if ($entity == 'pledge') {
$paymentParams += $entityParams;
* @throws CiviCRM_API3_Exception
*/
function civicrm_api3_order_delete($params) {
- $contribution = civicrm_api3('Contribution', 'get', array(
- 'return' => array('is_test'),
+ $contribution = civicrm_api3('Contribution', 'get', [
+ 'return' => ['is_test'],
'id' => $params['id'],
- ));
+ ]);
if ($contribution['id'] && $contribution['values'][$contribution['id']]['is_test'] == TRUE) {
$result = civicrm_api3('Contribution', 'delete', $params);
}
* Array of parameters determined by getfields.
*/
function _civicrm_api3_order_cancel_spec(&$params) {
- $params['contribution_id'] = array(
+ $params['contribution_id'] = [
'api.required' => 1 ,
'title' => 'Contribution ID',
'type' => CRM_Utils_Type::T_INT,
- );
+ ];
}
/**
* Array of parameters determined by getfields.
*/
function _civicrm_api3_order_create_spec(&$params) {
- $params['contact_id'] = array(
+ $params['contact_id'] = [
'name' => 'contact_id',
'title' => 'Contact ID',
'type' => CRM_Utils_Type::T_INT,
'api.required' => TRUE,
- );
- $params['total_amount'] = array(
+ ];
+ $params['total_amount'] = [
'name' => 'total_amount',
'title' => 'Total Amount',
'api.required' => TRUE,
- );
+ ];
$params['financial_type_id'] = [
'name' => 'financial_type_id',
'title' => 'Financial Type',
* Array of parameters determined by getfields.
*/
function _civicrm_api3_order_delete_spec(&$params) {
- $params['contribution_id'] = array(
+ $params['contribution_id'] = [
'api.required' => TRUE,
'title' => 'Contribution ID',
'type' => CRM_Utils_Type::T_INT,
- );
- $params['id']['api.aliases'] = array('contribution_id');
+ ];
+ $params['id']['api.aliases'] = ['contribution_id'];
}
}
}
- $values = $participant = array();
+ $values = $participant = [];
_civicrm_api3_custom_format_params($params, $values, 'Participant');
$params = array_merge($values, $params);
where ps.id is not null and pfv.label = %2
";
- $qParams = array(
- 1 => array($params['event_id'], 'Integer'),
- 2 => array($label, 'String'),
- );
+ $qParams = [
+ 1 => [$params['event_id'], 'Integer'],
+ 2 => [$label, 'String'],
+ ];
$dao = CRM_Core_DAO::executeQuery($sql, $qParams);
if ($dao->fetch()) {
- $lineItemParams = array(
+ $lineItemParams = [
'price_field_id' => $dao->priceFieldID,
'price_field_value_id' => $dao->priceFieldValueID,
'entity_table' => 'civicrm_participant',
'participant_count' => 0,
'unit_price' => $dao->amount,
'line_total' => $qty * $dao->amount,
- );
+ ];
civicrm_api3('line_item', 'create', $lineItemParams);
}
$params['event_id']['api.required'] = 1;
$params['contact_id']['api.required'] = 1;
// These are for the sake of search builder options - can be removed if that is fixed
- $params['role_id']['api.aliases'] = array('participant_role');
- $params['status_id']['api.aliases'] = array('participant_status');
+ $params['role_id']['api.aliases'] = ['participant_role'];
+ $params['status_id']['api.aliases'] = ['participant_status'];
}
/**
list($dao, $query) = _civicrm_api3_get_query_object($params, $mode, 'Participant');
- $participant = array();
+ $participant = [];
while ($dao->fetch()) {
$query->convertToPseudoNames($dao, FALSE, TRUE);
$participant[$dao->participant_id] = $query->store($dao);
* Array of parameters determined by getfields.
*/
function _civicrm_api3_participant_get_spec(&$params) {
- $params['participant_test'] = array(
+ $params['participant_test'] = [
'api.default' => 0,
'title' => 'Get Test Participants',
'type' => CRM_Utils_Type::T_BOOLEAN,
- );
+ ];
}
/**
* Array of financial transactions which are payments, if error an array with an error id and error message
*/
function civicrm_api3_payment_get($params) {
- $financialTrxn = array();
+ $financialTrxn = [];
$limit = '';
if (isset($params['options']) && CRM_Utils_Array::value('limit', $params['options'])) {
$limit = CRM_Utils_Array::value('limit', $params['options']);
$params['options']['limit'] = 0;
$eft = civicrm_api3('EntityFinancialTrxn', 'get', $params);
if (!empty($eft['values'])) {
- $eftIds = array();
+ $eftIds = [];
foreach ($eft['values'] as $efts) {
if (empty($efts['financial_trxn_id'])) {
continue;
$map[$efts['financial_trxn_id']] = $efts['entity_id'];
}
if (!empty($eftIds)) {
- $ftParams = array(
- 'id' => array('IN' => $eftIds),
+ $ftParams = [
+ 'id' => ['IN' => $eftIds],
'is_payment' => 1,
- );
+ ];
if ($limit) {
$ftParams['options']['limit'] = $limit;
}
}
}
}
- return civicrm_api3_create_success(CRM_Utils_Array::value('values', $financialTrxn, array()), $params, 'Payment', 'get');
+ return civicrm_api3_create_success(CRM_Utils_Array::value('values', $financialTrxn, []), $params, 'Payment', 'get');
}
/**
* Api result array
*/
function civicrm_api3_payment_cancel(&$params) {
- $eftParams = array(
+ $eftParams = [
'entity_table' => 'civicrm_contribution',
'financial_trxn_id' => $params['id'],
- );
+ ];
$entity = civicrm_api3('EntityFinancialTrxn', 'getsingle', $eftParams);
$contributionId = $entity['entity_id'];
$params['total_amount'] = $entity['amount'];
$trxn = CRM_Contribute_BAO_Contribution::recordAdditionalPayment($contributionId, $params, 'refund', NULL, FALSE);
- $values = array();
+ $values = [];
_civicrm_api3_object_to_array_unique_fields($trxn, $values[$trxn->id]);
return civicrm_api3_create_success($values, $params, 'Payment', 'cancel', $trxn);
}
}
$trxn = CRM_Financial_BAO_Payment::create($params);
- $values = array();
+ $values = [];
_civicrm_api3_object_to_array_unique_fields($trxn, $values[$trxn->id]);
return civicrm_api3_create_success($values, $params, 'Payment', 'create', $trxn);
}
* Array of parameters.
*/
function _civicrm_api3_payment_create_spec(&$params) {
- $params = array(
- 'contribution_id' => array(
+ $params = [
+ 'contribution_id' => [
'api.required' => 1 ,
'title' => 'Contribution ID',
'type' => CRM_Utils_Type::T_INT,
- ),
- 'total_amount' => array(
+ ],
+ 'total_amount' => [
'api.required' => 1 ,
'title' => 'Total Payment Amount',
'type' => CRM_Utils_Type::T_FLOAT,
- ),
- 'payment_processor_id' => array(
+ ],
+ 'payment_processor_id' => [
'title' => 'Payment Processor ID',
'type' => CRM_Utils_Type::T_INT,
'description' => ts('Payment processor ID - required for payment processor payments'),
- ),
- 'id' => array(
+ ],
+ 'id' => [
'title' => 'Payment ID',
'type' => CRM_Utils_Type::T_INT,
- 'api.aliases' => array('payment_id'),
- ),
- );
+ 'api.aliases' => ['payment_id'],
+ ],
+ ];
}
/**
* Array of parameters determined by getfields.
*/
function _civicrm_api3_payment_get_spec(&$params) {
- $params = array(
- 'contribution_id' => array(
+ $params = [
+ 'contribution_id' => [
'title' => 'Contribution ID',
'type' => CRM_Utils_Type::T_INT,
- ),
- 'entity_table' => array(
+ ],
+ 'entity_table' => [
'title' => 'Entity Table',
'api.default' => 'civicrm_contribution',
- ),
- 'entity_id' => array(
+ ],
+ 'entity_id' => [
'title' => 'Entity ID',
'type' => CRM_Utils_Type::T_INT,
- 'api.aliases' => array('contribution_id'),
- ),
- );
+ 'api.aliases' => ['contribution_id'],
+ ],
+ ];
}
/**
* Array of parameters.
*/
function _civicrm_api3_payment_delete_spec(&$params) {
- $params = array(
- 'id' => array(
+ $params = [
+ 'id' => [
'api.required' => 1 ,
'title' => 'Payment ID',
'type' => CRM_Utils_Type::T_INT,
- 'api.aliases' => array('payment_id'),
- ),
- );
+ 'api.aliases' => ['payment_id'],
+ ],
+ ];
}
/**
* Array of parameters.
*/
function _civicrm_api3_payment_cancel_spec(&$params) {
- $params = array(
- 'id' => array(
+ $params = [
+ 'id' => [
'api.required' => 1 ,
'title' => 'Payment ID',
'type' => CRM_Utils_Type::T_INT,
- 'api.aliases' => array('payment_id'),
- ),
- );
+ 'api.aliases' => ['payment_id'],
+ ],
+ ];
}
/**
* Array of parameters determined by getfields.
*/
function _civicrm_api3_payment_sendconfirmation_spec(&$params) {
- $params['id'] = array(
+ $params['id'] = [
'api.required' => 1,
'title' => ts('Payment ID'),
'type' => CRM_Utils_Type::T_INT,
- );
+ ];
}
*/
function civicrm_api3_payment_processor_create($params) {
if (empty($params['id']) && empty($params['payment_instrument_id'])) {
- $params['payment_instrument_id'] = civicrm_api3('PaymentProcessorType', 'getvalue', array(
+ $params['payment_instrument_id'] = civicrm_api3('PaymentProcessorType', 'getvalue', [
'id' => $params['payment_processor_type_id'],
'return' => 'payment_instrument_id',
- ));
+ ]);
}
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'PaymentProcessor');
}
* @return array
*/
function _civicrm_api3_payment_processor_getlist_defaults(&$request) {
- return array(
- 'description_field' => array(
+ return [
+ 'description_field' => [
'payment_processor_type_id',
'description',
- ),
- 'params' => array(
+ ],
+ 'params' => [
'is_test' => 0,
'is_active' => 1,
- ),
- );
+ ],
+ ];
}
*/
function civicrm_api3_pledge_delete($params) {
if (CRM_Pledge_BAO_Pledge::deletePledge($params['id'])) {
- return civicrm_api3_create_success(array(
+ return civicrm_api3_create_success([
'id' => $params['id'],
- ), $params, 'Pledge', 'delete');
+ ], $params, 'Pledge', 'delete');
}
else {
return civicrm_api3_create_error('Could not delete pledge');
*/
function _civicrm_api3_pledge_delete_spec(&$params) {
// set as not required as pledge_id also acceptable & no either/or std yet
- $params['id']['api.aliases'] = array('pledge_id');
+ $params['id']['api.aliases'] = ['pledge_id'];
}
/**
* @param array $params
*/
function _civicrm_api3_pledge_get_spec(&$params) {
- $params['next_pay_date'] = array(
+ $params['next_pay_date'] = [
'name' => 'next_pay_date',
'type' => 12,
'title' => 'Pledge Made',
'api.filter' => 0,
'api.return' => 1,
- );
+ ];
$params['pledge_is_test']['api.default'] = 0;
- $params['pledge_financial_type_id']['api.aliases'] = array('contribution_type_id', 'contribution_type');
+ $params['pledge_financial_type_id']['api.aliases'] = ['contribution_type_id', 'contribution_type'];
}
*/
function _civicrm_api3_pledge_create_spec(&$params) {
- $required = array('contact_id', 'amount', 'installments', 'start_date', 'financial_type_id');
+ $required = ['contact_id', 'amount', 'installments', 'start_date', 'financial_type_id'];
foreach ($required as $required_field) {
$params[$required_field]['api.required'] = 1;
}
// @todo this can come from xml
- $params['amount']['api.aliases'] = array('pledge_amount');
- $params['financial_type_id']['api.aliases'] = array('contribution_type_id', 'contribution_type');
+ $params['amount']['api.aliases'] = ['pledge_amount'];
+ $params['financial_type_id']['api.aliases'] = ['contribution_type_id', 'contribution_type'];
}
/**
list($dao, $query) = _civicrm_api3_get_query_object($params, $mode, 'Pledge');
- $pledge = array();
+ $pledge = [];
while ($dao->fetch()) {
$pledge[$dao->pledge_id] = $query->store($dao);
}
* Set default to not return test params.
*/
function _civicrm_api3_pledge_get_defaults() {
- return array('pledge_test' => 0);
+ return ['pledge_test' => 0];
}
/**
}
$dao = CRM_Pledge_BAO_PledgePayment::add($paymentParams);
- $result = array();
+ $result = [];
if (empty($dao->pledge_id)) {
$dao->find(TRUE);
}
function civicrm_api3_pledge_payment_delete($params) {
if (CRM_Pledge_BAO_PledgePayment::del($params['id'])) {
- return civicrm_api3_create_success(array('id' => $params['id']), $params, 'PledgePayment', 'delete');
+ return civicrm_api3_create_success(['id' => $params['id']], $params, 'PledgePayment', 'delete');
}
else {
return civicrm_api3_create_error('Could not delete payment');
* Modifiable list of fields allowed for the PledgePayment.get action.
*/
function civicrm_api3_pledge_payment_get_spec(&$params) {
- $params['option.create_new'] = array(
+ $params['option.create_new'] = [
'title' => "Create New",
'description' => "Create new field rather than update an unpaid payment",
'type' => CRM_Utils_Type::T_BOOLEAN,
- );
+ ];
}
* @param array $params
*/
function _civicrm_api3_premium_get_spec(&$params) {
- $params['premiums_active']['api.aliases'] = array('is_active');
+ $params['premiums_active']['api.aliases'] = ['is_active'];
}
/**
* @param array $params
*/
function _civicrm_api3_premium_create_spec(&$params) {
- $params['premiums_active']['api.aliases'] = array('is_active');
+ $params['premiums_active']['api.aliases'] = ['is_active'];
}
* API result array.
*/
function civicrm_api3_price_field_value_create($params) {
- $ids = array();
+ $ids = [];
if (!empty($params['id'])) {
$ids['id'] = $params['id'];
}
$bao = CRM_Price_BAO_PriceFieldValue::create($params, $ids);
- $values = array();
+ $values = [];
_civicrm_api3_object_to_array($bao, $values[$bao->id]);
return civicrm_api3_create_success($values, $params, 'PriceFieldValue', 'create', $bao);
*/
function civicrm_api3_profile_get($params) {
$nonStandardLegacyBehaviour = is_numeric($params['profile_id']) ? TRUE : FALSE;
- if (!empty($params['check_permissions']) && !empty($params['contact_id']) && !1 === civicrm_api3('contact', 'getcount', array('contact_id' => $params['contact_id'], 'check_permissions' => 1))) {
+ if (!empty($params['check_permissions']) && !empty($params['contact_id']) && !1 === civicrm_api3('contact', 'getcount', ['contact_id' => $params['contact_id'], 'check_permissions' => 1])) {
throw new API_Exception('permission denied');
}
$profiles = (array) $params['profile_id'];
- $values = array();
+ $values = [];
$ufGroupBAO = new CRM_Core_BAO_UFGroup();
foreach ($profiles as $profileID) {
$profileID = _civicrm_api3_profile_getProfileID($profileID);
- $values[$profileID] = array();
+ $values[$profileID] = [];
if (strtolower($profileID) == 'billing') {
$values[$profileID] = _civicrm_api3_profile_getbillingpseudoprofile($params);
continue;
);
if ($isContactActivityProfile) {
- civicrm_api3_verify_mandatory($params, NULL, array('activity_id'));
+ civicrm_api3_verify_mandatory($params, NULL, ['activity_id']);
$errors = CRM_Profile_Form::validateContactActivityProfile($params['activity_id'],
$params['contact_id'],
throw new API_Exception(array_pop($errors));
}
- $contactFields = $activityFields = array();
+ $contactFields = $activityFields = [];
foreach ($profileFields as $fieldName => $field) {
if (CRM_Utils_Array::value('field_type', $field) == 'Activity') {
$activityFields[$fieldName] = $field;
throw new API_Exception('Update profiles including more than one entity not currently supported');
}
- $contactParams = $activityParams = $missingParams = array();
+ $contactParams = $activityParams = $missingParams = [];
- $profileFields = civicrm_api3('Profile', 'getfields', array('action' => 'submit', 'profile_id' => $profileID));
+ $profileFields = civicrm_api3('Profile', 'getfields', ['action' => 'submit', 'profile_id' => $profileID]);
$profileFields = $profileFields['values'];
if ($isContactActivityProfile) {
- civicrm_api3_verify_mandatory($params, NULL, array('activity_id'));
+ civicrm_api3_verify_mandatory($params, NULL, ['activity_id']);
$errors = CRM_Profile_Form::validateContactActivityProfile($params['activity_id'],
$params['contact_id'],
if ($params[$fieldName] && isset($params[$fieldName . '_id'])) {
$value = $params[$fieldName . '_id'];
}
- $contactEntities = array('contact', 'individual', 'organization', 'household');
- $locationEntities = array('email', 'address', 'phone', 'website', 'im');
+ $contactEntities = ['contact', 'individual', 'organization', 'household'];
+ $locationEntities = ['email', 'address', 'phone', 'website', 'im'];
$entity = strtolower(CRM_Utils_Array::value('entity', $field));
if ($entity && !in_array($entity, array_merge($contactEntities, $locationEntities))) {
}
}
if (isset($contactParams['api.contribution.create']) && isset($contactParams['api.membership.create'])) {
- $contactParams['api.membership_payment.create'] = array(
+ $contactParams['api.membership_payment.create'] = [
'contribution_id' => '$value.api.contribution.create.id',
'membership_id' => '$value.api.membership.create.id',
- );
+ ];
}
if (isset($contactParams['api.contribution.create']) && isset($contactParams['api.participant.create'])) {
- $contactParams['api.participant_payment.create'] = array(
+ $contactParams['api.participant_payment.create'] = [
'contribution_id' => '$value.api.contribution.create.id',
'participant_id' => '$value.api.participant.create.id',
- );
+ ];
}
$contactParams['contact_id'] = empty($params['contact_id']) ? CRM_Utils_Array::value('id', $params) : $params['contact_id'];
if (empty($params['contact_id'])) {
$config = CRM_Core_Config::singleton();
- $blanks = array(
+ $blanks = [
'billing_first_name' => '',
'billing_middle_name' => '',
'billing_last_name' => '',
'billing_street_address-' . $locationTypeID => '',
'billing_country_id-' . $locationTypeID => $config->defaultContactCountry,
'billing_state_province_id-' . $locationTypeID => $config->defaultContactStateProvince,
- );
+ ];
return $blanks;
}
- $addressFields = array('street_address', 'city', 'state_province_id', 'country_id', 'postal_code');
- $result = civicrm_api3('contact', 'getsingle', array(
+ $addressFields = ['street_address', 'city', 'state_province_id', 'country_id', 'postal_code'];
+ $result = civicrm_api3('contact', 'getsingle', [
'id' => $params['contact_id'],
- 'api.address.get.1' => array('location_type_id' => 'Billing', 'return' => $addressFields),
+ 'api.address.get.1' => ['location_type_id' => 'Billing', 'return' => $addressFields],
// getting the is_billing required or not is an extra db call but probably cheap enough as this isn't an import api
- 'api.address.get.2' => array('is_billing' => TRUE, 'return' => $addressFields),
- 'api.email.get.1' => array('location_type_id' => 'Billing'),
- 'api.email.get.2' => array('is_billing' => TRUE),
+ 'api.address.get.2' => ['is_billing' => TRUE, 'return' => $addressFields],
+ 'api.email.get.1' => ['location_type_id' => 'Billing'],
+ 'api.email.get.2' => ['is_billing' => TRUE],
'return' => 'api.email.get, api.address.get, api.address.getoptions, country, state_province, email, first_name, last_name, middle_name, ' . implode($addressFields, ','),
- )
+ ]
);
- $values = array(
+ $values = [
'billing_first_name' => $result['first_name'],
'billing_middle_name' => $result['middle_name'],
'billing_last_name' => $result['last_name'],
- );
+ ];
if (!empty($result['api.address.get.1']['count'])) {
foreach ($addressFields as $fieldname) {
* @return array|void
*/
function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour = 1, $is_flush) {
- static $profileFields = array();
+ static $profileFields = [];
if ($is_flush) {
- $profileFields = array();
+ $profileFields = [];
if (empty($profileID)) {
return NULL;
}
if (isset($profileFields[$profileID])) {
return $profileFields[$profileID];
}
- $fields = civicrm_api3('uf_field', 'get', array('uf_group_id' => $profileID));
- $entities = array();
+ $fields = civicrm_api3('uf_field', 'get', ['uf_group_id' => $profileID]);
+ $entities = [];
foreach ($fields['values'] as $field) {
if (!$field['is_active']) {
continue;
}
list($entity, $fieldName) = _civicrm_api3_map_profile_fields_to_entity($field);
- $aliasArray = array();
+ $aliasArray = [];
if (strtolower($fieldName) != $fieldName) {
- $aliasArray['api.aliases'] = array($fieldName);
+ $aliasArray['api.aliases'] = [$fieldName];
$fieldName = strtolower($fieldName);
}
- $profileFields[$profileID][$fieldName] = array_merge(array(
+ $profileFields[$profileID][$fieldName] = array_merge([
'api.required' => $field['is_required'],
'title' => $field['label'],
'help_pre' => CRM_Utils_Array::value('help_pre', $field),
'help_post' => CRM_Utils_Array::value('help_post', $field),
'entity' => $entity,
'weight' => CRM_Utils_Array::value('weight', $field),
- ), $aliasArray);
+ ], $aliasArray);
$ufFieldTaleFieldName = $field['field_name'];
if (isset($entity[$ufFieldTaleFieldName]['name'])) {
//see function notes
// as we build up a list of these we should be able to determine a generic approach
//
- $hardCodedEntityFields = array(
+ $hardCodedEntityFields = [
'state_province' => 'state_province_id',
'country' => 'country_id',
'participant_status' => 'status_id',
'group' => 'group_id',
'tag' => 'tag_id',
'soft_credit_type' => 'soft_credit_type_id',
- );
+ ];
if (array_key_exists($ufFieldTaleFieldName, $hardCodedEntityFields)) {
$ufFieldTaleFieldName = $hardCodedEntityFields[$ufFieldTaleFieldName];
}
foreach ($entities as $entity => $entityFields) {
- $result = civicrm_api3($entity, 'getfields', array('action' => 'create'));
+ $result = civicrm_api3($entity, 'getfields', ['action' => 'create']);
$entityGetFieldsResult = _civicrm_api3_profile_appendaliases($result['values'], $entity);
foreach ($entityFields as $entityfield => $realName) {
$fieldName = strtolower($entityfield);
}
$profileFields[$profileID][$fieldName] = array_merge($entityGetFieldsResult[$realName], $profileFields[$profileID][$entityfield]);
if (!isset($profileFields[$profileID][$fieldName]['api.aliases'])) {
- $profileFields[$profileID][$fieldName]['api.aliases'] = array();
+ $profileFields[$profileID][$fieldName]['api.aliases'] = [];
}
if ($optionsBehaviour && !empty($entityGetFieldsResult[$realName]['pseudoconstant'])) {
- if ($optionsBehaviour > 1 || !in_array($realName, array('state_province_id', 'county_id', 'country_id'))) {
- $options = civicrm_api3($entity, 'getoptions', array('field' => $realName));
+ if ($optionsBehaviour > 1 || !in_array($realName, ['state_province_id', 'county_id', 'country_id'])) {
+ $options = civicrm_api3($entity, 'getoptions', ['field' => $realName]);
$profileFields[$profileID][$fieldName]['options'] = $options['values'];
}
}
*/
function _civicrm_api3_map_profile_fields_to_entity(&$field) {
$entity = $field['field_type'];
- $contactTypes = civicrm_api3('contact', 'getoptions', array('field' => 'contact_type'));
+ $contactTypes = civicrm_api3('contact', 'getoptions', ['field' => 'contact_type']);
if (in_array($entity, $contactTypes['values'])) {
$entity = 'contact';
}
$entity = _civicrm_api_get_entity_name_from_camel($entity);
- $locationFields = array('email' => 'email');
+ $locationFields = ['email' => 'email'];
$fieldName = $field['field_name'];
if (!empty($field['location_type_id'])) {
if ($fieldName == 'email') {
// not a great solution but probably if we looked in the BAO we'd find a scary switch statement
// in a perfect world the uf_field table would hold the correct entity for each item
// & only the relationships between entities would need to be coded
- $hardCodedEntityMappings = array(
+ $hardCodedEntityMappings = [
'street_address' => 'address',
'street_number' => 'address',
'supplemental_address_1' => 'address',
'group' => 'group_contact',
'tag' => 'entity_tag',
'note' => 'note',
- );
+ ];
if (array_key_exists($fieldName, $hardCodedEntityMappings)) {
$entity = $hardCodedEntityMappings[$fieldName];
}
- return array($entity, $fieldName);
+ return [$entity, $fieldName];
}
/**
*/
function _civicrm_api3_profile_getProfileID($profileID) {
if (!empty($profileID) && strtolower($profileID) != 'billing' && !is_numeric($profileID)) {
- $profileID = civicrm_api3('uf_group', 'getvalue', array('return' => 'id', 'name' => $profileID));
+ $profileID = civicrm_api3('uf_group', 'getvalue', ['return' => 'id', 'name' => $profileID]);
}
return $profileID;
}
}
}
//special case on membership & contribution - can't see how to handle in a generic way
- if (in_array($entity, array('membership', 'contribution'))) {
- $values['send_receipt'] = array('title' => 'Send Receipt', 'type' => (int) 16);
+ if (in_array($entity, ['membership', 'contribution'])) {
+ $values['send_receipt'] = ['title' => 'Send Receipt', 'type' => (int) 16];
}
return $values;
}
* Array of deprecated actions
*/
function _civicrm_api3_profile_deprecation() {
- return array(
+ return [
'set' => 'Profile api "set" action is deprecated in favor of "submit".',
'apply' => 'Profile api "apply" action is deprecated in favor of "submit".',
- );
+ ];
}
* Array of parameters determined by getfields.
*/
function _civicrm_api3_recurring_entity_get_spec(&$params) {
- $params['entity_table']['options'] = array(
+ $params['entity_table']['options'] = [
'civicrm_event' => 'civicrm_event',
'civicrm_activity' => 'civicrm_activity',
- );
+ ];
}
/**
* Array of parameters determined by getfields.
*/
function _civicrm_api3_recurring_entity_create_spec(&$params) {
- $params['entity_table']['options'] = array(
+ $params['entity_table']['options'] = [
'civicrm_event' => 'civicrm_event',
'civicrm_activity' => 'civicrm_activity',
- );
+ ];
$params['entity_table']['api.required'] = 1;
}
}
//perhaps we should add a 'getcount' but at this stage lets just handle getcount output
if ($options['is_count']) {
- return array('count' => $relationships);
+ return ['count' => $relationships];
}
foreach ($relationships as $relationshipId => $values) {
_civicrm_api3_custom_data_get($relationships[$relationshipId], CRM_Utils_Array::value('check_permissions', $params), 'Relationship', $relationshipId, NULL, CRM_Utils_Array::value('relationship_type_id', $values));
*/
function civicrm_api3_relationship_setvalue($params) {
require_once 'api/v3/Generic/Setvalue.php';
- $result = civicrm_api3_generic_setValue(array("entity" => 'Relationship', 'params' => $params));
+ $result = civicrm_api3_generic_setValue(["entity" => 'Relationship', 'params' => $params]);
if (empty($result['is_error']) && CRM_Utils_String::munge($params['field']) == 'is_active') {
$action = CRM_Core_Action::DISABLE;
* @return array
*/
function _civicrm_api3_relationship_type_getlist_defaults($request) {
- return array(
+ return [
'label_field' => 'label_a_b',
'search_field' => 'label_a_b',
- );
+ ];
}
$params['view_mode']['api.default'] = 'view';
$params['view_mode']['title'] = ts('View Mode for Navigation URL');
$params['view_mode']['type'] = CRM_Utils_Type::T_STRING;
- $params['view_mode']['options'] = array(
+ $params['view_mode']['options'] = [
'view' => ts('View'),
'criteria' => ts('Show Criteria'),
- );
+ ];
}
/**
'CRM_Core_DAO_OptionGroup', 'report_template', 'id', 'name'
);
if (!empty($params['component_id']) && !is_numeric($params['component_id'])) {
- $components = CRM_Core_PseudoConstant::get('CRM_Core_DAO_OptionValue', 'component_id', array('onlyActive' => FALSE, 'labelColumn' => 'name'));
+ $components = CRM_Core_PseudoConstant::get('CRM_Core_DAO_OptionValue', 'component_id', ['onlyActive' => FALSE, 'labelColumn' => 'name']);
$params['component_id'] = array_search($params['component_id'], $components);
}
return civicrm_api3_option_value_create($params);
function _civicrm_api3_report_template_create_spec(&$params) {
require_once 'api/v3/OptionValue.php';
_civicrm_api3_option_value_create_spec($params);
- $params['value']['api.aliases'] = array('report_url');
- $params['name']['api.aliases'] = array('class_name');
+ $params['value']['api.aliases'] = ['report_url'];
+ $params['name']['api.aliases'] = ['class_name'];
$params['option_group_id']['api.default'] = CRM_Core_DAO::getFieldValue(
'CRM_Core_DAO_OptionGroup', 'report_template', 'id', 'name'
);
* API result array
*/
function civicrm_api3_report_template_getrows($params) {
- civicrm_api3_verify_one_mandatory($params, NULL, array('report_id', 'instance_id'));
+ civicrm_api3_verify_one_mandatory($params, NULL, ['report_id', 'instance_id']);
list($rows, $instance, $metadata) = _civicrm_api3_report_template_getrows($params);
$instance->cleanUpTemporaryTables();
return civicrm_api3_create_success($rows, $params, 'ReportTemplate', 'getrows', CRM_Core_DAO::$_nullObject, $metadata);
*/
function _civicrm_api3_report_template_getrows($params) {
if (empty($params['report_id'])) {
- $params['report_id'] = civicrm_api3('report_instance', 'getvalue', array('id' => $params['instance_id'], 'return' => 'report_id'));
+ $params['report_id'] = civicrm_api3('report_instance', 'getvalue', ['id' => $params['instance_id'], 'return' => 'report_id']);
}
- $class = (string) civicrm_api3('option_value', 'getvalue', array(
+ $class = (string) civicrm_api3('option_value', 'getvalue', [
'option_group_name' => 'report_template',
'return' => 'name',
'value' => $params['report_id'],
- )
+ ]
);
$reportInstance = new $class();
$reportInstance->beginPostProcessCommon();
$sql = $reportInstance->buildQuery();
$reportInstance->addToDeveloperTab($sql);
- $rows = $metadata = $requiredMetadata = array();
+ $rows = $metadata = $requiredMetadata = [];
$reportInstance->buildRows($sql, $rows);
$reportInstance->formatDisplay($rows);
$metadata['metadata']['sql'] = $reportInstance->getReportSql();
}
}
- return array($rows, $reportInstance, $metadata);
+ return [$rows, $reportInstance, $metadata];
}
/**
* Input parameters.
*/
function _civicrm_api3_report_template_getrows_spec(&$params) {
- $params['report_id'] = array(
+ $params['report_id'] = [
'title' => 'Report ID - eg. member/lapse',
- );
+ ];
}
/* @codingStandardsIgnoreStart
* @access public
*/
function civicrm_api3_saved_search_create($params) {
- civicrm_api3_verify_one_mandatory($params, NULL, array('form_values', 'where_clause'));
+ civicrm_api3_verify_one_mandatory($params, NULL, ['form_values', 'where_clause']);
// The create function of the dao expects a 'formValues' that is
// not serialized. The get function returns form_values, that is
// serialized.
*/
function civicrm_api3_setting_getfields($params) {
if (!empty($params['action']) && strtolower($params['action']) == 'getvalue') {
- $result = array(
- 'name' => array(
+ $result = [
+ 'name' => [
'title' => 'name of setting field',
'api.required' => 1,
- 'type' => CRM_Utils_Type::T_STRING),
- 'group' => array(
+ 'type' => CRM_Utils_Type::T_STRING],
+ 'group' => [
'api.required' => 0,
'title' => 'Setting Group',
'description' => 'Settings Group. This is required if the setting is not stored in config',
- 'type' => CRM_Utils_Type::T_STRING),
- );
+ 'type' => CRM_Utils_Type::T_STRING],
+ ];
return civicrm_api3_create_success($result, $params, 'Setting', 'getfields');
}
if (!empty($params['name'])) {
}
$result = CRM_Core_BAO_Setting::getSettingSpecification(
CRM_Utils_Array::value('component_id', $params),
- CRM_Utils_Array::value('filters', $params, array()),
+ CRM_Utils_Array::value('filters', $params, []),
CRM_Utils_Array::value('domain_id', $params, NULL),
CRM_Utils_Array::value('profile', $params, NULL)
);
* @param array $params
*/
function _civicrm_api3_setting_getfields_spec(&$params) {
- $params['filters'] = array(
+ $params['filters'] = [
'title' => 'Filters',
'description' => 'Fields you wish to filter by e.g. array("group_name" => "CiviCRM Preferences")',
- );
- $params['component_id'] = array(
+ ];
+ $params['component_id'] = [
'title' => 'Component ID',
'description' => 'ID of relevant component',
- );
- $params['profile'] = array(
+ ];
+ $params['profile'] = [
'title' => 'Profile',
'description' => 'Profile is passed through to hooks & added to cachestring',
- );
+ ];
}
/**
function civicrm_api3_setting_getdefaults(&$params) {
$settings = civicrm_api3('Setting', 'getfields', $params);
$domains = _civicrm_api3_setting_getDomainArray($params);
- $defaults = array();
+ $defaults = [];
foreach ($domains as $domainID) {
- $defaults[$domainID] = array();
+ $defaults[$domainID] = [];
foreach ($settings['values'] as $setting => $spec) {
if (array_key_exists('default', $spec) && !is_null($spec['default'])) {
$defaults[$domainID][$setting] = $spec['default'];
* Parameters as passed to the API.
*/
function _civicrm_api3_setting_getdefaults_spec(&$params) {
- $params['domain_id'] = array(
+ $params['domain_id'] = [
'api.default' => 'current_domain',
'description' => 'Defaults may differ by domain - if you do not pass in a domain id this will default to the current domain
an array or "all" are acceptable values for multiple domains',
'title' => 'Setting Domain',
- );
+ ];
}
/**
// but it's tightly coupled to DAO/field. However, if you really need to support
// more pseudoconstant types, then probably best to refactor it. For now, KISS.
if (!empty($pseudoconstant['callback'])) {
- $values = Civi\Core\Resolver::singleton()->call($pseudoconstant['callback'], array());
+ $values = Civi\Core\Resolver::singleton()->call($pseudoconstant['callback'], []);
return civicrm_api3_create_success($values, $params, 'Setting', 'getoptions');
}
elseif (!empty($pseudoconstant['optionGroupName'])) {
$fields = civicrm_api('Setting', 'getfields', $params);
$fields = $fields['values'];
$domains = _civicrm_api3_setting_getDomainArray($params);
- $result = array();
+ $result = [];
foreach ($domains as $domainID) {
$valuesToRevert = array_intersect_key($defaults['values'][$domainID], $fields);
if (!empty($valuesToRevert)) {
* @param array $params
*/
function _civicrm_api3_setting_revert_spec(&$params) {
- $params['name'] = array(
+ $params['name'] = [
'title' => 'Name',
'description' => 'Setting Name belongs to',
- );
- $params['component_id'] = array(
+ ];
+ $params['component_id'] = [
'title' => 'Component ID',
'description' => 'ID of relevant component',
- );
- $params['domain_id'] = array(
+ ];
+ $params['domain_id'] = [
'api.default' => 'current_domain',
'description' => 'Defaults may differ by domain - if you do not pass in a domain id this will default to the current domain'
. ' an array or "all" are acceptable values for multiple domains',
'title' => 'Setting Domain',
- );
+ ];
}
/**
function civicrm_api3_setting_fill(&$params) {
$defaults = civicrm_api3('Setting', 'getdefaults', $params);
$domains = _civicrm_api3_setting_getDomainArray($params);
- $result = array();
+ $result = [];
foreach ($domains as $domainID) {
- $apiArray = array(
+ $apiArray = [
'version' => $params['version'],
'domain_id' => $domainID,
- );
+ ];
$existing = civicrm_api3('Setting', 'get', $apiArray);
$valuesToFill = array_diff_key($defaults['values'][$domainID], $existing['values'][$domainID]);
if (!empty($valuesToFill)) {
* @param array $params
*/
function _civicrm_api3_setting_fill_spec(&$params) {
- $params['name'] = array(
+ $params['name'] = [
'title' => 'Name',
'description' => 'Setting Name belongs to',
- );
- $params['component_id'] = array(
+ ];
+ $params['component_id'] = [
'title' => 'Component ID',
'description' => 'ID of relevant component',
- );
- $params['domain_id'] = array(
+ ];
+ $params['domain_id'] = [
'api.default' => 'current_domain',
'title' => 'Setting Domain',
'description' => 'Defaults may differ by domain - if you do not pass in a domain id this will default to the '
. 'current domain, an array or "all" are acceptable values for multiple domains',
- );
+ ];
}
/**
* Parameters as passed to the API.
*/
function _civicrm_api3_setting_create_spec(&$params) {
- $params['domain_id'] = array(
+ $params['domain_id'] = [
'api.default' => 'current_domain',
'title' => 'Setting Domain',
'description' => 'if you do not pass in a domain id this will default to the current domain
an array or "all" are acceptable values for multiple domains',
- );
- $params['group'] = array(
+ ];
+ $params['group'] = [
'title' => 'Setting Group',
'description' => 'if you know the group defining it will make the api more efficient',
- );
+ ];
}
/**
*/
function civicrm_api3_setting_get($params) {
$domains = _civicrm_api3_setting_getDomainArray($params);
- $result = CRM_Core_BAO_Setting::getItems($params, $domains, CRM_Utils_Array::value('return', $params, array()));
+ $result = CRM_Core_BAO_Setting::getItems($params, $domains, CRM_Utils_Array::value('return', $params, []));
return civicrm_api3_create_success($result, $params, 'Setting', 'get');
}
/**
* Parameters as passed to the API.
*/
function _civicrm_api3_setting_get_spec(&$params) {
- $params['domain_id'] = array(
+ $params['domain_id'] = [
'api.default' => 'current_domain',
'title' => 'Setting Domain',
'description' => 'if you do not pass in a domain id this will default to the current domain',
- );
- $params['group'] = array(
+ ];
+ $params['group'] = [
'title' => 'Setting Group',
'description' => 'if you know the group defining it will make the api more efficient',
- );
+ ];
}
/**
* Returns value for specific parameter.
*/
function _civicrm_api3_setting_getvalue_spec(&$params) {
- $params['group'] = array(
+ $params['group'] = [
'title' => 'Settings Group',
'api.required' => TRUE,
- );
- $params['name'] = array(
+ ];
+ $params['name'] = [
'title' => 'Setting Name',
- 'api.aliases' => array('return'),
- );
- $params['default_value'] = array(
+ 'api.aliases' => ['return'],
+ ];
+ $params['default_value'] = [
'title' => 'Default Value',
- );
- $params['component_id'] = array(
+ ];
+ $params['component_id'] = [
'title' => 'Component Id',
- );
- $params['contact_id'] = array(
+ ];
+ $params['contact_id'] = [
'title' => 'Contact Id',
- );
- $params['domain_id'] = array(
+ ];
+ $params['domain_id'] = [
'title' => 'Setting Domain',
'description' => 'if you do not pass in a domain id this will default to the current domain',
- );
+ ];
}
/**
}
if ($params['domain_id'] == 'all') {
- $domainAPIResult = civicrm_api('domain', 'get', array('version' => 3, 'return' => 'id'));
+ $domainAPIResult = civicrm_api('domain', 'get', ['version' => 3, 'return' => 'id']);
if (isset($domainAPIResult['values'])) {
$params['domain_id'] = array_keys($domainAPIResult['values']);
}
$domains = $params['domain_id'];
}
else {
- $domains = array($params['domain_id']);
+ $domains = [$params['domain_id']];
}
return $domains;
}
* @return array
*/
function _civicrm_api3_survey_getlist_defaults(&$request) {
- return array(
- 'description_field' => array(
+ return [
+ 'description_field' => [
'campaign_id',
- ),
- 'params' => array(
+ ],
+ 'params' => [
'is_active' => 1,
- ),
- );
+ ],
+ ];
}
*/
function civicrm_api3_survey_respondant_get(&$params) {
- civicrm_api3_verify_one_mandatory($params, NULL, array('survey_id', 'id'));
+ civicrm_api3_verify_one_mandatory($params, NULL, ['survey_id', 'id']);
if (array_key_exists('survey_id', $params)) {
$surveyID = $params['survey_id'];
$interviewerID = $params['interviewer_id'];
}
- $statusIds = array();
+ $statusIds = [];
if (array_key_exists('status_id', $params)) {
$statusIds = explode(',', $params['status_id']);
}
* Array of parameters determined by getfields.
*/
function _civicrm_api3_system_flush_spec(&$params) {
- $params['triggers'] = array(
+ $params['triggers'] = [
'title' => 'Triggers',
'description' => 'rebuild triggers (boolean)',
'type' => CRM_Utils_Type::T_BOOLEAN,
- );
- $params['session'] = array(
+ ];
+ $params['session'] = [
'title' => 'Sessions',
'description' => 'refresh sessions (boolean)',
'type' => CRM_Utils_Type::T_BOOLEAN,
- );
+ ];
}
/**
* @see http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/
function _civicrm_api3_system_check_spec(&$spec) {
- $spec['id'] = array(
+ $spec['id'] = [
'title' => 'ID',
'description' => 'Not a real identifier - do not use',
'type' => CRM_Utils_Type::T_INT,
- );
- $spec['name'] = array(
+ ];
+ $spec['name'] = [
'title' => 'Name',
'description' => 'Unique identifier',
'type' => CRM_Utils_Type::T_STRING,
- );
- $spec['title'] = array(
+ ];
+ $spec['title'] = [
'title' => 'Title',
'description' => 'Short title text',
'type' => CRM_Utils_Type::T_STRING,
- );
- $spec['message'] = array(
+ ];
+ $spec['message'] = [
'title' => 'Message',
'description' => 'Long description html',
'type' => CRM_Utils_Type::T_STRING,
- );
- $spec['help'] = array(
+ ];
+ $spec['help'] = [
'title' => 'Help',
'description' => 'Optional extra help (html string)',
'type' => CRM_Utils_Type::T_STRING,
- );
- $spec['severity'] = array(
+ ];
+ $spec['severity'] = [
'title' => 'Severity',
'description' => 'Psr\Log\LogLevel string',
'type' => CRM_Utils_Type::T_STRING,
'options' => array_combine(CRM_Utils_Check::getSeverityList(), CRM_Utils_Check::getSeverityList()),
- );
- $spec['severity_id'] = array(
+ ];
+ $spec['severity_id'] = [
'title' => 'Severity ID',
'description' => 'Integer representation of Psr\Log\LogLevel',
'type' => CRM_Utils_Type::T_INT,
'options' => CRM_Utils_Check::getSeverityList(),
- );
- $spec['is_visible'] = array(
+ ];
+ $spec['is_visible'] = [
'title' => 'is visible',
'description' => '0 if message has been hidden by the user',
'type' => CRM_Utils_Type::T_BOOLEAN,
- );
- $spec['hidden_until'] = array(
+ ];
+ $spec['hidden_until'] = [
'title' => 'Hidden_until',
'description' => 'When will hidden message be visible again?',
'type' => CRM_Utils_Type::T_DATE,
- );
+ ];
}
/**
function civicrm_api3_system_check($params) {
// array(array('name'=> $, 'severity'=>$, ...))
$id = 1;
- $returnValues = $fields = array();
+ $returnValues = $fields = [];
_civicrm_api3_system_check_spec($fields);
// array(CRM_Utils_Check_Message)
$messages = CRM_Utils_Check::checkAll();
foreach ($messages as $msg) {
- $returnValues[] = $msg->toArray() + array('id' => $id++);
+ $returnValues[] = $msg->toArray() + ['id' => $id++];
}
return _civicrm_api3_basic_array_get('systemCheck', $params, $returnValues, "id", array_keys($fields));
// This part means fields with separate db storage are accepted as params which kind of seems more intuitive to me
// because I felt like not doing this required a bunch of explanation in the spec function - but perhaps other won't see it as helpful?
if (!isset($params['context'])) {
- $params['context'] = array();
+ $params['context'] = [];
}
- $specialFields = array('contact_id', 'hostname');
+ $specialFields = ['contact_id', 'hostname'];
foreach ($specialFields as $specialField) {
if (isset($params[$specialField]) && !isset($params['context'])) {
$params['context'][$specialField] = $params[$specialField];
* @param array $params
*/
function _civicrm_api3_system_log_spec(&$params) {
- $params['level'] = array(
+ $params['level'] = [
'title' => 'Log Level',
'description' => 'Log level as described in PSR3 (info, debug, warning etc)',
'type' => CRM_Utils_Type::T_STRING,
'api.required' => TRUE,
- );
- $params['message'] = array(
+ ];
+ $params['message'] = [
'title' => 'Log Message',
'description' => 'Standardised message string, you can also ',
'type' => CRM_Utils_Type::T_STRING,
'api.required' => TRUE,
- );
- $params['context'] = array(
+ ];
+ $params['context'] = [
'title' => 'Log Context',
'description' => 'An array of additional data to store.',
'type' => CRM_Utils_Type::T_LONGTEXT,
- 'api.default' => array(),
- );
- $params['contact_id'] = array(
+ 'api.default' => [],
+ ];
+ $params['contact_id'] = [
'title' => 'Log Contact ID',
'description' => 'Optional ID of relevant contact',
'type' => CRM_Utils_Type::T_INT,
- );
- $params['hostname'] = array(
+ ];
+ $params['hostname'] = [
'title' => 'Log Hostname',
'description' => 'Optional name of host',
'type' => CRM_Utils_Type::T_STRING,
- );
+ ];
}
/**
*/
function civicrm_api3_system_get($params) {
$config = CRM_Core_Config::singleton();
- $returnValues = array(
- array(
+ $returnValues = [
+ [
'version' => CRM_Utils_System::version(), // deprecated in favor of civi.version
'uf' => CIVICRM_UF, // deprecated in favor of cms.type
- 'php' => array(
+ 'php' => [
'version' => phpversion(),
'time' => time(),
'tz' => date_default_timezone_get(),
'sapi' => php_sapi_name(),
'extensions' => get_loaded_extensions(),
'ini' => _civicrm_api3_system_get_redacted_ini(),
- ),
- 'mysql' => array(
+ ],
+ 'mysql' => [
'version' => CRM_Core_DAO::singleValueQuery('SELECT @@version'),
'time' => CRM_Core_DAO::singleValueQuery('SELECT unix_timestamp()'),
'vars' => _civicrm_api3_system_get_redacted_mysql(),
- ),
- 'cms' => array(
+ ],
+ 'cms' => [
'version' => $config->userSystem->getVersion(),
'type' => CIVICRM_UF,
'modules' => CRM_Core_Module::collectStatuses($config->userSystem->getModules()),
- ),
- 'civi' => array(
+ ],
+ 'civi' => [
'version' => CRM_Utils_System::version(),
'dev' => (bool) CRM_Utils_System::isDevelopment(),
'components' => array_keys(CRM_Core_Component::getEnabledComponents()),
'multidomain' => CRM_Core_DAO::singleValueQuery('SELECT count(*) FROM civicrm_domain') > 1,
'settings' => _civicrm_api3_system_get_redacted_settings(),
'exampleUrl' => CRM_Utils_System::url('civicrm/example', NULL, TRUE, NULL, FALSE),
- ),
- 'http' => array(
+ ],
+ 'http' => [
'software' => CRM_Utils_Array::value('SERVER_SOFTWARE', $_SERVER),
'forwarded' => !empty($_SERVER['HTTP_X_FORWARDED_FOR']) || !empty($_SERVER['X_FORWARDED_PROTO']),
'port' => (empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == 80 || $_SERVER['SERVER_PORT'] == 443) ? 'Standard' : 'Nonstandard',
- ),
- 'os' => array(
+ ],
+ 'os' => [
'type' => php_uname('s'),
'release' => php_uname('r'),
'version' => php_uname('v'),
'machine' => php_uname('m'),
- ),
- ),
- );
+ ],
+ ],
+ ];
return civicrm_api3_create_success($returnValues, $params, 'System', 'get');
}
}
$inis = ini_get_all(NULL, FALSE);
- $result = array();
+ $result = [];
foreach ($inis as $k => $v) {
if (empty($v) || in_array($k, $whitelist)) {
$result[$k] = $v;
}
$inis = ini_get_all(NULL, FALSE);
- $result = array();
+ $result = [];
$dao = CRM_Core_DAO::executeQuery('SHOW VARIABLES');
while ($dao->fetch()) {
if (empty($dao->Variable_name) || in_array($dao->Variable_name, $whitelist)) {
$whitelist = _civicrm_api3_system_get_whitelist(__DIR__ . '/System/setting-whitelist.txt');
}
- $apiResult = civicrm_api3('Setting', 'get', array());
- $result = array();
+ $apiResult = civicrm_api3('Setting', 'get', []);
+ $result = [];
foreach ($apiResult['values'] as $settings) {
foreach ($settings as $key => $value) {
if (in_array($key, $whitelist)) {
function _civicrm_api3_tag_create_spec(&$params) {
$params['used_for']['api.default'] = 'civicrm_contact';
$params['name']['api.required'] = 1;
- $params['id']['api.aliases'] = array('tag');
+ $params['id']['api.aliases'] = ['tag'];
}
/**
$params['field_name']['api.required'] = TRUE;
$params['uf_group_id']['api.required'] = TRUE;
- $params['option.autoweight'] = array(
+ $params['option.autoweight'] = [
'title' => "Auto Weight",
'description' => "Automatically adjust weights in UFGroup to align with UFField",
'type' => CRM_Utils_Type::T_BOOLEAN,
'api.default' => TRUE,
- );
+ ];
$params['is_active']['api.default'] = TRUE;
}
*/
function _civicrm_api3_uf_field_delete_spec(&$params) {
// legacy support for field_id
- $params['id']['api.aliases'] = array('field_id');
+ $params['id']['api.aliases'] = ['field_id'];
}
* @return array
*/
function _civicrm_api3_uf_group_getlist_defaults(&$request) {
- return array(
- 'description_field' => array(
+ return [
+ 'description_field' => [
'description',
'group_type',
- ),
- 'params' => array(
+ ],
+ 'params' => [
'is_active' => 1,
- ),
- );
+ ],
+ ];
}
/**
* @return array
*/
function _civicrm_api3_uf_group_getlist_output($result, $request, $entity, $fields) {
- $output = array();
+ $output = [];
if (!empty($result['values'])) {
foreach ($result['values'] as $row) {
- $data = array(
+ $data = [
'id' => $row[$request['id_field']],
'label' => $row[$request['label_field']],
- );
+ ];
if (!empty($request['description_field'])) {
- $data['description'] = array();
+ $data['description'] = [];
foreach ((array) $request['description_field'] as $field) {
if (!empty($row[$field])) {
// Special formatting for group_type field
*/
function civicrm_api3_user_get($params) {
if (empty($params['contact_id'])) {
- $params['contact_id'] = civicrm_api3('UFMatch', 'getvalue', array(
+ $params['contact_id'] = civicrm_api3('UFMatch', 'getvalue', [
'uf_id' => $params['id'],
'domain_id' => CRM_Core_Config::domainID(),
'return' => 'contact_id',
- ));
+ ]);
}
$result = CRM_Core_Config::singleton()->userSystem->getUser($params['contact_id']);
$result['contact_id'] = $params['contact_id'];
return civicrm_api3_create_success(
- array($result['id'] => $result),
+ [$result['id'] => $result],
$params,
'user',
'get'
*/
function _civicrm_api3_user_get_spec(&$params) {
// At this stage contact-id is required - we may be able to loosen this.
- $params['contact_id'] = array(
+ $params['contact_id'] = [
'title' => 'Contact ID',
'type' => CRM_Utils_Type::T_INT,
'api.required' => 1,
- );
- $params['id'] = array(
+ ];
+ $params['id'] = [
'title' => 'CMS User ID',
'type' => CRM_Utils_Type::T_INT,
- );
- $params['name'] = array(
+ ];
+ $params['name'] = [
'title' => 'Username',
'type' => CRM_Utils_Type::T_STRING,
- );
+ ];
}
* API result array
*/
function activity_create_example() {
- $params = array(
+ $params = [
'source_contact_id' => 1,
'activity_type_id' => 'Test activity type',
'subject' => 'test activity type id',
'location' => 'Pennsylvania',
'details' => 'a test activity',
'custom_2' => '1',
- );
+ ];
try{
$result = civicrm_api3('Activity', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function activity_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'source_record_id' => '',
'activity_type_id' => '9999',
'engagement_level' => '',
'weight' => '',
'is_star' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function activity_get_example() {
- $params = array(
+ $params = [
'return.custom_2' => 1,
'id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Activity', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function activity_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'activity_type_id' => '9999',
'subject' => 'test activity type id',
'custom_1_1' => 'defaultValue',
'custom_2_1' => 'Anderson, Anthony',
'custom_2_1_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function activity_create_example() {
- $params = array(
+ $params = [
'source_contact_id' => 1,
'activity_type_id' => 'Test activity type',
'subject' => 'test activity type id',
'location' => 'Pennsylvania',
'details' => 'a test activity',
'custom_1' => 'custom string',
- );
+ ];
try{
$result = civicrm_api3('Activity', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function activity_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'source_record_id' => '',
'activity_type_id' => '9999',
'engagement_level' => '',
'weight' => '',
'is_star' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function activity_get_example() {
- $params = array(
+ $params = [
'source_contact_id' => 1,
'filter.activity_date_time_high' => '20120101000000',
'sequential' => 1,
- );
+ ];
try{
$result = civicrm_api3('Activity', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function activity_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '1',
'activity_type_id' => '9999',
'subject' => 'Make-it-Happen Meeting',
'is_deleted' => 0,
'is_star' => 0,
'source_contact_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function activity_get_example() {
- $params = array(
+ $params = [
'filter.activity_date_time_low' => '20120101000000',
'sequential' => 1,
- );
+ ];
try{
$result = civicrm_api3('Activity', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function activity_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '2',
'activity_type_id' => '9999',
'subject' => 'Make-it-Happen Meeting',
'is_deleted' => 0,
'is_star' => 0,
'source_contact_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function activity_delete_example() {
- $params = array(
+ $params = [
'id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Activity', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function activity_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function activity_get_example() {
- $params = array(
+ $params = [
'contact_id' => 1,
'activity_type_id' => 9999,
'sequential' => 1,
'return.custom_1' => 1,
- );
+ ];
try{
$result = civicrm_api3('Activity', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function activity_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '1',
'activity_type_id' => '9999',
'subject' => 'test activity type id',
'status' => 'Completed',
'activity_name' => 'Test activity type',
'custom_1_1' => 'custom string',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function activity_getfields_example() {
- $params = array(
+ $params = [
'action' => 'create',
- );
+ ];
try{
$result = civicrm_api3('Activity', 'getfields', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function activity_getfields_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 29,
- 'values' => array(
- 'source_record_id' => array(
+ 'values' => [
+ 'source_record_id' => [
'name' => 'source_record_id',
'type' => 1,
'title' => 'Source Record',
'table_name' => 'civicrm_activity',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
- ),
- 'activity_type_id' => array(
+ ],
+ 'activity_type_id' => [
'name' => 'activity_type_id',
'type' => 1,
'title' => 'Activity Type ID',
'table_name' => 'civicrm_activity',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
- 'html' => array(
+ 'html' => [
'type' => 'Select',
'size' => 6,
'maxlength' => 14,
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'optionGroupName' => 'activity_type',
'optionEditPath' => 'civicrm/admin/options/activity_type',
- ),
- ),
- 'activity_date_time' => array(
+ ],
+ ],
+ 'activity_date_time' => [
'name' => 'activity_date_time',
'type' => 12,
'title' => 'Activity Date',
'table_name' => 'civicrm_activity',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
- 'html' => array(
+ 'html' => [
'type' => 'Select Date',
'format' => 'activityDateTime',
- ),
- ),
- 'phone_id' => array(
+ ],
+ ],
+ 'phone_id' => [
'name' => 'phone_id',
'type' => 1,
'title' => 'Phone (called) ID',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
'FKClassName' => 'CRM_Core_DAO_Phone',
- 'html' => array(
+ 'html' => [
'type' => 'EntityRef',
'size' => 6,
'maxlength' => 14,
- ),
+ ],
'FKApiName' => 'Phone',
- ),
- 'phone_number' => array(
+ ],
+ 'phone_number' => [
'name' => 'phone_number',
'type' => 2,
'title' => 'Phone (called) Number',
'table_name' => 'civicrm_activity',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 64,
'size' => 30,
- ),
- ),
- 'priority_id' => array(
+ ],
+ ],
+ 'priority_id' => [
'name' => 'priority_id',
'type' => 1,
'title' => 'Priority',
'table_name' => 'civicrm_activity',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
- 'html' => array(
+ 'html' => [
'type' => 'Select',
'size' => 6,
'maxlength' => 14,
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'optionGroupName' => 'priority',
'optionEditPath' => 'civicrm/admin/options/priority',
- ),
- ),
- 'parent_id' => array(
+ ],
+ ],
+ 'parent_id' => [
'name' => 'parent_id',
'type' => 1,
'title' => 'Parent Activity Id',
'bao' => 'CRM_Activity_BAO_Activity',
'FKClassName' => 'CRM_Activity_DAO_Activity',
'FKApiName' => 'Activity',
- ),
- 'is_auto' => array(
+ ],
+ 'is_auto' => [
'name' => 'is_auto',
'type' => 16,
'title' => 'Auto',
'table_name' => 'civicrm_activity',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
- ),
- 'relationship_id' => array(
+ ],
+ 'relationship_id' => [
'name' => 'relationship_id',
'type' => 1,
'title' => 'Relationship Id',
'bao' => 'CRM_Activity_BAO_Activity',
'FKClassName' => 'CRM_Contact_DAO_Relationship',
'FKApiName' => 'Relationship',
- ),
- 'is_current_revision' => array(
+ ],
+ 'is_current_revision' => [
'name' => 'is_current_revision',
'type' => 16,
'title' => 'Is this activity a current revision in versioning chain?',
'table_name' => 'civicrm_activity',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
- 'html' => array(
+ 'html' => [
'type' => 'CheckBox',
- ),
- ),
- 'original_id' => array(
+ ],
+ ],
+ 'original_id' => [
'name' => 'original_id',
'type' => 1,
'title' => 'Original Activity ID ',
'bao' => 'CRM_Activity_BAO_Activity',
'FKClassName' => 'CRM_Activity_DAO_Activity',
'FKApiName' => 'Activity',
- ),
- 'weight' => array(
+ ],
+ 'weight' => [
'name' => 'weight',
'type' => 1,
'title' => 'Order',
'table_name' => 'civicrm_activity',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'size' => 6,
'maxlength' => 14,
- ),
- ),
- 'is_star' => array(
+ ],
+ ],
+ 'is_star' => [
'name' => 'is_star',
'type' => 16,
'title' => 'Is Starred',
'table_name' => 'civicrm_activity',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
- ),
- 'id' => array(
+ ],
+ 'id' => [
'name' => 'id',
'type' => 1,
'title' => 'Activity ID',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
'uniqueName' => 'activity_id',
- 'api.aliases' => array(
+ 'api.aliases' => [
'0' => 'activity_id',
- ),
- ),
- 'subject' => array(
+ ],
+ ],
+ 'subject' => [
'name' => 'subject',
'type' => 2,
'title' => 'Subject',
'table_name' => 'civicrm_activity',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 255,
'size' => 45,
- ),
+ ],
'uniqueName' => 'activity_subject',
- ),
- 'duration' => array(
+ ],
+ 'duration' => [
'name' => 'duration',
'type' => 1,
'title' => 'Duration',
'table_name' => 'civicrm_activity',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'size' => 6,
'maxlength' => 14,
- ),
+ ],
'uniqueName' => 'activity_duration',
- ),
- 'location' => array(
+ ],
+ 'location' => [
'name' => 'location',
'type' => 2,
'title' => 'Location',
'table_name' => 'civicrm_activity',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 255,
'size' => 45,
- ),
+ ],
'uniqueName' => 'activity_location',
- ),
- 'details' => array(
+ ],
+ 'details' => [
'name' => 'details',
'type' => 32,
'title' => 'Details',
'table_name' => 'civicrm_activity',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
- 'html' => array(
+ 'html' => [
'type' => 'RichTextEditor',
'rows' => 2,
'cols' => 80,
- ),
+ ],
'uniqueName' => 'activity_details',
- ),
- 'status_id' => array(
+ ],
+ 'status_id' => [
'name' => 'status_id',
'type' => 1,
'title' => 'Activity Status',
'table_name' => 'civicrm_activity',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
- 'html' => array(
+ 'html' => [
'type' => 'Select',
'size' => 6,
'maxlength' => 14,
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'optionGroupName' => 'activity_status',
'optionEditPath' => 'civicrm/admin/options/activity_status',
- ),
+ ],
'uniqueName' => 'activity_status_id',
- 'api.aliases' => array(
+ 'api.aliases' => [
'0' => 'activity_status',
- ),
- ),
- 'is_test' => array(
+ ],
+ ],
+ 'is_test' => [
'name' => 'is_test',
'type' => 16,
'title' => 'Test',
'table_name' => 'civicrm_activity',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
- 'html' => array(
+ 'html' => [
'type' => 'Select',
- ),
+ ],
'uniqueName' => 'activity_is_test',
- ),
- 'medium_id' => array(
+ ],
+ 'medium_id' => [
'name' => 'medium_id',
'type' => 1,
'title' => 'Activity Medium',
'table_name' => 'civicrm_activity',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
- 'html' => array(
+ 'html' => [
'type' => 'Select',
'size' => 6,
'maxlength' => 14,
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'optionGroupName' => 'encounter_medium',
'optionEditPath' => 'civicrm/admin/options/encounter_medium',
- ),
+ ],
'uniqueName' => 'activity_medium_id',
- ),
- 'result' => array(
+ ],
+ 'result' => [
'name' => 'result',
'type' => 2,
'title' => 'Result',
'table_name' => 'civicrm_activity',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 255,
'size' => 45,
- ),
+ ],
'uniqueName' => 'activity_result',
- ),
- 'is_deleted' => array(
+ ],
+ 'is_deleted' => [
'name' => 'is_deleted',
'type' => 16,
'title' => 'Activity is in the Trash',
'table_name' => 'civicrm_activity',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
- ),
+ ],
'uniqueName' => 'activity_is_deleted',
- ),
- 'campaign_id' => array(
+ ],
+ 'campaign_id' => [
'name' => 'campaign_id',
'type' => 1,
'title' => 'Campaign',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
'FKClassName' => 'CRM_Campaign_DAO_Campaign',
- 'html' => array(
+ 'html' => [
'type' => 'CheckBox',
'size' => 6,
'maxlength' => 14,
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'table' => 'civicrm_campaign',
'keyColumn' => 'id',
'labelColumn' => 'title',
- ),
+ ],
'uniqueName' => 'activity_campaign_id',
'FKApiName' => 'Campaign',
- ),
- 'engagement_level' => array(
+ ],
+ 'engagement_level' => [
'name' => 'engagement_level',
'type' => 1,
'title' => 'Engagement Index',
'table_name' => 'civicrm_activity',
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
- 'html' => array(
+ 'html' => [
'type' => 'Select',
'size' => 6,
'maxlength' => 14,
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'optionGroupName' => 'engagement_index',
'optionEditPath' => 'civicrm/admin/options/engagement_index',
- ),
+ ],
'uniqueName' => 'activity_engagement_level',
- ),
- 'source_contact_id' => array(
+ ],
+ 'source_contact_id' => [
'name' => 'source_contact_id',
'title' => 'Activity Source Contact',
'description' => 'Person who created this activity. Defaults to current user.',
'FKClassName' => 'CRM_Contact_DAO_Contact',
'api.default' => 'user_contact_id',
'FKApiName' => 'Contact',
- ),
- 'assignee_contact_id' => array(
+ ],
+ 'assignee_contact_id' => [
'name' => 'assignee_id',
'title' => 'Activity Assignee',
'description' => 'Contact(s) assigned to this activity.',
'type' => 1,
'FKClassName' => 'CRM_Contact_DAO_Contact',
'FKApiName' => 'Contact',
- ),
- 'target_contact_id' => array(
+ ],
+ 'target_contact_id' => [
'name' => 'target_id',
'title' => 'Activity Target',
'description' => 'Contact(s) participating in this activity.',
'type' => 1,
'FKClassName' => 'CRM_Contact_DAO_Contact',
'FKApiName' => 'Contact',
- ),
- 'case_id' => array(
+ ],
+ 'case_id' => [
'name' => 'case_id',
'title' => 'Case ID',
'description' => 'For creating an activity as part of a case.',
'type' => 1,
'FKClassName' => 'CRM_Case_DAO_Case',
'FKApiName' => 'Case',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function activity_create_example() {
- $params = array(
+ $params = [
'source_contact_id' => 1,
'subject' => 'Make-it-Happen Meeting',
'activity_date_time' => '20110316',
'priority_id' => 1,
'target_contact_id' => 1,
'assignee_contact_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Activity', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function activity_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'source_record_id' => '',
'activity_type_id' => '1',
'engagement_level' => '',
'weight' => '',
'is_star' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function activity_getsingle_example() {
- $params = array(
+ $params = [
'id' => 1,
- 'return' => array(
+ 'return' => [
'0' => 'source_contact_name',
'1' => 'target_contact_name',
'2' => 'assignee_contact_name',
'3' => 'subject',
- ),
- );
+ ],
+ ];
try{
$result = civicrm_api3('Activity', 'getsingle', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function activity_getsingle_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'id' => '1',
'subject' => 'Make-it-Happen Meeting',
'source_contact_id' => '6',
'source_contact_name' => 'D Bug',
- 'target_contact_id' => array(
+ 'target_contact_id' => [
'1' => '4',
- ),
- 'target_contact_name' => array(
+ ],
+ 'target_contact_name' => [
'3' => 'A Cat',
'4' => 'B Good',
- ),
- 'assignee_contact_id' => array(),
- 'assignee_contact_name' => array(
+ ],
+ 'assignee_contact_id' => [],
+ 'assignee_contact_name' => [
'5' => 'C Shore',
- ),
- );
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function activity_get_example() {
- $params = array(
+ $params = [
'activity_id' => 1,
'sequential' => 1,
'return.assignee_contact_id' => 1,
- 'api.contact.get' => array(
+ 'api.contact.get' => [
'id' => '$value.source_contact_id',
- ),
- );
+ ],
+ ];
try{
$result = civicrm_api3('Activity', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function activity_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '1',
'activity_type_id' => '9999',
'subject' => 'test activity type id',
'is_current_revision' => '1',
'is_deleted' => 0,
'is_star' => 0,
- 'assignee_contact_id' => array(
+ 'assignee_contact_id' => [
'0' => '3',
- ),
+ ],
'source_contact_id' => '1',
- 'api.contact.get' => array(
+ 'api.contact.get' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'contact_id' => '1',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'state_province' => '',
'country' => '',
'id' => '1',
- ),
- ),
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function activity_contact_create_example() {
- $params = array(
+ $params = [
'contact_id' => 3,
'activity_id' => 1,
'record_type_id' => 2,
- );
+ ];
try{
$result = civicrm_api3('ActivityContact', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function activity_contact_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 4,
- 'values' => array(
- '4' => array(
+ 'values' => [
+ '4' => [
'id' => '4',
'activity_id' => '1',
'contact_id' => '3',
'record_type_id' => '2',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function activity_contact_delete_example() {
- $params = array(
+ $params = [
'id' => 8,
- );
+ ];
try{
$result = civicrm_api3('ActivityContact', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function activity_contact_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function activity_type_create_example() {
- $params = array(
+ $params = [
'weight' => '2',
'label' => 'send out letters',
'filter' => 0,
'is_active' => 1,
'is_optgroup' => 1,
'is_default' => 0,
- );
+ ];
try{
$result = civicrm_api3('ActivityType', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function activity_type_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 849,
- 'values' => array(
- '849' => array(
+ 'values' => [
+ '849' => [
'id' => '849',
'option_group_id' => '2',
'label' => 'send out letters',
'visibility_id' => '',
'icon' => '',
'color' => '',
- ),
- ),
+ ],
+ ],
'deprecated' => 'The ActivityType api is deprecated. Please use the OptionValue api instead.',
- );
+ ];
return $expectedResult;
}
* API result array
*/
function activity_type_get_example() {
- $params = array();
+ $params = [];
try{
$result = civicrm_api3('ActivityType', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function activity_type_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 54,
- 'values' => array(
+ 'values' => [
'1' => 'Meeting',
'2' => 'Phone Call',
'3' => 'Email',
'52' => 'Contact Deleted by Merge',
'53' => 'Failed Payment',
'54' => 'Close Accounting Period',
- ),
+ ],
'deprecated' => 'The ActivityType api is deprecated. Please use the OptionValue api instead.',
- );
+ ];
return $expectedResult;
}
* API result array
*/
function address_get_example() {
- $params = array(
- 'street_address' => array(
+ $params = [
+ 'street_address' => [
'LIKE' => '%mb%',
- ),
+ ],
'sequential' => 1,
- );
+ ];
try{
$result = civicrm_api3('Address', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function address_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '1',
'contact_id' => '20',
'location_type_id' => '18',
'postal_code' => '6971 BN',
'country_id' => '1152',
'manual_geo_code' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function address_create_example() {
- $params = array(
+ $params = [
'street_parsing' => 1,
'street_address' => '54A Excelsior Ave. Apt 1C',
'location_type_id' => 7,
'contact_id' => 4,
- );
+ ];
try{
$result = civicrm_api3('Address', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function address_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '4',
'location_type_id' => '7',
'street_name' => 'Excelsior Ave.',
'street_unit' => 'Apt 1C',
'manual_geo_code' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function address_get_example() {
- $params = array(
- 'options' => array(
+ $params = [
+ 'options' => [
'sort' => 'street_address DESC',
'limit' => 2,
- ),
+ ],
'sequential' => 1,
- );
+ ];
try{
$result = civicrm_api3('Address', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function address_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 2,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '2',
'contact_id' => '19',
'location_type_id' => '17',
'postal_code' => '6971 BN',
'country_id' => '1152',
'manual_geo_code' => 0,
- ),
- '1' => array(
+ ],
+ '1' => [
'id' => '1',
'contact_id' => '19',
'location_type_id' => '17',
'postal_code' => '6971 BN',
'country_id' => '1152',
'manual_geo_code' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function address_create_example() {
- $params = array(
+ $params = [
'contact_id' => 3,
'location_type_id' => 6,
'street_name' => 'Ambachtstraat',
'country_id' => '1152',
'city' => 'Brummen',
'is_primary' => 1,
- );
+ ];
try{
$result = civicrm_api3('Address', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function address_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'contact_id' => '3',
'location_type_id' => '6',
'postal_code' => '6971 BN',
'country_id' => '1152',
'manual_geo_code' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function address_delete_example() {
- $params = array(
+ $params = [
'id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Address', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function address_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function address_get_example() {
- $params = array(
+ $params = [
'contact_id' => 17,
'street_name' => 'Ambachtstraat',
- );
+ ];
try{
$result = civicrm_api3('Address', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function address_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '17',
'location_type_id' => '15',
'postal_code' => '6971 BN',
'country_id' => '1152',
'manual_geo_code' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function address_getoptions_example() {
- $params = array(
+ $params = [
'field' => 'location_type_id',
- );
+ ];
try{
$result = civicrm_api3('Address', 'getoptions', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function address_getoptions_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 5,
- 'values' => array(
+ 'values' => [
'5' => 'Billing',
'1' => 'Home',
'3' => 'Main',
'4' => 'Other',
'2' => 'Work',
- ),
- );
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function batch_create_example() {
- $params = array(
+ $params = [
'name' => 'New_Batch_04',
'title' => 'New Batch 04',
'description' => 'This is description for New Batch 04',
'total' => '400.44',
'item_count' => 4,
'id' => 3,
- );
+ ];
try{
$result = civicrm_api3('Batch', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function batch_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'id' => '3',
'name' => 'New_Batch_04',
'title' => 'New Batch 04',
'payment_instrument_id' => '',
'exported_date' => '',
'data' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function batch_delete_example() {
- $params = array(
+ $params = [
'id' => 5,
- );
+ ];
try{
$result = civicrm_api3('Batch', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function batch_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function batch_get_example() {
- $params = array(
+ $params = [
'id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Batch', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function batch_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'name' => 'Batch_433397',
'title' => 'Batch_433397',
'modified_date' => '2012-11-14 16:02:35',
'status_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function batch_update_example() {
- $params = array(
+ $params = [
'name' => 'New_Batch_04',
'title' => 'New Batch 04',
'description' => 'This is description for New Batch 04',
'total' => '400.44',
'item_count' => 4,
'id' => 3,
- );
+ ];
try{
$result = civicrm_api3('batch', 'update', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'error' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function batch_update_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'id' => '3',
'name' => 'New_Batch_04',
'title' => 'New Batch 04',
'payment_instrument_id' => '',
'exported_date' => '',
'data' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function campaign_create_example() {
- $params = array(
+ $params = [
'title' => 'campaign title',
'description' => 'Call people, ask for money',
'created_date' => 'first sat of July 2008',
- );
+ ];
try{
$result = civicrm_api3('Campaign', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function campaign_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'name' => 'campaign_title',
'title' => 'campaign title',
'last_modified_date' => '',
'goal_general' => '',
'goal_revenue' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function campaign_delete_example() {
- $params = array(
+ $params = [
'id' => 3,
- );
+ ];
try{
$result = civicrm_api3('Campaign', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function campaign_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function campaign_get_example() {
- $params = array(
+ $params = [
'title' => 'campaign title',
'description' => 'Call people, ask for money',
'created_date' => 'first sat of July 2008',
- );
+ ];
try{
$result = civicrm_api3('Campaign', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function campaign_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'name' => 'campaign_title',
'title' => 'campaign title',
'description' => 'Call people, ask for money',
'is_active' => '1',
'created_date' => '2013-07-28 08:49:19',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function case_create_example() {
- $params = array(
+ $params = [
'subject' => 'Test case',
'contact_id' => 17,
'case_type' => 'housing_support',
- );
+ ];
try{
$result = civicrm_api3('Case', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function case_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'case_type_id' => '1',
'subject' => 'Test case',
'details' => '',
'status_id' => '1',
'is_deleted' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function case_contact_get_example() {
- $params = array(
+ $params = [
'contact_id' => 19,
- );
+ ];
try{
$result = civicrm_api3('CaseContact', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function case_contact_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'case_id' => '2',
'contact_id' => '19',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function constant_get_example() {
- $params = array(
+ $params = [
'name' => 'activityType',
- );
+ ];
try{
$result = civicrm_api3('Constant', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function constant_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 36,
- 'values' => array(
+ 'values' => [
'1' => 'Meeting',
'2' => 'Phone Call',
'3' => 'Email',
'52' => 'Contact Deleted by Merge',
'53' => 'Failed Payment',
'54' => 'Close Accounting Period',
- ),
+ ],
'deprecated' => 'The Constant api is deprecated as of CiviCRM 4.4. Please use the getoptions api action instead.',
- );
+ ];
return $expectedResult;
}
* API result array
*/
function contact_get_example() {
- $params = array(
+ $params = [
'id' => 3,
- 'api.website.get' => array(),
- 'api.Contribution.get' => array(
+ 'api.website.get' => [],
+ 'api.Contribution.get' => [
'total_amount' => '120.00',
- ),
+ ],
'api.CustomValue.get' => 1,
'api.Note.get' => 1,
- );
+ ];
try{
$result = civicrm_api3('Contact', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contact_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'contact_id' => '3',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'state_province' => '',
'country' => '',
'id' => '3',
- 'api.website.get' => array(
+ 'api.website.get' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '1',
'contact_id' => '3',
'url' => 'http://civicrm.org',
- ),
- ),
- ),
- 'api.Contribution.get' => array(
+ ],
+ ],
+ ],
+ 'api.Contribution.get' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'contact_id' => '3',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'instrument_id' => '1',
'id' => '2',
'contribution_type_id' => '1',
- ),
- ),
- ),
- 'api.CustomValue.get' => array(
+ ],
+ ],
+ ],
+ 'api.CustomValue.get' => [
'is_error' => 0,
'version' => 3,
'count' => 0,
- 'values' => array(),
- ),
- 'api.Note.get' => array(
+ 'values' => [],
+ ],
+ 'api.Note.get' => [
'is_error' => 0,
'version' => 3,
'count' => 0,
- 'values' => array(),
- ),
- ),
- ),
- );
+ 'values' => [],
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contact_get_example() {
- $params = array(
+ $params = [
'id' => 3,
- 'api.website.getValue' => array(
+ 'api.website.getValue' => [
'return' => 'url',
- ),
- 'api.Contribution.getCount' => array(),
+ ],
+ 'api.Contribution.getCount' => [],
'api.CustomValue.get' => 1,
'api.Note.get' => 1,
- 'api.Membership.getCount' => array(),
- );
+ 'api.Membership.getCount' => [],
+ ];
try{
$result = civicrm_api3('Contact', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contact_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'contact_id' => '3',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'id' => '3',
'api.website.getValue' => 'http://civicrm.org',
'api.Contribution.getCount' => 2,
- 'api.CustomValue.get' => array(
+ 'api.CustomValue.get' => [
'is_error' => 0,
'version' => 3,
'count' => 0,
- 'values' => array(),
- ),
- 'api.Note.get' => array(
+ 'values' => [],
+ ],
+ 'api.Note.get' => [
'is_error' => 0,
'version' => 3,
'count' => 0,
- 'values' => array(),
- ),
+ 'values' => [],
+ ],
'api.Membership.getCount' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contact_get_example() {
- $params = array(
+ $params = [
'id' => 3,
- 'api.website.getValue' => array(
+ 'api.website.getValue' => [
'return' => 'url',
- ),
- 'api.Contribution.getCount' => array(),
+ ],
+ 'api.Contribution.getCount' => [],
'api.CustomValue.get' => 1,
- );
+ ];
try{
$result = civicrm_api3('Contact', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contact_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'contact_id' => '3',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'id' => '3',
'api.website.getValue' => 'http://civicrm.org',
'api.Contribution.getCount' => 2,
- 'api.CustomValue.get' => array(
+ 'api.CustomValue.get' => [
'is_error' => 0,
'version' => 3,
'count' => 7,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'entity_id' => '3',
'entity_table' => 'Contact',
'latest' => 'value 4',
'id' => '1',
- ),
- '1' => array(
+ ],
+ '1' => [
'entity_id' => '3',
'entity_table' => 'Contact',
'latest' => 'value 3',
'id' => '2',
'1' => 'value 2',
'2' => 'value 3',
- ),
- '2' => array(
+ ],
+ '2' => [
'entity_id' => '3',
'entity_table' => 'Contact',
'latest' => '',
'id' => '3',
'1' => 'warm beer',
'2' => '',
- ),
- '3' => array(
+ ],
+ '3' => [
'entity_id' => '3',
'entity_table' => 'Contact',
'latest' => '',
'id' => '4',
'1' => '',
'2' => '',
- ),
- '4' => array(
+ ],
+ '4' => [
'entity_id' => '3',
'entity_table' => 'Contact',
'latest' => 'defaultValue',
'id' => '5',
'1' => 'defaultValue',
- ),
- '5' => array(
+ ],
+ '5' => [
'entity_id' => '3',
'entity_table' => 'Contact',
'latest' => 'vegemite',
'id' => '6',
'1' => 'vegemite',
- ),
- '6' => array(
+ ],
+ '6' => [
'entity_id' => '3',
'entity_table' => 'Contact',
'latest' => '',
'id' => '7',
'1' => '',
- ),
- ),
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contact_create_example() {
- $params = array(
+ $params = [
'display_name' => 'batman',
'contact_type' => 'Individual',
- 'api.tag.create' => array(
+ 'api.tag.create' => [
'name' => '$value.id',
'description' => '$value.display_name',
'format.only_id' => 1,
- ),
- 'api.entity_tag.create' => array(
+ ],
+ 'api.entity_tag.create' => [
'tag_id' => '$value.api.tag.create',
- ),
- );
+ ],
+ ];
try{
$result = civicrm_api3('Contact', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contact_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'id' => '3',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'created_date' => '2013-07-28 08:49:19',
'modified_date' => '2012-11-14 16:02:35',
'api.tag.create' => 6,
- 'api.entity_tag.create' => array(
+ 'api.entity_tag.create' => [
'is_error' => 0,
'not_added' => 1,
'added' => 1,
'total_count' => 2,
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contact_create_example() {
- $params = array(
+ $params = [
'first_name' => 'abc3',
'last_name' => 'xyz3',
'contact_type' => 'Individual',
'email' => 'man3@yahoo.com',
- 'api.contribution.create' => array(
+ 'api.contribution.create' => [
'receive_date' => '2010-01-01',
'total_amount' => '100',
'financial_type_id' => 1,
'invoice_id' => 67990,
'source' => 'SSF',
'contribution_status_id' => 1,
- ),
- 'api.website.create' => array(
+ ],
+ 'api.website.create' => [
'url' => 'http://civicrm.org',
- ),
- 'api.website.create.2' => array(
+ ],
+ 'api.website.create.2' => [
'url' => 'http://chained.org',
- ),
- );
+ ],
+ ];
try{
$result = civicrm_api3('Contact', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contact_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'id' => '3',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'user_unique_id' => '',
'created_date' => '2013-07-28 08:49:19',
'modified_date' => '2012-11-14 16:02:35',
- 'api.contribution.create' => array(
+ 'api.contribution.create' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '1',
'contact_id' => '3',
'financial_type_id' => '1',
'tax_amount' => '',
'revenue_recognition_date' => '',
'contribution_type_id' => '1',
- ),
- ),
- ),
- 'api.website.create' => array(
+ ],
+ ],
+ ],
+ 'api.website.create' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '1',
'contact_id' => '3',
'url' => 'http://civicrm.org',
'website_type_id' => '',
- ),
- ),
- ),
- 'api.website.create.2' => array(
+ ],
+ ],
+ ],
+ 'api.website.create.2' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '2',
'contact_id' => '3',
'url' => 'http://chained.org',
'website_type_id' => '',
- ),
- ),
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contact_create_example() {
- $params = array(
+ $params = [
'first_name' => 'abc3',
'last_name' => 'xyz3',
'contact_type' => 'Individual',
'email' => 'man3@yahoo.com',
- 'api.contribution.create' => array(
+ 'api.contribution.create' => [
'receive_date' => '2010-01-01',
'total_amount' => '100',
'financial_type_id' => 1,
'invoice_id' => 67890,
'source' => 'SSF',
'contribution_status_id' => 1,
- ),
- 'api.website.create' => array(
- '0' => array(
+ ],
+ 'api.website.create' => [
+ '0' => [
'url' => 'http://civicrm.org',
- ),
- '1' => array(
+ ],
+ '1' => [
'url' => 'http://chained.org',
'website_type_id' => 2,
- ),
- ),
- );
+ ],
+ ],
+ ];
try{
$result = civicrm_api3('Contact', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contact_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'id' => '3',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'user_unique_id' => '',
'created_date' => '2013-07-28 08:49:19',
'modified_date' => '2012-11-14 16:02:35',
- 'api.contribution.create' => array(
+ 'api.contribution.create' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '1',
'contact_id' => '3',
'financial_type_id' => '1',
'tax_amount' => '',
'revenue_recognition_date' => '',
'contribution_type_id' => '1',
- ),
- ),
- ),
- 'api.website.create' => array(
- '0' => array(
+ ],
+ ],
+ ],
+ 'api.website.create' => [
+ '0' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '1',
'contact_id' => '3',
'url' => 'http://civicrm.org',
'website_type_id' => '',
- ),
- ),
- ),
- '1' => array(
+ ],
+ ],
+ ],
+ '1' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '2',
'contact_id' => '3',
'url' => 'http://chained.org',
'website_type_id' => '2',
- ),
- ),
- ),
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contact_get_example() {
- $params = array(
+ $params = [
'id' => 'user_contact_id',
- );
+ ];
try{
$result = civicrm_api3('Contact', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contact_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'contact_id' => '3',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'state_province' => '',
'country' => '',
'id' => '3',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contact_create_example() {
- $params = array(
+ $params = [
'first_name' => 'abc1',
'contact_type' => 'Individual',
'last_name' => 'xyz1',
'custom_1' => 'custom string',
- );
+ ];
try{
$result = civicrm_api3('Contact', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contact_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'id' => '3',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'user_unique_id' => '',
'created_date' => '2013-07-28 08:49:19',
'modified_date' => '2012-11-14 16:02:35',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contact_create_example() {
- $params = array(
+ $params = [
'contact_type' => 'Individual',
'display_name' => 'dlobo',
- 'api.participant' => array(
+ 'api.participant' => [
'event_id' => 42,
'status_id' => 1,
'role_id' => 1,
'format.only_id' => 1,
- ),
- 'api.contribution.create' => array(
+ ],
+ 'api.contribution.create' => [
'financial_type_id' => 1,
'total_amount' => 100,
'format.only_id' => 1,
- ),
- 'api.participant_payment.create' => array(
+ ],
+ 'api.participant_payment.create' => [
'contribution_id' => '$value.api.contribution.create',
'participant_id' => '$value.api.participant',
- ),
- );
+ ],
+ ];
try{
$result = civicrm_api3('Contact', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contact_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 5,
- 'values' => array(
- '5' => array(
+ 'values' => [
+ '5' => [
'id' => '5',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'modified_date' => '2012-11-14 16:02:35',
'api.participant' => 4,
'api.contribution.create' => 1,
- 'api.participant_payment.create' => array(
+ 'api.participant_payment.create' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '1',
'participant_id' => '4',
'contribution_id' => '1',
- ),
- ),
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contact_get_example() {
- $params = array(
+ $params = [
'return.custom_1' => 1,
'id' => 3,
- );
+ ];
try{
$result = civicrm_api3('Contact', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contact_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'contact_id' => '3',
'civicrm_value_testgetwithcu_1_id' => '1',
'custom_1' => 'custom string',
'id' => '3',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contact_get_example() {
- $params = array(
+ $params = [
'return' => 'custom_1',
'id' => 3,
- );
+ ];
try{
$result = civicrm_api3('Contact', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contact_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'contact_id' => '3',
'civicrm_value_testgetwithcu_1_id' => '1',
'custom_1' => 'custom string',
'id' => '3',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contact_delete_example() {
- $params = array(
+ $params = [
'id' => 3,
- );
+ ];
try{
$result = civicrm_api3('Contact', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contact_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function contact_create_example() {
- $params = array(
+ $params = [
'id' => 500,
'format.is_success' => 1,
- );
+ ];
try{
$result = civicrm_api3('Contact', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
* API result array
*/
function contact_get_example() {
- $params = array(
+ $params = [
'id' => 17,
'format.is_success' => 1,
- );
+ ];
try{
$result = civicrm_api3('Contact', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
* API result array
*/
function contact_get_example() {
- $params = array(
+ $params = [
'id' => 17,
'format.only_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Contact', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
* API result array
*/
function contact_getvalue_example() {
- $params = array(
+ $params = [
'id' => 17,
'return' => 'display_name',
- );
+ ];
try{
$result = civicrm_api3('Contact', 'getvalue', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
* API result array
*/
function contact_get_example() {
- $params = array(
+ $params = [
'email' => 'man2@yahoo.com',
- );
+ ];
try{
$result = civicrm_api3('Contact', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contact_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'contact_id' => '3',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'state_province' => '',
'country' => '',
'id' => '3',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contact_getactions_example() {
- $params = array();
+ $params = [];
try{
$result = civicrm_api3('Contact', 'getactions', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contact_getactions_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 20,
- 'values' => array(
+ 'values' => [
'0' => 'create',
'1' => 'delete',
'2' => 'duplicatecheck',
'17' => 'setvalue',
'18' => 'update',
'19' => 'validate',
- ),
- 'deprecated' => array(
+ ],
+ 'deprecated' => [
'getquick' => 'The "getquick" action is deprecated in favor of "getlist".',
'setvalue' => 'The "setvalue" action is deprecated. Use "create" with an id instead.',
'update' => 'The "update" action is deprecated. Use "create" with an id instead.',
- ),
- );
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contact_getcount_example() {
- $params = array(
+ $params = [
'id' => 17,
- );
+ ];
try{
$result = civicrm_api3('Contact', 'getcount', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
* API result array
*/
function contact_getfields_example() {
- $params = array(
- 'options' => array(
+ $params = [
+ 'options' => [
'get_options' => 'custom_1',
- ),
+ ],
'action' => 'create',
- );
+ ];
try{
$result = civicrm_api3('Contact', 'getfields', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contact_getfields_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 55,
- 'values' => array(
- 'id' => array(
+ 'values' => [
+ 'id' => [
'name' => 'id',
'type' => 1,
'title' => 'Contact ID',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'api.aliases' => array(
+ 'api.aliases' => [
'0' => 'contact_id',
- ),
- ),
- 'contact_type' => array(
+ ],
+ ],
+ 'contact_type' => [
'name' => 'contact_type',
'type' => 2,
'title' => 'Contact Type',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Select',
'maxlength' => 64,
'size' => 30,
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'table' => 'civicrm_contact_type',
'keyColumn' => 'name',
'labelColumn' => 'label',
'condition' => 'parent_id IS NULL',
- ),
+ ],
'api.required' => 1,
- ),
- 'contact_sub_type' => array(
+ ],
+ 'contact_sub_type' => [
'name' => 'contact_sub_type',
'type' => 2,
'title' => 'Contact Subtype',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Select',
'maxlength' => 255,
'size' => 45,
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'table' => 'civicrm_contact_type',
'keyColumn' => 'name',
'labelColumn' => 'label',
'condition' => 'parent_id IS NOT NULL',
- ),
- ),
- 'do_not_email' => array(
+ ],
+ ],
+ 'do_not_email' => [
'name' => 'do_not_email',
'type' => 16,
'title' => 'Do Not Email',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'CheckBox',
- ),
- ),
- 'do_not_phone' => array(
+ ],
+ ],
+ 'do_not_phone' => [
'name' => 'do_not_phone',
'type' => 16,
'title' => 'Do Not Phone',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'CheckBox',
- ),
- ),
- 'do_not_mail' => array(
+ ],
+ ],
+ 'do_not_mail' => [
'name' => 'do_not_mail',
'type' => 16,
'title' => 'Do Not Mail',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'CheckBox',
- ),
- ),
- 'do_not_sms' => array(
+ ],
+ ],
+ 'do_not_sms' => [
'name' => 'do_not_sms',
'type' => 16,
'title' => 'Do Not Sms',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'CheckBox',
- ),
- ),
- 'do_not_trade' => array(
+ ],
+ ],
+ 'do_not_trade' => [
'name' => 'do_not_trade',
'type' => 16,
'title' => 'Do Not Trade',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'CheckBox',
- ),
- ),
- 'is_opt_out' => array(
+ ],
+ ],
+ 'is_opt_out' => [
'name' => 'is_opt_out',
'type' => 16,
'title' => 'No Bulk Emails (User Opt Out)',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'CheckBox',
- ),
- ),
- 'legal_identifier' => array(
+ ],
+ ],
+ 'legal_identifier' => [
'name' => 'legal_identifier',
'type' => 2,
'title' => 'Legal Identifier',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 32,
'size' => 20,
- ),
- ),
- 'external_identifier' => array(
+ ],
+ ],
+ 'external_identifier' => [
'name' => 'external_identifier',
'type' => 2,
'title' => 'External Identifier',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 64,
'size' => 8,
- ),
- ),
- 'sort_name' => array(
+ ],
+ ],
+ 'sort_name' => [
'name' => 'sort_name',
'type' => 2,
'title' => 'Sort Name',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 128,
'size' => 30,
- ),
- ),
- 'display_name' => array(
+ ],
+ ],
+ 'display_name' => [
'name' => 'display_name',
'type' => 2,
'title' => 'Display Name',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 128,
'size' => 30,
- ),
- ),
- 'nick_name' => array(
+ ],
+ ],
+ 'nick_name' => [
'name' => 'nick_name',
'type' => 2,
'title' => 'Nickname',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 128,
'size' => 30,
- ),
- ),
- 'legal_name' => array(
+ ],
+ ],
+ 'legal_name' => [
'name' => 'legal_name',
'type' => 2,
'title' => 'Legal Name',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 128,
'size' => 30,
- ),
- ),
- 'image_URL' => array(
+ ],
+ ],
+ 'image_URL' => [
'name' => 'image_URL',
'type' => 32,
'title' => 'Image Url',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'File',
'rows' => 2,
'cols' => 80,
- ),
- ),
- 'preferred_communication_method' => array(
+ ],
+ ],
+ 'preferred_communication_method' => [
'name' => 'preferred_communication_method',
'type' => 2,
'title' => 'Preferred Communication Method',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Select',
'maxlength' => 255,
'size' => 45,
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'optionGroupName' => 'preferred_communication_method',
'optionEditPath' => 'civicrm/admin/options/preferred_communication_method',
- ),
- ),
- 'preferred_language' => array(
+ ],
+ ],
+ 'preferred_language' => [
'name' => 'preferred_language',
'type' => 2,
'title' => 'Preferred Language',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Select',
'maxlength' => 5,
'size' => 6,
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'optionGroupName' => 'languages',
'keyColumn' => 'name',
'optionEditPath' => 'civicrm/admin/options/languages',
- ),
- ),
- 'preferred_mail_format' => array(
+ ],
+ ],
+ 'preferred_mail_format' => [
'name' => 'preferred_mail_format',
'type' => 2,
'title' => 'Preferred Mail Format',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Select',
'maxlength' => 8,
'size' => 8,
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'callback' => 'CRM_Core_SelectValues::pmf',
- ),
- ),
- 'hash' => array(
+ ],
+ ],
+ 'hash' => [
'name' => 'hash',
'type' => 2,
'title' => 'Contact Hash',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- ),
- 'api_key' => array(
+ ],
+ 'api_key' => [
'name' => 'api_key',
'type' => 2,
'title' => 'Api Key',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- ),
- 'first_name' => array(
+ ],
+ 'first_name' => [
'name' => 'first_name',
'type' => 2,
'title' => 'First Name',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 64,
'size' => 30,
- ),
- ),
- 'middle_name' => array(
+ ],
+ ],
+ 'middle_name' => [
'name' => 'middle_name',
'type' => 2,
'title' => 'Middle Name',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 64,
'size' => 30,
- ),
- ),
- 'last_name' => array(
+ ],
+ ],
+ 'last_name' => [
'name' => 'last_name',
'type' => 2,
'title' => 'Last Name',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 64,
'size' => 30,
- ),
- ),
- 'prefix_id' => array(
+ ],
+ ],
+ 'prefix_id' => [
'name' => 'prefix_id',
'type' => 1,
'title' => 'Individual Prefix',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Select',
'size' => 6,
'maxlength' => 14,
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'optionGroupName' => 'individual_prefix',
'optionEditPath' => 'civicrm/admin/options/individual_prefix',
- ),
- 'api.aliases' => array(
+ ],
+ 'api.aliases' => [
'0' => 'individual_prefix',
'1' => 'individual_prefix_id',
- ),
- ),
- 'suffix_id' => array(
+ ],
+ ],
+ 'suffix_id' => [
'name' => 'suffix_id',
'type' => 1,
'title' => 'Individual Suffix',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Select',
'size' => 6,
'maxlength' => 14,
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'optionGroupName' => 'individual_suffix',
'optionEditPath' => 'civicrm/admin/options/individual_suffix',
- ),
- 'api.aliases' => array(
+ ],
+ 'api.aliases' => [
'0' => 'individual_suffix',
'1' => 'individual_suffix_id',
- ),
- ),
- 'formal_title' => array(
+ ],
+ ],
+ 'formal_title' => [
'name' => 'formal_title',
'type' => 2,
'title' => 'Formal Title',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 64,
'size' => 30,
- ),
- ),
- 'communication_style_id' => array(
+ ],
+ ],
+ 'communication_style_id' => [
'name' => 'communication_style_id',
'type' => 1,
'title' => 'Communication Style',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Select',
'size' => 6,
'maxlength' => 14,
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'optionGroupName' => 'communication_style',
'optionEditPath' => 'civicrm/admin/options/communication_style',
- ),
- ),
- 'email_greeting_id' => array(
+ ],
+ ],
+ 'email_greeting_id' => [
'name' => 'email_greeting_id',
'type' => 1,
'title' => 'Email Greeting ID',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- ),
- 'email_greeting_custom' => array(
+ ],
+ 'email_greeting_custom' => [
'name' => 'email_greeting_custom',
'type' => 2,
'title' => 'Email Greeting Custom',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 128,
'size' => 45,
- ),
- ),
- 'email_greeting_display' => array(
+ ],
+ ],
+ 'email_greeting_display' => [
'name' => 'email_greeting_display',
'type' => 2,
'title' => 'Email Greeting',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 255,
'size' => 45,
- ),
- ),
- 'postal_greeting_id' => array(
+ ],
+ ],
+ 'postal_greeting_id' => [
'name' => 'postal_greeting_id',
'type' => 1,
'title' => 'Postal Greeting ID',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'size' => 6,
'maxlength' => 14,
- ),
- ),
- 'postal_greeting_custom' => array(
+ ],
+ ],
+ 'postal_greeting_custom' => [
'name' => 'postal_greeting_custom',
'type' => 2,
'title' => 'Postal Greeting Custom',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 128,
'size' => 45,
- ),
- ),
- 'postal_greeting_display' => array(
+ ],
+ ],
+ 'postal_greeting_display' => [
'name' => 'postal_greeting_display',
'type' => 2,
'title' => 'Postal Greeting',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 255,
'size' => 45,
- ),
- ),
- 'addressee_id' => array(
+ ],
+ ],
+ 'addressee_id' => [
'name' => 'addressee_id',
'type' => 1,
'title' => 'Addressee ID',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- ),
- 'addressee_custom' => array(
+ ],
+ 'addressee_custom' => [
'name' => 'addressee_custom',
'type' => 2,
'title' => 'Addressee Custom',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 128,
'size' => 45,
- ),
- ),
- 'addressee_display' => array(
+ ],
+ ],
+ 'addressee_display' => [
'name' => 'addressee_display',
'type' => 2,
'title' => 'Addressee',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 255,
'size' => 45,
- ),
- ),
- 'job_title' => array(
+ ],
+ ],
+ 'job_title' => [
'name' => 'job_title',
'type' => 2,
'title' => 'Job Title',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 255,
'size' => 30,
- ),
- ),
- 'gender_id' => array(
+ ],
+ ],
+ 'gender_id' => [
'name' => 'gender_id',
'type' => 1,
'title' => 'Gender',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Select',
'size' => 6,
'maxlength' => 14,
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'optionGroupName' => 'gender',
'optionEditPath' => 'civicrm/admin/options/gender',
- ),
- 'api.aliases' => array(
+ ],
+ 'api.aliases' => [
'0' => 'gender',
- ),
- ),
- 'birth_date' => array(
+ ],
+ ],
+ 'birth_date' => [
'name' => 'birth_date',
'type' => 4,
'title' => 'Birth Date',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Select Date',
'format' => 'birth',
- ),
- ),
- 'is_deceased' => array(
+ ],
+ ],
+ 'is_deceased' => [
'name' => 'is_deceased',
'type' => 16,
'title' => 'Deceased',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'CheckBox',
- ),
- ),
- 'deceased_date' => array(
+ ],
+ ],
+ 'deceased_date' => [
'name' => 'deceased_date',
'type' => 4,
'title' => 'Deceased Date',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Select Date',
'format' => 'birth',
- ),
- ),
- 'household_name' => array(
+ ],
+ ],
+ 'household_name' => [
'name' => 'household_name',
'type' => 2,
'title' => 'Household Name',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 128,
'size' => 30,
- ),
- ),
- 'primary_contact_id' => array(
+ ],
+ ],
+ 'primary_contact_id' => [
'name' => 'primary_contact_id',
'type' => 1,
'title' => 'Household Primary Contact ID',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
'FKClassName' => 'CRM_Contact_DAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Select',
'size' => 6,
'maxlength' => 14,
- ),
+ ],
'FKApiName' => 'Contact',
- ),
- 'organization_name' => array(
+ ],
+ 'organization_name' => [
'name' => 'organization_name',
'type' => 2,
'title' => 'Organization Name',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 128,
'size' => 30,
- ),
- ),
- 'sic_code' => array(
+ ],
+ ],
+ 'sic_code' => [
'name' => 'sic_code',
'type' => 2,
'title' => 'Sic Code',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 8,
'size' => 8,
- ),
- ),
- 'user_unique_id' => array(
+ ],
+ ],
+ 'user_unique_id' => [
'name' => 'user_unique_id',
'type' => 2,
'title' => 'Unique ID (OpenID)',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 255,
'size' => 45,
- ),
- ),
- 'created_date' => array(
+ ],
+ ],
+ 'created_date' => [
'name' => 'created_date',
'type' => 256,
'title' => 'Created Date',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- ),
- 'modified_date' => array(
+ ],
+ 'modified_date' => [
'name' => 'modified_date',
'type' => 256,
'title' => 'Modified Date',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- ),
- 'source' => array(
+ ],
+ 'source' => [
'name' => 'source',
'type' => 2,
'title' => 'Contact Source',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 255,
'size' => 30,
- ),
+ ],
'uniqueName' => 'contact_source',
- ),
- 'employer_id' => array(
+ ],
+ 'employer_id' => [
'name' => 'employer_id',
'type' => 1,
'title' => 'Current Employer',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
'FKClassName' => 'CRM_Contact_DAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'EntityRef',
'size' => 6,
'maxlength' => 14,
- ),
+ ],
'uniqueName' => 'current_employer_id',
'FKApiName' => 'Contact',
- ),
- 'is_deleted' => array(
+ ],
+ 'is_deleted' => [
'name' => 'is_deleted',
'type' => 16,
'title' => 'Contact is in Trash',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'CheckBox',
- ),
+ ],
'uniqueName' => 'contact_is_deleted',
- ),
- 'custom_1' => array(
+ ],
+ 'custom_1' => [
'label' => 'Our special field',
'groupTitle' => 'select_test_g',
'data_type' => 'String',
'is_required' => '1',
'table_name' => 'civicrm_value_select_test_g_1',
'column_name' => 'our_special_field_1',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'optionGroupName' => 'our_special_field_20170207021937',
'optionEditPath' => 'civicrm/admin/options/our_special_field_20170207021937',
- ),
+ ],
'name' => 'custom_1',
'title' => 'Our special field',
'type' => 2,
- 'options' => array(
+ 'options' => [
'1' => 'Label1',
'2' => 'Label2',
- ),
- ),
- 'current_employer' => array(
+ ],
+ ],
+ 'current_employer' => [
'title' => 'Current Employer',
'description' => 'Name of Current Employer',
'type' => 2,
'name' => 'current_employer',
- ),
- 'dupe_check' => array(
+ ],
+ 'dupe_check' => [
'title' => 'Check for Duplicates',
'description' => 'Throw error if contact create matches dedupe rule',
'type' => 16,
'name' => 'dupe_check',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contact_getoptions_example() {
- $params = array(
+ $params = [
'field' => 'custom_1',
- );
+ ];
try{
$result = civicrm_api3('Contact', 'getoptions', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contact_getoptions_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 2,
- 'values' => array(
+ 'values' => [
'1' => 'Label1',
'2' => 'Label2',
- ),
- );
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contact_getsingle_example() {
- $params = array(
+ $params = [
'id' => 17,
- );
+ ];
try{
$result = civicrm_api3('Contact', 'getsingle', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contact_getsingle_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'contact_id' => '17',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'state_province' => '',
'country' => '',
'id' => '17',
- );
+ ];
return $expectedResult;
}
* API result array
*/
function contact_get_example() {
- $params = array(
- 'group' => array(
- 'IN' => array(
+ $params = [
+ 'group' => [
+ 'IN' => [
'0' => 'Test group C',
'1' => 'Test group D',
- ),
- ),
- );
+ ],
+ ],
+ ];
try{
$result = civicrm_api3('Contact', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contact_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'contact_id' => '3',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'state_province' => '',
'country' => '',
'id' => '3',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contact_get_example() {
- $params = array(
+ $params = [
'id' => 10,
- 'api.email.replace' => array(
- 'values' => array(
- '0' => array(
+ 'api.email.replace' => [
+ 'values' => [
+ '0' => [
'location_type_id' => 20,
'email' => '1-1@example.com',
'is_primary' => 1,
- ),
- '1' => array(
+ ],
+ '1' => [
'location_type_id' => 20,
'email' => '1-2@example.com',
'is_primary' => 0,
- ),
- '2' => array(
+ ],
+ '2' => [
'location_type_id' => 20,
'email' => '1-3@example.com',
'is_primary' => 0,
- ),
- '3' => array(
+ ],
+ '3' => [
'location_type_id' => 21,
'email' => '2-1@example.com',
'is_primary' => 0,
- ),
- '4' => array(
+ ],
+ '4' => [
'location_type_id' => 21,
'email' => '2-2@example.com',
'is_primary' => 0,
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
try{
$result = civicrm_api3('Contact', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contact_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 10,
- 'values' => array(
- '10' => array(
+ 'values' => [
+ '10' => [
'contact_id' => '10',
'contact_type' => 'Organization',
'contact_sub_type' => '',
'state_province' => '',
'country' => '',
'id' => '10',
- 'api.email.replace' => array(
+ 'api.email.replace' => [
'is_error' => 0,
'version' => 3,
'count' => 5,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '18',
'contact_id' => '10',
'location_type_id' => '20',
'reset_date' => '',
'signature_text' => '',
'signature_html' => '',
- ),
- '1' => array(
+ ],
+ '1' => [
'id' => '19',
'contact_id' => '10',
'location_type_id' => '20',
'reset_date' => '',
'signature_text' => '',
'signature_html' => '',
- ),
- '2' => array(
+ ],
+ '2' => [
'id' => '20',
'contact_id' => '10',
'location_type_id' => '20',
'reset_date' => '',
'signature_text' => '',
'signature_html' => '',
- ),
- '3' => array(
+ ],
+ '3' => [
'id' => '21',
'contact_id' => '10',
'location_type_id' => '21',
'reset_date' => '',
'signature_text' => '',
'signature_html' => '',
- ),
- '4' => array(
+ ],
+ '4' => [
'id' => '22',
'contact_id' => '10',
'location_type_id' => '21',
'reset_date' => '',
'signature_text' => '',
'signature_html' => '',
- ),
- ),
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contribution_create_example() {
- $params = array(
+ $params = [
'contact_id' => 28,
'receive_date' => '20120511',
'total_amount' => '100',
'source' => 'SSF',
'contribution_status_id' => 1,
'honor_contact_id' => 29,
- );
+ ];
try{
$result = civicrm_api3('Contribution', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contribution_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '28',
'financial_type_id' => '1',
'tax_amount' => '',
'revenue_recognition_date' => '',
'contribution_type_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contribution_create_example() {
- $params = array(
+ $params = [
'contact_id' => 22,
'receive_date' => '2012-01-01',
'total_amount' => '100',
'source' => 'SSF',
'contribution_status_id' => 1,
'note' => 'my contribution note',
- );
+ ];
try{
$result = civicrm_api3('Contribution', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contribution_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '22',
'financial_type_id' => '1',
'tax_amount' => '',
'revenue_recognition_date' => '',
'contribution_type_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contribution_create_example() {
- $params = array(
+ $params = [
'contact_id' => 24,
'receive_date' => '20120511',
'total_amount' => '100',
'net_amount' => '95',
'source' => 'SSF',
'contribution_status_id' => 1,
- 'soft_credit' => array(
- '1' => array(
+ 'soft_credit' => [
+ '1' => [
'contact_id' => 25,
'amount' => 50,
'soft_credit_type_id' => 3,
- ),
- ),
- );
+ ],
+ ],
+ ];
try{
$result = civicrm_api3('Contribution', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contribution_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '24',
'financial_type_id' => '1',
'tax_amount' => '',
'revenue_recognition_date' => '',
'contribution_type_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contribution_create_example() {
- $params = array(
+ $params = [
'contact_id' => 26,
'receive_date' => '20120511',
'total_amount' => '100',
'source' => 'SSF',
'contribution_status_id' => 1,
'soft_credit_to' => 27,
- );
+ ];
try{
$result = civicrm_api3('Contribution', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contribution_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '26',
'financial_type_id' => '1',
'tax_amount' => '',
'revenue_recognition_date' => '',
'contribution_type_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contribution_create_example() {
- $params = array(
+ $params = [
'contact_id' => 1,
'receive_date' => '20120511',
'total_amount' => '100',
'invoice_id' => 67890,
'source' => 'SSF',
'contribution_status_id' => 2,
- );
+ ];
try{
$result = civicrm_api3('Contribution', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contribution_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '1',
'financial_type_id' => '1',
'revenue_recognition_date' => '',
'contribution_type_id' => '1',
'invoice_number' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contribution_create_example() {
- $params = array(
+ $params = [
'contact_id' => 11,
'receive_date' => '20120511',
'total_amount' => '100',
'source' => 'SSF',
'contribution_status_id' => 1,
'skipLineItem' => 1,
- 'api.line_item.create' => array(
- '0' => array(
+ 'api.line_item.create' => [
+ '0' => [
'price_field_id' => 1,
'qty' => 2,
'line_total' => '20',
'unit_price' => '10',
- ),
- '1' => array(
+ ],
+ '1' => [
'price_field_id' => 1,
'qty' => 1,
'line_total' => '80',
'unit_price' => '80',
- ),
- ),
- );
+ ],
+ ],
+ ];
try{
$result = civicrm_api3('Contribution', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contribution_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '11',
'financial_type_id' => '1',
'tax_amount' => 0,
'revenue_recognition_date' => '',
'contribution_type_id' => '1',
- 'api.line_item.create' => array(
- '0' => array(
+ 'api.line_item.create' => [
+ '0' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '1',
'entity_table' => 'civicrm_contribution',
'entity_id' => '1',
'financial_type_id' => '',
'non_deductible_amount' => '',
'tax_amount' => '',
- ),
- ),
- ),
- '1' => array(
+ ],
+ ],
+ ],
+ '1' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '2',
'entity_table' => 'civicrm_contribution',
'entity_id' => '1',
'financial_type_id' => '',
'non_deductible_amount' => '',
'tax_amount' => '',
- ),
- ),
- ),
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contribution_delete_example() {
- $params = array(
+ $params = [
'id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Contribution', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contribution_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
+ 'values' => [
'1' => 1,
- ),
- );
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contribution_get_example() {
- $params = array(
+ $params = [
'contribution_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Contribution', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contribution_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'contact_id' => '3',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'check_number' => '',
'id' => '1',
'contribution_type_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contribution_page_create_example() {
- $params = array(
+ $params = [
'title' => 'Test Contribution Page',
'financial_type_id' => 1,
'currency' => 'NZD',
'is_email_receipt' => TRUE,
'receipt_from_email' => 'yourconscience@donate.com',
'receipt_from_name' => 'Ego Freud',
- );
+ ];
try{
$result = civicrm_api3('ContributionPage', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contribution_page_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'title' => 'Test Contribution Page',
'intro_text' => '',
'campaign_id' => '',
'is_share' => '',
'is_billing_required' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contribution_page_delete_example() {
- $params = array(
+ $params = [
'id' => 1,
- );
+ ];
try{
$result = civicrm_api3('ContributionPage', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contribution_page_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function contribution_page_get_example() {
- $params = array(
+ $params = [
'currency' => 'NZD',
'financial_type_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('ContributionPage', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contribution_page_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'title' => 'Test Contribution Page',
'financial_type_id' => '1',
'is_share' => '1',
'is_billing_required' => 0,
'contribution_type_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contribution_page_submit_example() {
- $params = array(
+ $params = [
'id' => 1,
- 'pledge_amount' => array(
+ 'pledge_amount' => [
'2' => 1,
- ),
+ ],
'billing_first_name' => 'Billy',
'billing_middle_name' => 'Goat',
'billing_last_name' => 'Gruff',
'payment_processor_id' => 1,
'credit_card_number' => '4111111111111111',
'credit_card_type' => 'Visa',
- 'credit_card_exp_date' => array(
+ 'credit_card_exp_date' => [
'M' => 9,
'Y' => 2040,
- ),
+ ],
'cvv2' => 123,
'pledge_id' => '1',
'cid' => '83',
'amount' => '100',
'is_pledge' => TRUE,
'pledge_block_id' => 2,
- );
+ ];
try{
$result = civicrm_api3('ContributionPage', 'submit', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contribution_page_submit_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 0,
'values' => '',
- );
+ ];
return $expectedResult;
}
* API result array
*/
function contribution_recur_create_example() {
- $params = array(
+ $params = [
'contact_id' => 3,
'installments' => '12',
'frequency_interval' => '1',
'start_date' => '2012-01-01 00:00:00',
'currency' => 'USD',
'frequency_unit' => 'day',
- );
+ ];
try{
$result = civicrm_api3('ContributionRecur', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contribution_recur_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '3',
'amount' => '500',
'payment_instrument_id' => '',
'campaign_id' => '',
'is_email_receipt' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contribution_recur_delete_example() {
- $params = array(
+ $params = [
'id' => 4,
- );
+ ];
try{
$result = civicrm_api3('ContributionRecur', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contribution_recur_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function contribution_recur_get_example() {
- $params = array(
+ $params = [
'amount' => '500',
- );
+ ];
try{
$result = civicrm_api3('ContributionRecur', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contribution_recur_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'contact_id' => '4',
'amount' => '500.00',
'failure_count' => 0,
'auto_renew' => 0,
'is_email_receipt' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contribution_soft_create_example() {
- $params = array(
+ $params = [
'contribution_id' => 6,
'contact_id' => 19,
'amount' => '10',
'currency' => 'USD',
'soft_credit_type_id' => 5,
- );
+ ];
try{
$result = civicrm_api3('ContributionSoft', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contribution_soft_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 5,
- 'values' => array(
- '5' => array(
+ 'values' => [
+ '5' => [
'id' => '5',
'contribution_id' => '6',
'contact_id' => '19',
'pcp_roll_nickname' => '',
'pcp_personal_note' => '',
'soft_credit_type_id' => '5',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function contribution_soft_delete_example() {
- $params = array(
+ $params = [
'id' => 7,
- );
+ ];
try{
$result = civicrm_api3('ContributionSoft', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
* API result array
*/
function contribution_soft_get_example() {
- $params = array(
+ $params = [
'id' => 1,
- );
+ ];
try{
$result = civicrm_api3('ContributionSoft', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function contribution_soft_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contribution_id' => '1',
'contact_id' => '4',
'currency' => 'USD',
'pcp_display_in_roll' => 0,
'soft_credit_type_id' => '4',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function country_create_example() {
- $params = array(
+ $params = [
'name' => 'Made Up Land',
'iso_code' => 'ZZ',
'region_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Country', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function country_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1254,
- 'values' => array(
- '1254' => array(
+ 'values' => [
+ '1254' => [
'id' => '1254',
'name' => 'Made Up Land',
'iso_code' => 'ZZ',
'ndd_prefix' => '',
'region_id' => '1',
'is_province_abbreviated' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function country_delete_example() {
- $params = array(
+ $params = [
'id' => 1255,
- );
+ ];
try{
$result = civicrm_api3('Country', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function country_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function country_get_example() {
- $params = array(
+ $params = [
'iso_code' => 'ZZ',
- );
+ ];
try{
$result = civicrm_api3('Country', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function country_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1256,
- 'values' => array(
- '1256' => array(
+ 'values' => [
+ '1256' => [
'id' => '1256',
'name' => 'Made Up Land',
'iso_code' => 'ZZ',
'region_id' => '1',
'is_province_abbreviated' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function custom_field_create_example() {
- $params = array(
+ $params = [
'custom_group_id' => 1,
'name' => 'test_textfield2',
'label' => 'Name1',
'is_required' => 1,
'is_searchable' => 0,
'is_active' => 1,
- );
+ ];
try{
$result = civicrm_api3('CustomField', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function custom_field_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'custom_group_id' => '1',
'name' => 'test_textfield2',
'option_group_id' => '',
'filter' => '',
'in_selector' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function custom_field_delete_example() {
- $params = array(
+ $params = [
'id' => 1,
- );
+ ];
try{
$result = civicrm_api3('CustomField', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function custom_field_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function custom_group_create_example() {
- $params = array(
+ $params = [
'title' => 'Test_Group_1',
'name' => 'test_group_1',
- 'extends' => array(
+ 'extends' => [
'0' => 'Individual',
- ),
+ ],
'weight' => 4,
'collapse_display' => 1,
'style' => 'Inline',
'help_pre' => 'This is Pre Help For Test Group 1',
'help_post' => 'This is Post Help For Test Group 1',
'is_active' => 1,
- );
+ ];
try{
$result = civicrm_api3('CustomGroup', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function custom_group_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'name' => 'test_group_1',
'title' => 'Test_Group_1',
'created_id' => '',
'created_date' => '',
'is_reserved' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function custom_group_delete_example() {
- $params = array(
+ $params = [
'id' => 1,
- );
+ ];
try{
$result = civicrm_api3('CustomGroup', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function custom_group_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function custom_group_get_example() {
- $params = array();
+ $params = [];
try{
$result = civicrm_api3('CustomGroup', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function custom_group_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'name' => 'test_group_1',
'title' => 'Test_Group_1',
'is_multiple' => 0,
'collapse_adv_display' => 0,
'is_reserved' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function custom_value_create_example() {
- $params = array(
+ $params = [
'custom_1' => 'customString',
'entity_id' => 3,
- );
+ ];
try{
$result = civicrm_api3('CustomValue', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'error' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function custom_value_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => TRUE,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function custom_value_get_example() {
- $params = array(
+ $params = [
'id' => 2,
'entity_id' => 2,
'format.field_names' => 1,
- );
+ ];
try{
$result = civicrm_api3('CustomValue', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'error' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function custom_value_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 7,
- 'values' => array(
- 'mySingleField' => array(
+ 'values' => [
+ 'mySingleField' => [
'entity_id' => '2',
'latest' => 'value 1',
'id' => 'mySingleField',
- ),
- 'field_12' => array(
+ ],
+ 'field_12' => [
'entity_id' => '2',
'latest' => 'value 3',
'id' => 'field_12',
'1' => 'value 2',
'2' => 'value 3',
- ),
- 'field_22' => array(
+ ],
+ 'field_22' => [
'entity_id' => '2',
'latest' => '',
'id' => 'field_22',
'1' => 'warm beer',
'2' => '',
- ),
- 'field_32' => array(
+ ],
+ 'field_32' => [
'entity_id' => '2',
'latest' => '',
'id' => 'field_32',
'1' => 'fl* w*',
'2' => '',
- ),
- 'field_13' => array(
+ ],
+ 'field_13' => [
'entity_id' => '2',
'latest' => 'coffee',
'id' => 'field_13',
'1' => 'defaultValue',
'2' => 'coffee',
- ),
- 'field_23' => array(
+ ],
+ 'field_23' => [
'entity_id' => '2',
'latest' => 'value 4',
'id' => 'field_23',
'1' => '',
'2' => 'value 4',
- ),
- 'field_33' => array(
+ ],
+ 'field_33' => [
'entity_id' => '2',
'latest' => '',
'id' => 'field_33',
'1' => 'vegemite',
'2' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function custom_value_get_example() {
- $params = array(
+ $params = [
'id' => 2,
'entity_id' => 2,
- );
+ ];
try{
$result = civicrm_api3('CustomValue', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'error' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function custom_value_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 7,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'entity_id' => '2',
'latest' => 'value 1',
'id' => '1',
- ),
- '2' => array(
+ ],
+ '2' => [
'entity_id' => '2',
'latest' => 'value 3',
'id' => '2',
'1' => 'value 2',
'2' => 'value 3',
- ),
- '3' => array(
+ ],
+ '3' => [
'entity_id' => '2',
'latest' => '',
'id' => '3',
'1' => 'warm beer',
'2' => '',
- ),
- '4' => array(
+ ],
+ '4' => [
'entity_id' => '2',
'latest' => '',
'id' => '4',
'1' => 'fl* w*',
'2' => '',
- ),
- '5' => array(
+ ],
+ '5' => [
'entity_id' => '2',
'latest' => 'coffee',
'id' => '5',
'1' => 'defaultValue',
'2' => 'coffee',
- ),
- '6' => array(
+ ],
+ '6' => [
'entity_id' => '2',
'latest' => 'value 4',
'id' => '6',
'1' => '',
'2' => 'value 4',
- ),
- '7' => array(
+ ],
+ '7' => [
'entity_id' => '2',
'latest' => '',
'id' => '7',
'1' => 'vegemite',
'2' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function domain_create_example() {
- $params = array(
+ $params = [
'name' => 'A-team domain',
'description' => 'domain of chaos',
'domain_version' => '4.2',
'contact_id' => 6,
- );
+ ];
try{
$result = civicrm_api3('Domain', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function domain_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'id' => '3',
'name' => 'A-team domain',
'description' => 'domain of chaos',
'locales' => '',
'locale_custom_strings' => '',
'domain_version' => '4.2',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function domain_get_example() {
- $params = array(
+ $params = [
'sequential' => 1,
- );
+ ];
try{
$result = civicrm_api3('Domain', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function domain_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 2,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '1',
'name' => 'Default Domain Name',
'version' => '4.6.alpha1',
'contact_id' => '3',
'locale_custom_strings' => 'a:1:{s:5:\"en_US\";a:0:{}}',
'domain_email' => 'my@email.com',
- 'domain_phone' => array(
+ 'domain_phone' => [
'phone_type' => 'Phone',
'phone' => '456-456',
- ),
- 'domain_address' => array(
+ ],
+ 'domain_address' => [
'street_address' => '45 Penny Lane',
'supplemental_address_1' => '',
'supplemental_address_2' => '',
'country_id' => '',
'geo_code_1' => '',
'geo_code_2' => '',
- ),
+ ],
'from_email' => 'info@EXAMPLE.ORG',
'from_name' => 'FIXME',
'domain_version' => '4.6.alpha1',
- ),
- '1' => array(
+ ],
+ '1' => [
'id' => '2',
'name' => 'Second Domain',
'version' => '4.6.alpha1',
'contact_id' => '2',
'domain_email' => '\"Domain Email\" <domainemail2@example.org>',
- 'domain_phone' => array(
+ 'domain_phone' => [
'phone_type' => 'Phone',
'phone' => '204 555-1001',
- ),
- 'domain_address' => array(
+ ],
+ 'domain_address' => [
'street_address' => '15 Main St',
'supplemental_address_1' => '',
'supplemental_address_2' => '',
'country_id' => '1228',
'geo_code_1' => '41.8328',
'geo_code_2' => '-72.9253',
- ),
+ ],
'from_email' => 'info@EXAMPLE.ORG',
'from_name' => 'FIXME',
'domain_version' => '4.6.alpha1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function email_create_example() {
- $params = array(
+ $params = [
'contact_id' => 3,
'location_type_id' => 6,
'email' => 'api@a-team.com',
'is_primary' => 1,
- );
+ ];
try{
$result = civicrm_api3('Email', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function email_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'id' => '3',
'contact_id' => '3',
'location_type_id' => '6',
'reset_date' => '',
'signature_text' => '',
'signature_html' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function email_delete_example() {
- $params = array(
+ $params = [
'id' => 11,
- );
+ ];
try{
$result = civicrm_api3('Email', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function email_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function email_replace_example() {
- $params = array(
+ $params = [
'contact_id' => 9,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'location_type_id' => 18,
'email' => '1-1@example.com',
'is_primary' => 1,
- ),
- '1' => array(
+ ],
+ '1' => [
'location_type_id' => 18,
'email' => '1-2@example.com',
'is_primary' => 0,
- ),
- '2' => array(
+ ],
+ '2' => [
'location_type_id' => 18,
'email' => '1-3@example.com',
'is_primary' => 0,
- ),
- '3' => array(
+ ],
+ '3' => [
'location_type_id' => 19,
'email' => '2-1@example.com',
'is_primary' => 0,
- ),
- '4' => array(
+ ],
+ '4' => [
'location_type_id' => 19,
'email' => '2-2@example.com',
'is_primary' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
try{
$result = civicrm_api3('Email', 'replace', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function email_replace_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 5,
- 'values' => array(
- '12' => array(
+ 'values' => [
+ '12' => [
'id' => '12',
'contact_id' => '9',
'location_type_id' => '18',
'reset_date' => '',
'signature_text' => '',
'signature_html' => '',
- ),
- '13' => array(
+ ],
+ '13' => [
'id' => '13',
'contact_id' => '9',
'location_type_id' => '18',
'reset_date' => '',
'signature_text' => '',
'signature_html' => '',
- ),
- '14' => array(
+ ],
+ '14' => [
'id' => '14',
'contact_id' => '9',
'location_type_id' => '18',
'reset_date' => '',
'signature_text' => '',
'signature_html' => '',
- ),
- '15' => array(
+ ],
+ '15' => [
'id' => '15',
'contact_id' => '9',
'location_type_id' => '19',
'reset_date' => '',
'signature_text' => '',
'signature_html' => '',
- ),
- '16' => array(
+ ],
+ '16' => [
'id' => '16',
'contact_id' => '9',
'location_type_id' => '19',
'reset_date' => '',
'signature_text' => '',
'signature_html' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function entity_batch_create_example() {
- $params = array(
+ $params = [
'entity_id' => 1,
'batch_id' => 1,
'entity_table' => 'civicrm_financial_trxn',
- );
+ ];
try{
$result = civicrm_api3('EntityBatch', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function entity_batch_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'entity_table' => 'civicrm_financial_trxn',
'entity_id' => '1',
'batch_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function entity_batch_delete_example() {
- $params = array(
+ $params = [
'id' => 3,
- );
+ ];
try{
$result = civicrm_api3('EntityBatch', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function entity_batch_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function entity_batch_get_example() {
- $params = array(
+ $params = [
'entity_id' => 2,
'batch_id' => 2,
'entity_table' => 'civicrm_financial_trxn',
- );
+ ];
try{
$result = civicrm_api3('EntityBatch', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function entity_batch_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'entity_table' => 'civicrm_financial_trxn',
'entity_id' => '2',
'batch_id' => '2',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function entity_tag_create_example() {
- $params = array(
+ $params = [
'contact_id' => 3,
'tag_id' => '6',
- );
+ ];
try{
$result = civicrm_api3('EntityTag', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'error' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function entity_tag_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'not_added' => 0,
'added' => 1,
'total_count' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function entity_tag_delete_example() {
- $params = array(
+ $params = [
'contact_id_h' => 31,
'tag_id' => '15',
- );
+ ];
try{
$result = civicrm_api3('EntityTag', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function entity_tag_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'not_removed' => 0,
'removed' => 1,
'total_count' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function entity_tag_get_example() {
- $params = array(
+ $params = [
'contact_id' => 15,
- );
+ ];
try{
$result = civicrm_api3('EntityTag', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function entity_tag_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 5,
- 'values' => array(
- '5' => array(
+ 'values' => [
+ '5' => [
'id' => '5',
'entity_table' => 'civicrm_contact',
'entity_id' => '15',
'tag_id' => '10',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function event_get_example() {
- $params = array(
+ $params = [
'return.custom_2' => 1,
'custom_2' => 4,
- );
+ ];
try{
$result = civicrm_api3('Event', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function event_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'id' => '3',
'title' => 'My test event.',
'event_title' => 'My test event.',
'custom_1' => 'defaultValue',
'custom_2_id' => '4',
'custom_2' => 'Contact, Test',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function event_create_example() {
- $params = array(
+ $params = [
'title' => 'Annual CiviCRM meet',
'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now',
'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues',
'is_monetary' => 0,
'is_active' => 1,
'is_show_location' => 0,
- );
+ ];
try{
$result = civicrm_api3('Event', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function event_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'id' => '3',
'title' => 'Annual CiviCRM meet',
'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now',
'slot_label_id' => '',
'dedupe_rule_group_id' => '',
'is_billing_required' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function event_delete_example() {
- $params = array(
+ $params = [
'id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Event', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function event_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function event_get_example() {
- $params = array(
+ $params = [
'event_title' => 'Annual CiviCRM meet',
'sequential' => TRUE,
- );
+ ];
try{
$result = civicrm_api3('Event', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function event_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '1',
'title' => 'Annual CiviCRM meet',
'event_title' => 'Annual CiviCRM meet',
'is_share' => '1',
'is_confirm_enabled' => '1',
'is_billing_required' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function event_get_example() {
- $params = array(
+ $params = [
'isCurrent' => 1,
- );
+ ];
try{
$result = civicrm_api3('Event', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function event_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'id' => '3',
'title' => 'Annual CiviCRM meet 2',
'event_title' => 'Annual CiviCRM meet 2',
'is_share' => '1',
'is_confirm_enabled' => '1',
'is_billing_required' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function event_getsingle_example() {
- $params = array(
+ $params = [
'id' => 1,
'return.is_full' => 1,
- );
+ ];
try{
$result = civicrm_api3('Event', 'getsingle', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function event_getsingle_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'id' => '1',
'title' => 'Annual CiviCRM meet',
'event_title' => 'Annual CiviCRM meet',
'is_billing_required' => 0,
'available_places' => 0,
'is_full' => '1',
- );
+ ];
return $expectedResult;
}
* API result array
*/
function grant_create_example() {
- $params = array(
+ $params = [
'contact_id' => 3,
'application_received_date' => 'now',
'decision_date' => 'next Monday',
'rationale' => 'Just Because',
'currency' => 'USD',
'grant_type_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Grant', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function grant_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '3',
'application_received_date' => '20130728084957',
'rationale' => 'Just Because',
'status_id' => '1',
'financial_type_id' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function grant_delete_example() {
- $params = array(
+ $params = [
'id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Grant', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function grant_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function grant_get_example() {
- $params = array(
+ $params = [
'rationale' => 'Just Because',
- );
+ ];
try{
$result = civicrm_api3('Grant', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function grant_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '5',
'application_received_date' => '20130728084957',
'currency' => 'USD',
'rationale' => 'Just Because',
'status_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function group_get_example() {
- $params = array(
+ $params = [
'name' => 'Test Group 1',
- );
+ ];
try{
$result = civicrm_api3('Group', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function group_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 4,
- 'values' => array(
- '4' => array(
+ 'values' => [
+ '4' => [
'id' => '4',
'name' => 'Test Group 1',
'title' => 'New Test Group Created',
'where_clause' => ' ( `civicrm_group_contact-4`.group_id IN ( 4 ) ) ',
'select_tables' => 'a:8:{s:15:\"civicrm_contact\";i:1;s:15:\"civicrm_address\";i:1;s:15:\"civicrm_country\";i:1;s:13:\"civicrm_email\";i:1;s:13:\"civicrm_phone\";i:1;s:10:\"civicrm_im\";i:1;s:19:\"civicrm_worldregion\";i:1;s:25:\"`civicrm_group_contact-4`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-4` ON (contact_a.id = `civicrm_group_contact-4`.contact_id AND `civicrm_group_contact-4`.status IN (\'Added\'))\";}',
'where_tables' => 'a:2:{s:15:\"civicrm_contact\";i:1;s:25:\"`civicrm_group_contact-4`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-4` ON (contact_a.id = `civicrm_group_contact-4`.contact_id AND `civicrm_group_contact-4`.status IN (\'Added\'))\";}',
- 'group_type' => array(
+ 'group_type' => [
'0' => '1',
'1' => '2',
- ),
+ ],
'is_hidden' => 0,
'is_reserved' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function group_getfields_example() {
- $params = array(
+ $params = [
'action' => 'create',
- );
+ ];
try{
$result = civicrm_api3('Group', 'getfields', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function group_getfields_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 20,
- 'values' => array(
- 'id' => array(
+ 'values' => [
+ 'id' => [
'name' => 'id',
'type' => 1,
'title' => 'Group ID',
'table_name' => 'civicrm_group',
'entity' => 'Group',
'bao' => 'CRM_Contact_BAO_Group',
- 'api.aliases' => array(
+ 'api.aliases' => [
'0' => 'group_id',
- ),
- ),
- 'name' => array(
+ ],
+ ],
+ 'name' => [
'name' => 'name',
'type' => 2,
'title' => 'Group Name',
'table_name' => 'civicrm_group',
'entity' => 'Group',
'bao' => 'CRM_Contact_BAO_Group',
- ),
- 'title' => array(
+ ],
+ 'title' => [
'name' => 'title',
'type' => 2,
'title' => 'Group Title',
'entity' => 'Group',
'bao' => 'CRM_Contact_BAO_Group',
'api.required' => 1,
- ),
- 'description' => array(
+ ],
+ 'description' => [
'name' => 'description',
'type' => 32,
'title' => 'Group Description',
'table_name' => 'civicrm_group',
'entity' => 'Group',
'bao' => 'CRM_Contact_BAO_Group',
- 'html' => array(
+ 'html' => [
'type' => 'TextArea',
'rows' => 2,
'cols' => 60,
- ),
- ),
- 'source' => array(
+ ],
+ ],
+ 'source' => [
'name' => 'source',
'type' => 2,
'title' => 'Group Source',
'table_name' => 'civicrm_group',
'entity' => 'Group',
'bao' => 'CRM_Contact_BAO_Group',
- ),
- 'saved_search_id' => array(
+ ],
+ 'saved_search_id' => [
'name' => 'saved_search_id',
'type' => 1,
'title' => 'Saved Search ID',
'bao' => 'CRM_Contact_BAO_Group',
'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
'FKApiName' => 'SavedSearch',
- ),
- 'is_active' => array(
+ ],
+ 'is_active' => [
'name' => 'is_active',
'type' => 16,
'title' => 'Group Enabled',
'entity' => 'Group',
'bao' => 'CRM_Contact_BAO_Group',
'api.default' => 1,
- ),
- 'visibility' => array(
+ ],
+ 'visibility' => [
'name' => 'visibility',
'type' => 2,
'title' => 'Group Visibility Setting',
'table_name' => 'civicrm_group',
'entity' => 'Group',
'bao' => 'CRM_Contact_BAO_Group',
- 'html' => array(
+ 'html' => [
'type' => 'Select',
'maxlength' => 24,
'size' => 20,
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'callback' => 'CRM_Core_SelectValues::groupVisibility',
- ),
- ),
- 'where_clause' => array(
+ ],
+ ],
+ 'where_clause' => [
'name' => 'where_clause',
'type' => 32,
'title' => 'Group Where Clause',
'table_name' => 'civicrm_group',
'entity' => 'Group',
'bao' => 'CRM_Contact_BAO_Group',
- ),
- 'select_tables' => array(
+ ],
+ 'select_tables' => [
'name' => 'select_tables',
'type' => 32,
'title' => 'Tables For Select Clause',
'table_name' => 'civicrm_group',
'entity' => 'Group',
'bao' => 'CRM_Contact_BAO_Group',
- ),
- 'where_tables' => array(
+ ],
+ 'where_tables' => [
'name' => 'where_tables',
'type' => 32,
'title' => 'Tables For Where Clause',
'table_name' => 'civicrm_group',
'entity' => 'Group',
'bao' => 'CRM_Contact_BAO_Group',
- ),
- 'group_type' => array(
+ ],
+ 'group_type' => [
'name' => 'group_type',
'type' => 2,
'title' => 'Group Type',
'table_name' => 'civicrm_group',
'entity' => 'Group',
'bao' => 'CRM_Contact_BAO_Group',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'optionGroupName' => 'group_type',
'optionEditPath' => 'civicrm/admin/options/group_type',
- ),
- ),
- 'cache_date' => array(
+ ],
+ ],
+ 'cache_date' => [
'name' => 'cache_date',
'type' => 256,
'title' => 'Group Cache Date',
'table_name' => 'civicrm_group',
'entity' => 'Group',
'bao' => 'CRM_Contact_BAO_Group',
- ),
- 'refresh_date' => array(
+ ],
+ 'refresh_date' => [
'name' => 'refresh_date',
'type' => 256,
'title' => 'Next Group Refresh Time',
'table_name' => 'civicrm_group',
'entity' => 'Group',
'bao' => 'CRM_Contact_BAO_Group',
- ),
- 'parents' => array(
+ ],
+ 'parents' => [
'name' => 'parents',
'type' => 32,
'title' => 'Group Parents',
'table_name' => 'civicrm_group',
'entity' => 'Group',
'bao' => 'CRM_Contact_BAO_Group',
- ),
- 'children' => array(
+ ],
+ 'children' => [
'name' => 'children',
'type' => 32,
'title' => 'Group Children',
'table_name' => 'civicrm_group',
'entity' => 'Group',
'bao' => 'CRM_Contact_BAO_Group',
- ),
- 'is_hidden' => array(
+ ],
+ 'is_hidden' => [
'name' => 'is_hidden',
'type' => 16,
'title' => 'Group is Hidden',
'table_name' => 'civicrm_group',
'entity' => 'Group',
'bao' => 'CRM_Contact_BAO_Group',
- ),
- 'is_reserved' => array(
+ ],
+ 'is_reserved' => [
'name' => 'is_reserved',
'type' => 16,
'title' => 'Group is Reserved',
'table_name' => 'civicrm_group',
'entity' => 'Group',
'bao' => 'CRM_Contact_BAO_Group',
- ),
- 'created_id' => array(
+ ],
+ 'created_id' => [
'name' => 'created_id',
'type' => 1,
'title' => 'Group Created By',
'bao' => 'CRM_Contact_BAO_Group',
'FKClassName' => 'CRM_Contact_DAO_Contact',
'FKApiName' => 'Contact',
- ),
- 'modified_id' => array(
+ ],
+ 'modified_id' => [
'name' => 'modified_id',
'type' => 1,
'title' => 'Group Modified By',
'bao' => 'CRM_Contact_BAO_Group',
'FKClassName' => 'CRM_Contact_DAO_Contact',
'FKApiName' => 'Contact',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function group_contact_create_example() {
- $params = array(
+ $params = [
'contact_id' => 8,
'contact_id.2' => 9,
'group_id' => 11,
- );
+ ];
try{
$result = civicrm_api3('GroupContact', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function group_contact_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'total_count' => 2,
'added' => 1,
'not_added' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function group_contact_delete_example() {
- $params = array(
+ $params = [
'id' => 9,
'skip_undelete' => TRUE,
- );
+ ];
try{
$result = civicrm_api3('GroupContact', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function group_contact_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'total_count' => 1,
'removed' => 0,
'not_removed' => 0,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function group_contact_get_example() {
- $params = array(
+ $params = [
'contact_id' => 3,
- );
+ ];
try{
$result = civicrm_api3('GroupContact', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function group_contact_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'group_id' => '1',
'title' => 'New Test Group Created',
'is_hidden' => 0,
'in_date' => '2013-07-28 08:50:19',
'in_method' => 'API',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function group_contact_get_example() {
- $params = array(
+ $params = [
'group_id' => 3,
'api.group.get' => 1,
'sequential' => 1,
- );
+ ];
try{
$result = civicrm_api3('GroupContact', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function group_contact_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '2',
'group_id' => '3',
'contact_id' => '4',
'status' => 'Added',
- 'api.group.get' => array(
+ 'api.group.get' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '3',
'name' => 'Test Group 1',
'title' => 'New Test Group Created',
'where_clause' => ' ( `civicrm_group_contact-3`.group_id IN ( 3 ) ) ',
'select_tables' => 'a:8:{s:15:\"civicrm_contact\";i:1;s:15:\"civicrm_address\";i:1;s:15:\"civicrm_country\";i:1;s:13:\"civicrm_email\";i:1;s:13:\"civicrm_phone\";i:1;s:10:\"civicrm_im\";i:1;s:19:\"civicrm_worldregion\";i:1;s:25:\"`civicrm_group_contact-3`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-3` ON (contact_a.id = `civicrm_group_contact-3`.contact_id AND `civicrm_group_contact-3`.status IN (\'Added\'))\";}',
'where_tables' => 'a:2:{s:15:\"civicrm_contact\";i:1;s:25:\"`civicrm_group_contact-3`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-3` ON (contact_a.id = `civicrm_group_contact-3`.contact_id AND `civicrm_group_contact-3`.status IN (\'Added\'))\";}',
- 'group_type' => array(
+ 'group_type' => [
'0' => '1',
'1' => '2',
- ),
+ ],
'is_hidden' => 0,
'is_reserved' => 0,
- ),
- ),
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function group_nesting_create_example() {
- $params = array(
+ $params = [
'parent_group_id' => 1,
'child_group_id' => 3,
- );
+ ];
try{
$result = civicrm_api3('GroupNesting', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function group_nesting_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 'is_error',
- 'values' => array(
+ 'values' => [
'is_error' => 0,
- ),
- );
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function group_nesting_delete_example() {
- $params = array(
+ $params = [
'id' => 1,
- );
+ ];
try{
$result = civicrm_api3('GroupNesting', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function group_nesting_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function group_nesting_get_example() {
- $params = array(
+ $params = [
'parent_group_id' => 1,
'child_group_id' => 2,
- );
+ ];
try{
$result = civicrm_api3('GroupNesting', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function group_nesting_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'child_group_id' => '2',
'parent_group_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function group_organization_create_example() {
- $params = array(
+ $params = [
'organization_id' => 8,
'group_id' => 6,
- );
+ ];
try{
$result = civicrm_api3('GroupOrganization', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function group_organization_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 3,
'id' => 3,
- 'values' => array(
+ 'values' => [
'id' => '3',
'group_id' => '6',
'organization_id' => '8',
- ),
- );
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function group_organization_delete_example() {
- $params = array(
+ $params = [
'id' => 5,
- );
+ ];
try{
$result = civicrm_api3('GroupOrganization', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function group_organization_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 'Deleted Group Organization successfully',
- );
+ ];
return $expectedResult;
}
* API result array
*/
function group_organization_get_example() {
- $params = array(
+ $params = [
'organization_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('GroupOrganization', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function group_organization_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 0,
- 'values' => array(),
- );
+ 'values' => [],
+ ];
return $expectedResult;
}
* API result array
*/
function im_create_example() {
- $params = array(
+ $params = [
'contact_id' => 3,
'name' => 'My Yahoo IM Handle',
'location_type_id' => 1,
'provider_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Im', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function im_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '3',
'location_type_id' => '1',
'provider_id' => '1',
'is_primary' => '',
'is_billing' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function im_delete_example() {
- $params = array(
+ $params = [
'id' => 3,
- );
+ ];
try{
$result = civicrm_api3('Im', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function im_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function im_get_example() {
- $params = array(
+ $params = [
'contact_id' => 4,
'name' => 'My Yahoo IM Handle',
'location_type_id' => 1,
'provider_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Im', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function im_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'contact_id' => '4',
'location_type_id' => '1',
'provider_id' => '1',
'is_primary' => 0,
'is_billing' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function job_create_example() {
- $params = array(
+ $params = [
'sequential' => 1,
'name' => 'API_Test_Job',
'description' => 'A long description written by hand in cursive',
'api_action' => 'apitestaction',
'parameters' => 'Semi-formal explanation of runtime job parameters',
'is_active' => 1,
- );
+ ];
try{
$result = civicrm_api3('Job', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function job_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 30,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '30',
'domain_id' => '1',
'run_frequency' => 'Daily',
'api_action' => 'apitestaction',
'parameters' => 'Semi-formal explanation of runtime job parameters',
'is_active' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function job_delete_example() {
- $params = array(
+ $params = [
'id' => 31,
- );
+ ];
try{
$result = civicrm_api3('Job', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
* API result array
*/
function line_item_create_example() {
- $params = array(
+ $params = [
'price_field_value_id' => 1,
'price_field_id' => 1,
'entity_table' => 'civicrm_contribution',
'unit_price' => 50,
'line_total' => 50,
'debug' => 1,
- );
+ ];
try{
$result = civicrm_api3('LineItem', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function line_item_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'entity_table' => 'civicrm_contribution',
'entity_id' => '1',
'financial_type_id' => '',
'non_deductible_amount' => '',
'tax_amount' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function line_item_delete_example() {
- $params = array(
+ $params = [
'id' => 4,
- );
+ ];
try{
$result = civicrm_api3('LineItem', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function line_item_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function line_item_get_example() {
- $params = array(
+ $params = [
'entity_table' => 'civicrm_contribution',
- );
+ ];
try{
$result = civicrm_api3('LineItem', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function line_item_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'id' => '3',
'entity_table' => 'civicrm_contribution',
'entity_id' => '2',
'financial_type_id' => '1',
'non_deductible_amount' => '0.00',
'contribution_type_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function loc_block_create_example() {
- $params = array(
+ $params = [
'address_id' => 2,
'phone_id' => 2,
'email_id' => 3,
- );
+ ];
try{
$result = civicrm_api3('LocBlock', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function loc_block_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'address_id' => '2',
'email_id' => '3',
'email_2_id' => '',
'phone_2_id' => '',
'im_2_id' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function loc_block_create_example() {
- $params = array(
- 'email' => array(
+ $params = [
+ 'email' => [
'location_type_id' => 1,
'email' => 'test2@loc.block',
- ),
- 'phone' => array(
+ ],
+ 'phone' => [
'location_type_id' => 1,
'phone' => '987654321',
- ),
- 'phone_2' => array(
+ ],
+ 'phone_2' => [
'location_type_id' => 1,
'phone' => '456-7890',
- ),
- 'address' => array(
+ ],
+ 'address' => [
'location_type_id' => 1,
'street_address' => '987654321',
- ),
- );
+ ],
+ ];
try{
$result = civicrm_api3('LocBlock', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function loc_block_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
- 'address' => array(
+ 'values' => [
+ '3' => [
+ 'address' => [
'id' => '3',
'location_type_id' => '1',
'is_primary' => 0,
'is_billing' => 0,
'street_address' => '987654321',
'manual_geo_code' => 0,
- ),
- 'email' => array(
+ ],
+ 'email' => [
'id' => '4',
'contact_id' => '',
'location_type_id' => '1',
'reset_date' => '',
'signature_text' => '',
'signature_html' => '',
- ),
- 'phone' => array(
+ ],
+ 'phone' => [
'id' => '3',
'contact_id' => '',
'location_type_id' => '1',
'phone_ext' => '',
'phone_numeric' => '',
'phone_type_id' => '',
- ),
- 'phone_2' => array(
+ ],
+ 'phone_2' => [
'id' => '4',
'contact_id' => '',
'location_type_id' => '1',
'phone_ext' => '',
'phone_numeric' => '',
'phone_type_id' => '',
- ),
+ ],
'id' => '3',
'address_id' => '3',
'email_id' => '4',
'email_2_id' => '',
'phone_2_id' => '4',
'im_2_id' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function loc_block_get_example() {
- $params = array(
+ $params = [
'id' => 3,
'return' => 'all',
- );
+ ];
try{
$result = civicrm_api3('LocBlock', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function loc_block_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'id' => '3',
'address_id' => '3',
'email_id' => '4',
'phone_id' => '3',
'phone_2_id' => '4',
- 'address' => array(
+ 'address' => [
'id' => '3',
'location_type_id' => '1',
'is_primary' => 0,
'is_billing' => 0,
'street_address' => '987654321',
'manual_geo_code' => 0,
- ),
- 'email' => array(
+ ],
+ 'email' => [
'id' => '4',
'location_type_id' => '1',
'email' => 'test2@loc.block',
'is_billing' => 0,
'on_hold' => 0,
'is_bulkmail' => 0,
- ),
- 'phone' => array(
+ ],
+ 'phone' => [
'id' => '3',
'location_type_id' => '1',
'is_primary' => 0,
'is_billing' => 0,
'phone' => '987654321',
'phone_numeric' => '987654321',
- ),
- 'phone_2' => array(
+ ],
+ 'phone_2' => [
'id' => '4',
'location_type_id' => '1',
'is_primary' => 0,
'is_billing' => 0,
'phone' => '456-7890',
'phone_numeric' => '4567890',
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function logging_get_example() {
- $params = array(
+ $params = [
'log_conn_id' => 'wooty wop wop',
- );
+ ];
try{
$result = civicrm_api3('Logging', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function logging_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 17,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'action' => 'Update',
'id' => '3',
'field' => 'sort_name',
'table' => 'civicrm_contact',
'log_date' => '2017-02-07 02:36:46',
'log_conn_id' => 'wooty wop wop',
- ),
- '1' => array(
+ ],
+ '1' => [
'action' => 'Update',
'id' => '3',
'field' => 'display_name',
'table' => 'civicrm_contact',
'log_date' => '2017-02-07 02:36:46',
'log_conn_id' => 'wooty wop wop',
- ),
- '2' => array(
+ ],
+ '2' => [
'action' => 'Update',
'id' => '3',
'field' => 'first_name',
'table' => 'civicrm_contact',
'log_date' => '2017-02-07 02:36:46',
'log_conn_id' => 'wooty wop wop',
- ),
- '3' => array(
+ ],
+ '3' => [
'action' => 'Update',
'id' => '3',
'field' => 'last_name',
'table' => 'civicrm_contact',
'log_date' => '2017-02-07 02:36:46',
'log_conn_id' => 'wooty wop wop',
- ),
- '4' => array(
+ ],
+ '4' => [
'action' => 'Update',
'id' => '3',
'field' => 'modified_date',
'table' => 'civicrm_contact',
'log_date' => '2017-02-07 02:36:46',
'log_conn_id' => 'wooty wop wop',
- ),
- '5' => array(
+ ],
+ '5' => [
'action' => 'Insert',
'id' => '2',
'field' => 'id',
'table' => 'civicrm_email',
'log_date' => '2017-02-07 02:36:46',
'log_conn_id' => 'wooty wop wop',
- ),
- '6' => array(
+ ],
+ '6' => [
'action' => 'Insert',
'id' => '2',
'field' => 'contact_id',
'table' => 'civicrm_email',
'log_date' => '2017-02-07 02:36:46',
'log_conn_id' => 'wooty wop wop',
- ),
- '7' => array(
+ ],
+ '7' => [
'action' => 'Insert',
'id' => '2',
'field' => 'location_type_id',
'table' => 'civicrm_email',
'log_date' => '2017-02-07 02:36:46',
'log_conn_id' => 'wooty wop wop',
- ),
- '8' => array(
+ ],
+ '8' => [
'action' => 'Insert',
'id' => '2',
'field' => 'email',
'table' => 'civicrm_email',
'log_date' => '2017-02-07 02:36:46',
'log_conn_id' => 'wooty wop wop',
- ),
- '9' => array(
+ ],
+ '9' => [
'action' => 'Insert',
'id' => '2',
'field' => 'is_primary',
'table' => 'civicrm_email',
'log_date' => '2017-02-07 02:36:46',
'log_conn_id' => 'wooty wop wop',
- ),
- '10' => array(
+ ],
+ '10' => [
'action' => 'Insert',
'id' => '2',
'field' => 'is_billing',
'table' => 'civicrm_email',
'log_date' => '2017-02-07 02:36:46',
'log_conn_id' => 'wooty wop wop',
- ),
- '11' => array(
+ ],
+ '11' => [
'action' => 'Insert',
'id' => '2',
'field' => 'on_hold',
'table' => 'civicrm_email',
'log_date' => '2017-02-07 02:36:46',
'log_conn_id' => 'wooty wop wop',
- ),
- '12' => array(
+ ],
+ '12' => [
'action' => 'Insert',
'id' => '2',
'field' => 'is_bulkmail',
'table' => 'civicrm_email',
'log_date' => '2017-02-07 02:36:46',
'log_conn_id' => 'wooty wop wop',
- ),
- '13' => array(
+ ],
+ '13' => [
'action' => 'Insert',
'id' => '2',
'field' => 'hold_date',
'table' => 'civicrm_email',
'log_date' => '2017-02-07 02:36:46',
'log_conn_id' => 'wooty wop wop',
- ),
- '14' => array(
+ ],
+ '14' => [
'action' => 'Insert',
'id' => '2',
'field' => 'reset_date',
'table' => 'civicrm_email',
'log_date' => '2017-02-07 02:36:46',
'log_conn_id' => 'wooty wop wop',
- ),
- '15' => array(
+ ],
+ '15' => [
'action' => 'Insert',
'id' => '2',
'field' => 'signature_text',
'table' => 'civicrm_email',
'log_date' => '2017-02-07 02:36:46',
'log_conn_id' => 'wooty wop wop',
- ),
- '16' => array(
+ ],
+ '16' => [
'action' => 'Insert',
'id' => '2',
'field' => 'signature_html',
'table' => 'civicrm_email',
'log_date' => '2017-02-07 02:36:46',
'log_conn_id' => 'wooty wop wop',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function logging_revert_example() {
- $params = array(
+ $params = [
'log_conn_id' => 'woot',
'log_date' => '2017-02-07 02:35:06',
- );
+ ];
try{
$result = civicrm_api3('Logging', 'revert', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function logging_revert_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function mail_settings_get_example() {
- $params = array(
+ $params = [
'title' => 'MailSettings title',
'api.MailSettings.delete' => 1,
- );
+ ];
try{
$result = civicrm_api3('MailSettings', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function mail_settings_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 2,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'domain_id' => '1',
'name' => 'default',
'is_default' => 0,
'domain' => 'EXAMPLE.ORG',
- 'api.MailSettings.delete' => array(
+ 'api.MailSettings.delete' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- ),
- ),
- '6' => array(
+ ],
+ ],
+ '6' => [
'id' => '6',
'domain_id' => '1',
'name' => 'my mail setting',
'username' => 'sue',
'password' => 'pass',
'is_ssl' => 0,
- 'api.MailSettings.delete' => array(
+ 'api.MailSettings.delete' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function mail_settings_create_example() {
- $params = array(
+ $params = [
'domain_id' => 1,
'name' => 'my mail setting',
'domain' => 'setting.com',
'username' => 'sue',
'password' => 'pass',
'is_default' => 1,
- );
+ ];
try{
$result = civicrm_api3('MailSettings', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function mail_settings_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 5,
- 'values' => array(
- '5' => array(
+ 'values' => [
+ '5' => [
'id' => '5',
'domain_id' => '1',
'name' => 'my mail setting',
'password' => 'pass',
'is_ssl' => '',
'source' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function mail_settings_delete_example() {
- $params = array(
+ $params = [
'id' => 5,
- );
+ ];
try{
$result = civicrm_api3('MailSettings', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function mail_settings_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function mail_settings_get_example() {
- $params = array(
+ $params = [
'domain_id' => 1,
'name' => 'my mail setting',
'domain' => 'setting.com',
'username' => 'sue',
'password' => 'pass',
'is_default' => 1,
- );
+ ];
try{
$result = civicrm_api3('MailSettings', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function mail_settings_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 4,
- 'values' => array(
- '4' => array(
+ 'values' => [
+ '4' => [
'id' => '4',
'domain_id' => '1',
'name' => 'my mail setting',
'username' => 'sue',
'password' => 'pass',
'is_ssl' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function mail_settings_getoptions_example() {
- $params = array(
+ $params = [
'field' => 'protocol',
- );
+ ];
try{
$result = civicrm_api3('MailSettings', 'getoptions', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function mail_settings_getoptions_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 4,
- 'values' => array(
+ 'values' => [
'1' => 'IMAP',
'2' => 'Maildir',
'3' => 'POP3',
'4' => 'Localdir',
- ),
- );
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function mailing_clone_example() {
- $params = array(
+ $params = [
'id' => 21,
- );
+ ];
try{
$result = civicrm_api3('Mailing', 'clone', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function mailing_clone_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 22,
- 'values' => array(
- '22' => array(
+ 'values' => [
+ '22' => [
'id' => '22',
'domain_id' => '1',
'header_id' => '1',
'location_type_id' => '',
'email_selection_method' => 'automatic',
'language' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function mailing_create_example() {
- $params = array(
+ $params = [
'subject' => 'Hello {contact.display_name}',
'body_text' => 'This is {contact.display_name}.
https://civicrm.org
'created_id' => 3,
'header_id' => '',
'footer_id' => '',
- 'groups' => array(
- 'include' => array(
+ 'groups' => [
+ 'include' => [
'0' => 2,
- ),
- 'exclude' => array(
+ ],
+ 'exclude' => [
'0' => 3,
- ),
- ),
- 'mailings' => array(
- 'include' => array(),
- 'exclude' => array(),
- ),
- 'options' => array(
+ ],
+ ],
+ 'mailings' => [
+ 'include' => [],
+ 'exclude' => [],
+ ],
+ 'options' => [
'force_rollback' => 1,
- ),
+ ],
'api.mailing_job.create' => 1,
- 'api.MailingRecipients.get' => array(
+ 'api.MailingRecipients.get' => [
'mailing_id' => '$value.id',
- 'api.contact.getvalue' => array(
+ 'api.contact.getvalue' => [
'return' => 'display_name',
- ),
- 'api.email.getvalue' => array(
+ ],
+ 'api.email.getvalue' => [
'return' => 'email',
- ),
- ),
- );
+ ],
+ ],
+ ];
try{
$result = civicrm_api3('Mailing', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function mailing_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'domain_id' => '1',
'header_id' => '',
'location_type_id' => '',
'email_selection_method' => '',
'language' => '',
- 'api.mailing_job.create' => array(
+ 'api.mailing_job.create' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '1',
'mailing_id' => '1',
'scheduled_date' => '20130728085413',
'parent_id' => '',
'job_offset' => '',
'job_limit' => '',
- ),
- ),
- ),
- 'api.MailingRecipients.get' => array(
+ ],
+ ],
+ ],
+ 'api.MailingRecipients.get' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '1',
'mailing_id' => '1',
'contact_id' => '4',
'email_id' => '4',
'api.contact.getvalue' => 'Mr. Includer Person II',
'api.email.getvalue' => 'include.me@example.org',
- ),
- ),
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function mailing_delete_example() {
- $params = array(
+ $params = [
'id' => 20,
- );
+ ];
try{
$result = civicrm_api3('Mailing', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function mailing_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function mailing_gettokens_example() {
- $params = array(
- 'entity' => array(
+ $params = [
+ 'entity' => [
'0' => 'Contact',
'1' => 'Mailing',
- ),
- );
+ ],
+ ];
try{
$result = civicrm_api3('Mailing', 'gettokens', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function mailing_gettokens_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 82,
- 'values' => array(
+ 'values' => [
'{action.unsubscribe}' => 'Unsubscribe via email',
'{action.unsubscribeUrl}' => 'Unsubscribe via web page',
'{action.resubscribe}' => 'Resubscribe via email',
'{contact.url}' => 'Website',
'{contact.checksum}' => 'Checksum',
'{contact.contact_id}' => 'Internal Contact ID',
- ),
- );
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function mailing_submit_example() {
- $params = array(
+ $params = [
'scheduled_date' => '2014-12-13 10:00:00',
'approval_date' => '2014-12-13 00:00:00',
'id' => 18,
- );
+ ];
try{
$result = civicrm_api3('Mailing', 'submit', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function mailing_submit_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 18,
- 'values' => array(
- '18' => array(
+ 'values' => [
+ '18' => [
'id' => '18',
'domain_id' => '1',
'header_id' => '',
'location_type_id' => '',
'email_selection_method' => 'automatic',
'language' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function mailing_a_b_create_example() {
- $params = array(
+ $params = [
'mailing_id_a' => 1,
'mailing_id_b' => 2,
'mailing_id_c' => 3,
'winner_criteria' => 'open',
'declare_winning_time' => '+2 days',
'group_percentage' => 10,
- );
+ ];
try{
$result = civicrm_api3('MailingAB', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function mailing_a_b_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'name' => '',
'status' => '',
'group_percentage' => '10',
'created_id' => '3',
'created_date' => '2013-07-28 08:49:19',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function mailing_event_subscribe_create_example() {
- $params = array(
+ $params = [
'email' => 'test@test.test',
'group_id' => 2,
'contact_id' => 3,
'hash' => 'b15de8b64e2cec34',
'time_stamp' => '20101212121212',
- );
+ ];
try{
$result = civicrm_api3('MailingEventSubscribe', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function mailing_event_subscribe_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'contact_id' => '3',
'subscribe_id' => '1',
'hash' => '67eac7789eaee00',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function mailing_group_subscribe_example() {
- $params = array(
+ $params = [
'email' => 'test@test.test',
'group_id' => 2,
'contact_id' => 3,
'hash' => 'b15de8b64e2cec34',
'time_stamp' => '20101212121212',
- );
+ ];
try{
$result = civicrm_api3('mailing_group', 'subscribe', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'error' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function mailing_group_subscribe_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'contact_id' => '3',
'subscribe_id' => '1',
'hash' => '67eac7789eaee00',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function mapping_create_example() {
- $params = array(
+ $params = [
'name' => 'Mapping name',
'description' => 'Mapping description',
'mapping_type_id' => 7,
- );
+ ];
try{
$result = civicrm_api3('Mapping', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function mapping_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'name' => 'Mapping name',
'description' => 'Mapping description',
'mapping_type_id' => '7',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function mapping_delete_example() {
- $params = array(
+ $params = [
'id' => 3,
- );
+ ];
try{
$result = civicrm_api3('Mapping', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function mapping_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function mapping_get_example() {
- $params = array(
+ $params = [
'name' => 'Mapping name',
'description' => 'Mapping description',
'mapping_type_id' => 7,
- );
+ ];
try{
$result = civicrm_api3('Mapping', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function mapping_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'name' => 'Mapping name',
'description' => 'Mapping description',
'mapping_type_id' => '7',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function mapping_field_create_example() {
- $params = array(
+ $params = [
'mapping_id' => 1,
'name' => 'last_name',
'contact_type' => 'Individual',
'column_number' => 2,
'grouping' => 1,
- );
+ ];
try{
$result = civicrm_api3('MappingField', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function mapping_field_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'mapping_id' => '1',
'name' => 'last_name',
'grouping' => '1',
'operator' => '',
'value' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function mapping_field_delete_example() {
- $params = array(
+ $params = [
'id' => 3,
- );
+ ];
try{
$result = civicrm_api3('MappingField', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function mapping_field_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function mapping_field_get_example() {
- $params = array(
+ $params = [
'mapping_id' => 2,
'name' => 'last_name',
'contact_type' => 'Individual',
'column_number' => 2,
'grouping' => 1,
- );
+ ];
try{
$result = civicrm_api3('MappingField', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function mapping_field_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'mapping_id' => '2',
'name' => 'last_name',
'contact_type' => 'Individual',
'column_number' => '2',
'grouping' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function membership_create_example() {
- $params = array(
+ $params = [
'contact_id' => 79,
'membership_type_id' => 47,
'join_date' => '2006-01-21',
'source' => 'Payment',
'is_override' => 1,
'status_id' => 30,
- );
+ ];
try{
$result = civicrm_api3('Membership', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function membership_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '79',
'membership_type_id' => '47',
'is_pay_later' => '',
'contribution_recur_id' => '',
'campaign_id' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function membership_create_example() {
- $params = array(
+ $params = [
'contact_id' => 91,
'membership_type_id' => 55,
'join_date' => '2009-01-21',
'is_override' => 1,
'status_id' => 34,
'custom_1' => 'custom string',
- );
+ ];
try{
$result = civicrm_api3('Membership', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function membership_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '91',
'membership_type_id' => '55',
'is_pay_later' => '',
'contribution_recur_id' => '',
'campaign_id' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function membership_delete_example() {
- $params = array(
+ $params = [
'id' => 1,
'preserve_contribution' => 1,
- );
+ ];
try{
$result = civicrm_api3('Membership', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function membership_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => TRUE,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function membership_get_example() {
- $params = array(
+ $params = [
'contact_id' => 47,
- 'filters' => array(
+ 'filters' => [
'is_current' => 1,
- ),
- );
+ ],
+ ];
try{
$result = civicrm_api3('Membership', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function membership_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '47',
'membership_type_id' => '29',
'is_pay_later' => 0,
'membership_name' => 'General',
'relationship_name' => 'Child of',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function membership_get_example() {
- $params = array(
+ $params = [
'membership_type_id' => 23,
- );
+ ];
try{
$result = civicrm_api3('Membership', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function membership_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '38',
'membership_type_id' => '23',
'membership_name' => 'General',
'relationship_name' => 'Child of',
'custom_1_1' => 'custom string',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function membership_create_example() {
- $params = array(
+ $params = [
'contact_id' => 94,
'membership_type_id' => 57,
'join_date' => '2009-01-21',
'source' => 'Payment',
'is_override' => 1,
'status_id' => 35,
- );
+ ];
try{
$result = civicrm_api3('Membership', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function membership_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '94',
'membership_type_id' => '57',
'is_pay_later' => '',
'contribution_recur_id' => '',
'campaign_id' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function membership_create_example() {
- $params = array(
+ $params = [
'contact_id' => 112,
'membership_type_id' => 69,
'join_date' => '2009-01-21',
'is_override' => 1,
'status_id' => 41,
'custom_1' => 'custom string',
- );
+ ];
try{
$result = civicrm_api3('Membership', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function membership_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '112',
'membership_type_id' => '69',
'is_pay_later' => '',
'contribution_recur_id' => '',
'campaign_id' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function membership_payment_create_example() {
- $params = array(
+ $params = [
'contribution_id' => 2,
'membership_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('MembershipPayment', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function membership_payment_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'membership_id' => '1',
'contribution_id' => '2',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function membership_payment_get_example() {
- $params = array(
+ $params = [
'contribution_id' => 4,
'membership_id' => 2,
- );
+ ];
try{
$result = civicrm_api3('MembershipPayment', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function membership_payment_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'membership_id' => '2',
'contribution_id' => '4',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function membership_status_create_example() {
- $params = array(
+ $params = [
'name' => 'test membership status',
- );
+ ];
try{
$result = civicrm_api3('MembershipStatus', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function membership_status_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 15,
- 'values' => array(
- '15' => array(
+ 'values' => [
+ '15' => [
'id' => '15',
'name' => 'test membership status',
'label' => 'test membership status',
'is_default' => '',
'is_active' => '',
'is_reserved' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function membership_status_get_example() {
- $params = array(
+ $params = [
'name' => 'test status',
- );
+ ];
try{
$result = civicrm_api3('MembershipStatus', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function membership_status_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 9,
- 'values' => array(
- '9' => array(
+ 'values' => [
+ '9' => [
'id' => '9',
'name' => 'test status',
'label' => 'test status',
'is_default' => 0,
'is_active' => '1',
'is_reserved' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function membership_type_create_example() {
- $params = array(
+ $params = [
'name' => '40+ Membership',
'description' => 'people above 40 are given health instructions',
'member_of_contact_id' => 7,
'duration_interval' => '10',
'period_type' => 'rolling',
'visibility' => 'public',
- );
+ ];
try{
$result = civicrm_api3('MembershipType', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function membership_type_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'domain_id' => '1',
'name' => '40+ Membership',
'auto_renew' => '',
'is_active' => '1',
'contribution_type_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function membership_type_delete_example() {
- $params = array(
+ $params = [
'id' => 4,
- );
+ ];
try{
$result = civicrm_api3('MembershipType', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function membership_type_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function membership_type_get_example() {
- $params = array(
+ $params = [
'id' => 1,
- );
+ ];
try{
$result = civicrm_api3('MembershipType', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function membership_type_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'domain_id' => '1',
'name' => 'General',
'auto_renew' => 0,
'is_active' => '1',
'contribution_type_id' => '2',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function message_template_create_example() {
- $params = array(
+ $params = [
'msg_title' => 'msg_title_284',
'msg_subject' => 'msg_subject_284',
'msg_text' => 'msg_text_284',
'workflow_id' => 284,
'is_default' => '1',
'is_reserved' => 1,
- );
+ ];
try{
$result = civicrm_api3('MessageTemplate', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function message_template_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 69,
- 'values' => array(
- '69' => array(
+ 'values' => [
+ '69' => [
'id' => '69',
'msg_title' => 'msg_title_284',
'msg_subject' => 'msg_subject_284',
'is_reserved' => '1',
'is_sms' => '',
'pdf_format_id' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function message_template_delete_example() {
- $params = array(
+ $params = [
'id' => 72,
- );
+ ];
try{
$result = civicrm_api3('MessageTemplate', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function message_template_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function message_template_get_example() {
- $params = array(
+ $params = [
'msg_title' => 'msg_title_285',
'msg_subject' => 'msg_subject_285',
'msg_text' => 'msg_text_285',
'workflow_id' => 285,
'is_default' => '1',
'is_reserved' => 1,
- );
+ ];
try{
$result = civicrm_api3('MessageTemplate', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function message_template_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 70,
- 'values' => array(
- '70' => array(
+ 'values' => [
+ '70' => [
'id' => '70',
'msg_title' => 'msg_title_285',
'msg_subject' => 'msg_subject_285',
'is_reserved' => '1',
'is_sms' => '1',
'pdf_format_id' => '285',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function note_create_example() {
- $params = array(
+ $params = [
'entity_table' => 'civicrm_contact',
'entity_id' => 9,
'note' => 'Hello!!! m testing Note',
'contact_id' => 9,
'modified_date' => '2011-01-31',
'subject' => 'Test Note',
- );
+ ];
try{
$result = civicrm_api3('Note', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function note_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 8,
- 'values' => array(
- '8' => array(
+ 'values' => [
+ '8' => [
'id' => '8',
'entity_table' => 'civicrm_contact',
'entity_id' => '9',
'modified_date' => '2012-11-14 16:02:35',
'subject' => 'Test Note',
'privacy' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function note_delete_example() {
- $params = array(
+ $params = [
'id' => 19,
- );
+ ];
try{
$result = civicrm_api3('Note', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function note_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function note_get_example() {
- $params = array(
+ $params = [
'entity_table' => 'civicrm_contact',
'entity_id' => 3,
- );
+ ];
try{
$result = civicrm_api3('Note', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function note_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 0,
- 'values' => array(),
- );
+ 'values' => [],
+ ];
return $expectedResult;
}
* API result array
*/
function open_i_d_create_example() {
- $params = array(
+ $params = [
'contact_id' => 3,
'openid' => 'My OpenID handle',
'location_type_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('OpenID', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function open_i_d_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '3',
'location_type_id' => '1',
'openid' => 'My OpenID handle',
'allowed_to_login' => '',
'is_primary' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function open_i_d_delete_example() {
- $params = array(
+ $params = [
'id' => 3,
- );
+ ];
try{
$result = civicrm_api3('OpenID', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function open_i_d_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function open_i_d_get_example() {
- $params = array(
+ $params = [
'contact_id' => 4,
'openid' => 'My OpenID handle',
'location_type_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('OpenID', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function open_i_d_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'contact_id' => '4',
'location_type_id' => '1',
'openid' => 'My OpenID handle',
'allowed_to_login' => 0,
'is_primary' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function option_group_create_example() {
- $params = array(
+ $params = [
'sequential' => 1,
'name' => 'civicrm_event.amount.560',
'is_reserved' => 1,
'is_active' => 1,
- 'api.OptionValue.create' => array(
+ 'api.OptionValue.create' => [
'label' => 'workshop',
'value' => 35,
'is_default' => 1,
'is_active' => 1,
'format.only_id' => 1,
- ),
- );
+ ],
+ ];
try{
$result = civicrm_api3('OptionGroup', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function option_group_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 92,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '92',
'name' => 'civicrm_event.amount.560',
'title' => '',
'is_active' => '1',
'is_locked' => '',
'api.OptionValue.create' => 849,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function option_group_delete_example() {
- $params = array(
+ $params = [
'id' => 97,
- );
+ ];
try{
$result = civicrm_api3('OptionGroup', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function option_group_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function option_group_get_example() {
- $params = array(
+ $params = [
'name' => 'preferred_communication_method',
- );
+ ];
try{
$result = civicrm_api3('OptionGroup', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function option_group_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'name' => 'preferred_communication_method',
'title' => 'Preferred Communication Method',
'is_reserved' => '1',
'is_active' => '1',
'is_locked' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function option_value_get_example() {
- $params = array(
+ $params = [
'option_group_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('OptionValue', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function option_value_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 5,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'option_group_id' => '1',
'label' => 'Phone',
'is_optgroup' => 0,
'is_reserved' => 0,
'is_active' => '1',
- ),
- '2' => array(
+ ],
+ '2' => [
'id' => '2',
'option_group_id' => '1',
'label' => 'Email',
'is_optgroup' => 0,
'is_reserved' => 0,
'is_active' => '1',
- ),
- '3' => array(
+ ],
+ '3' => [
'id' => '3',
'option_group_id' => '1',
'label' => 'Postal Mail',
'is_optgroup' => 0,
'is_reserved' => 0,
'is_active' => '1',
- ),
- '4' => array(
+ ],
+ '4' => [
'id' => '4',
'option_group_id' => '1',
'label' => 'SMS',
'is_optgroup' => 0,
'is_reserved' => 0,
'is_active' => '1',
- ),
- '5' => array(
+ ],
+ '5' => [
'id' => '5',
'option_group_id' => '1',
'label' => 'Fax',
'is_optgroup' => 0,
'is_reserved' => 0,
'is_active' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function option_value_getsingle_example() {
- $params = array(
+ $params = [
'option_group_id' => 1,
- 'options' => array(
+ 'options' => [
'sort' => 'label DESC',
'limit' => 1,
- ),
- );
+ ],
+ ];
try{
$result = civicrm_api3('OptionValue', 'getsingle', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function option_value_getsingle_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'id' => '4',
'option_group_id' => '1',
'label' => 'SMS',
'is_optgroup' => 0,
'is_reserved' => 0,
'is_active' => '1',
- );
+ ];
return $expectedResult;
}
* API result array
*/
function order_cancel_example() {
- $params = array(
+ $params = [
'contribution_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Order', 'cancel', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function order_cancel_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '16',
'financial_type_id' => '1',
'tax_amount' => '',
'revenue_recognition_date' => '',
'contribution_type_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function order_create_example() {
- $params = array(
+ $params = [
'contact_id' => 8,
'receive_date' => '2010-01-20',
'total_amount' => 200,
'financial_type_id' => 1,
'contribution_status_id' => 1,
- 'line_items' => array(
- '0' => array(
- 'line_item' => array(
- '0' => array(
+ 'line_items' => [
+ '0' => [
+ 'line_item' => [
+ '0' => [
'price_field_id' => '4',
'price_field_value_id' => '5',
'label' => 'Price Field 2',
'financial_type_id' => '4',
'entity_table' => 'civicrm_membership',
'membership_type_id' => 1,
- ),
- ),
- 'params' => array(
+ ],
+ ],
+ 'params' => [
'contact_id' => 8,
'membership_type_id' => 2,
'join_date' => '2006-01-21',
'source' => 'Payment',
'is_override' => 1,
'status_id' => 1,
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
try{
$result = civicrm_api3('Order', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function order_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '8',
'financial_type_id' => '1',
'tax_amount' => '',
'revenue_recognition_date' => '',
'contribution_type_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function order_create_example() {
- $params = array(
+ $params = [
'contact_id' => 11,
'receive_date' => '2010-01-20',
'total_amount' => 300,
'financial_type_id' => 1,
'contribution_status_id' => 1,
- 'line_items' => array(
- '0' => array(
- 'line_item' => array(
- '2' => array(
+ 'line_items' => [
+ '0' => [
+ 'line_item' => [
+ '2' => [
'price_field_id' => '2',
'price_field_value_id' => '2',
'label' => 'Price Field 1',
'line_total' => '100',
'financial_type_id' => '4',
'entity_table' => 'civicrm_participant',
- ),
- '3' => array(
+ ],
+ '3' => [
'price_field_id' => '2',
'price_field_value_id' => '3',
'label' => 'Price Field 2',
'line_total' => '200',
'financial_type_id' => '4',
'entity_table' => 'civicrm_participant',
- ),
- ),
- 'params' => array(
+ ],
+ ],
+ 'params' => [
'contact_id' => 11,
'event_id' => 1,
'status_id' => 1,
'role_id' => 1,
'register_date' => '2007-07-21 00:00:00',
'source' => 'Online Event Registration: API Testing',
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
try{
$result = civicrm_api3('Order', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function order_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '11',
'financial_type_id' => '1',
'tax_amount' => '',
'revenue_recognition_date' => '',
'contribution_type_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function order_delete_example() {
- $params = array(
+ $params = [
'contribution_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Order', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function order_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
+ 'values' => [
'1' => 1,
- ),
- );
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function order_get_example() {
- $params = array(
+ $params = [
'contribution_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Order', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function order_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'contact_id' => '3',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'check_number' => '',
'id' => '1',
'contribution_type_id' => '1',
- 'line_items' => array(
- '0' => array(
+ 'line_items' => [
+ '0' => [
'id' => '1',
'entity_table' => 'civicrm_contribution',
'entity_id' => '1',
'financial_type_id' => '1',
'non_deductible_amount' => '0.00',
'contribution_type_id' => '1',
- ),
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function participant_create_example() {
- $params = array(
+ $params = [
'contact_id' => 2,
'event_id' => 2,
'status_id' => 1,
'register_date' => '2007-07-21 00:00:00',
'source' => 'Online Event Registration: API Testing',
'custom_1' => 'custom string',
- );
+ ];
try{
$result = civicrm_api3('Participant', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function participant_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 4,
- 'values' => array(
- '4' => array(
+ 'values' => [
+ '4' => [
'id' => '4',
'contact_id' => '2',
'event_id' => '2',
'cart_id' => '',
'must_wait' => '',
'transferred_to_contact_id' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function participant_get_example() {
- $params = array(
+ $params = [
'id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Participant', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function participant_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'contact_id' => '2',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'participant_discount_name' => '',
'participant_campaign_id' => '',
'id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function participant_get_example() {
- $params = array(
+ $params = [
'contact_id' => 4,
'api.participant.delete' => 1,
- );
+ ];
try{
$result = civicrm_api3('Participant', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function participant_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'contact_id' => '4',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'participant_discount_name' => '',
'participant_campaign_id' => '',
'id' => '2',
- 'api.participant.delete' => array(
+ 'api.participant.delete' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- ),
- ),
- '3' => array(
+ ],
+ ],
+ '3' => [
'contact_id' => '4',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'participant_discount_name' => '',
'participant_campaign_id' => '',
'id' => '3',
- 'api.participant.delete' => array(
+ 'api.participant.delete' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function participant_get_example() {
- $params = array(
+ $params = [
'id' => 1,
'api.event.get' => 1,
- );
+ ];
try{
$result = civicrm_api3('Participant', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function participant_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'contact_id' => '2',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'participant_discount_name' => '',
'participant_campaign_id' => '',
'id' => '1',
- 'api.event.get' => array(
+ 'api.event.get' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 7,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '7',
'title' => 'Annual CiviCRM meet',
'event_title' => 'Annual CiviCRM meet',
'is_share' => '1',
'is_confirm_enabled' => '1',
'is_billing_required' => 0,
- ),
- ),
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function participant_payment_create_example() {
- $params = array(
+ $params = [
'participant_id' => 13,
'contribution_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('ParticipantPayment', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function participant_payment_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'participant_id' => '13',
'contribution_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function participant_payment_delete_example() {
- $params = array(
+ $params = [
'id' => 5,
- );
+ ];
try{
$result = civicrm_api3('ParticipantPayment', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function participant_payment_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function participant_payment_get_example() {
- $params = array(
+ $params = [
'participant_id' => 64,
'contribution_id' => 6,
- );
+ ];
try{
$result = civicrm_api3('ParticipantPayment', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function participant_payment_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 6,
- 'values' => array(
- '6' => array(
+ 'values' => [
+ '6' => [
'id' => '6',
'participant_id' => '64',
'contribution_id' => '6',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function participant_status_type_create_example() {
- $params = array(
+ $params = [
'name' => 'test status',
'label' => 'I am a test',
'class' => 'Positive',
'is_counted' => 1,
'visibility_id' => 1,
'weight' => 10,
- );
+ ];
try{
$result = civicrm_api3('ParticipantStatusType', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function participant_status_type_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 18,
- 'values' => array(
- '18' => array(
+ 'values' => [
+ '18' => [
'id' => '18',
'name' => 'test status',
'label' => 'I am a test',
'is_counted' => '1',
'weight' => '10',
'visibility_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function participant_status_type_delete_example() {
- $params = array(
+ $params = [
'id' => 19,
- );
+ ];
try{
$result = civicrm_api3('ParticipantStatusType', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function participant_status_type_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => TRUE,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function participant_status_type_get_example() {
- $params = array(
+ $params = [
'name' => 'test status',
'label' => 'I am a test',
'class' => 'Positive',
'is_counted' => 1,
'visibility_id' => 1,
'weight' => 10,
- );
+ ];
try{
$result = civicrm_api3('ParticipantStatusType', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function participant_status_type_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 18,
- 'values' => array(
- '18' => array(
+ 'values' => [
+ '18' => [
'id' => '18',
'name' => 'test status',
'label' => 'I am a test',
'is_counted' => '1',
'weight' => '10',
'visibility_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function payment_cancel_example() {
- $params = array(
+ $params = [
'id' => 2,
'check_permissions' => TRUE,
- );
+ ];
try{
$result = civicrm_api3('Payment', 'cancel', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function payment_cancel_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'id' => 3,
'from_financial_account_id' => '7',
'to_financial_account_id' => '6',
'trxn_result_code' => '',
'status_id' => '7',
'payment_processor_id' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function payment_create_example() {
- $params = array(
+ $params = [
'contribution_id' => 1,
'total_amount' => 50,
- );
+ ];
try{
$result = civicrm_api3('Payment', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function payment_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'id' => '3',
'from_financial_account_id' => '7',
'to_financial_account_id' => '6',
'trxn_result_code' => '',
'status_id' => '1',
'payment_processor_id' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function payment_create_example() {
- $params = array(
+ $params = [
'contribution_id' => 1,
'total_amount' => 50,
- 'line_item' => array(
- '0' => array(
+ 'line_item' => [
+ '0' => [
'1' => 10,
- ),
- '1' => array(
+ ],
+ '1' => [
'2' => 40,
- ),
- ),
- );
+ ],
+ ],
+ ];
try{
$result = civicrm_api3('Payment', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function payment_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'id' => '3',
'from_financial_account_id' => '7',
'to_financial_account_id' => '6',
'trxn_result_code' => '',
'status_id' => '1',
'payment_processor_id' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function payment_delete_example() {
- $params = array(
+ $params = [
'id' => 2,
'check_permissions' => TRUE,
- );
+ ];
try{
$result = civicrm_api3('Payment', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function payment_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function payment_get_example() {
- $params = array(
+ $params = [
'contribution_id' => 1,
'check_permissions' => TRUE,
- );
+ ];
try{
$result = civicrm_api3('Payment', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function payment_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'to_financial_account_id' => '6',
'trxn_date' => '2010-01-20 00:00:00',
'status_id' => '1',
'payment_instrument_id' => '4',
'contribution_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function payment_create_example() {
- $params = array(
+ $params = [
'contribution_id' => 1,
'total_amount' => 100,
'id' => 3,
'check_permissions' => TRUE,
- );
+ ];
try{
$result = civicrm_api3('Payment', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function payment_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 5,
- 'values' => array(
- '5' => array(
+ 'values' => [
+ '5' => [
'id' => '5',
'from_financial_account_id' => '7',
'to_financial_account_id' => '6',
'trxn_result_code' => '',
'status_id' => '1',
'payment_processor_id' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function payment_processor_create_example() {
- $params = array(
+ $params = [
'name' => 'API Test PP',
'payment_processor_type_id' => 1,
'class_name' => 'CRM_Core_Payment_APITest',
'is_recur' => 0,
'domain_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('PaymentProcessor', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function payment_processor_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'domain_id' => '1',
'name' => 'API Test PP',
'payment_type' => '1',
'payment_instrument_id' => '1',
'accepted_credit_cards' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function payment_processor_delete_example() {
- $params = array(
+ $params = [
'id' => 2,
- );
+ ];
try{
$result = civicrm_api3('PaymentProcessor', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function payment_processor_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function payment_processor_type_create_example() {
- $params = array(
+ $params = [
'sequential' => 1,
'name' => 'API_Test_PP',
'title' => 'API Test Payment Processor',
'class_name' => 'CRM_Core_Payment_APITest',
'billing_mode' => 'form',
'is_recur' => 0,
- );
+ ];
try{
$result = civicrm_api3('PaymentProcessorType', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function payment_processor_type_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 13,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '13',
'name' => 'API_Test_PP',
'title' => 'API Test Payment Processor',
'is_recur' => 0,
'payment_type' => '',
'payment_instrument_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function payment_processor_type_delete_example() {
- $params = array(
+ $params = [
'id' => 15,
- );
+ ];
try{
$result = civicrm_api3('PaymentProcessorType', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function payment_processor_type_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => TRUE,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function payment_token_create_example() {
- $params = array(
+ $params = [
'token' => 'fancy-token-xxxx',
'contact_id' => 3,
'created_id' => 3,
'payment_processor_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('PaymentToken', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function payment_token_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '3',
'payment_processor_id' => '1',
'billing_last_name' => '',
'masked_account_number' => '',
'ip_address' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function payment_token_delete_example() {
- $params = array(
+ $params = [
'id' => 3,
- );
+ ];
try{
$result = civicrm_api3('PaymentToken', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function payment_token_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function payment_token_get_example() {
- $params = array(
+ $params = [
'token' => 'fancy-token-xxxx',
'contact_id' => 4,
'created_id' => 4,
'payment_processor_id' => 2,
- );
+ ];
try{
$result = civicrm_api3('PaymentToken', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function payment_token_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'contact_id' => '4',
'payment_processor_id' => '2',
'token' => 'fancy-token-xxxx',
'created_date' => '2013-07-28 08:49:19',
'created_id' => '4',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function pcp_create_example() {
- $params = array(
+ $params = [
'title' => 'Pcp title',
'contact_id' => 1,
'page_id' => 1,
'pcp_block_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Pcp', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function pcp_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '1',
'status_id' => 0,
'currency' => 'USD',
'is_active' => '',
'is_notify' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function phone_create_example() {
- $params = array(
+ $params = [
'contact_id' => 3,
'location_type_id' => 6,
'phone' => '(123) 456-7890',
'is_primary' => 1,
'phone_type_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Phone', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function phone_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'contact_id' => '3',
'location_type_id' => '6',
'phone_ext' => '',
'phone_numeric' => '',
'phone_type_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function phone_delete_example() {
- $params = array(
+ $params = [
'id' => 3,
- );
+ ];
try{
$result = civicrm_api3('Phone', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function phone_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function phone_get_example() {
- $params = array(
+ $params = [
'contact_id' => 7,
'phone' => '(123) 456-7890',
- );
+ ];
try{
$result = civicrm_api3('Phone', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function phone_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 4,
- 'values' => array(
- '4' => array(
+ 'values' => [
+ '4' => [
'id' => '4',
'contact_id' => '7',
'location_type_id' => '10',
'phone' => '(123) 456-7890',
'phone_numeric' => '1234567890',
'phone_type_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function phone_getoptions_example() {
- $params = array(
+ $params = [
'field' => 'phone_type_id',
- );
+ ];
try{
$result = civicrm_api3('Phone', 'getoptions', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function phone_getoptions_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 5,
- 'values' => array(
+ 'values' => [
'1' => 'Phone',
'2' => 'Mobile',
'3' => 'Fax',
'4' => 'Pager',
'5' => 'Voicemail',
- ),
- );
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function pledge_create_example() {
- $params = array(
+ $params = [
'contact_id' => 11,
'pledge_create_date' => '20170207',
'start_date' => '20170207',
'frequency_day' => 15,
'installments' => 5,
'sequential' => 1,
- );
+ ];
try{
$result = civicrm_api3('Pledge', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function pledge_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '1',
'contact_id' => '11',
'financial_type_id' => '1',
'status_id' => '2',
'is_test' => '',
'campaign_id' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function pledge_delete_example() {
- $params = array(
+ $params = [
'id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Pledge', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function pledge_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 'id',
- 'values' => array(
+ 'values' => [
'id' => 1,
- ),
- );
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function pledge_get_example() {
- $params = array(
+ $params = [
'pledge_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Pledge', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function pledge_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'contact_id' => '5',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'pledge_campaign_id' => '',
'pledge_currency' => 'USD',
'id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function pledge_get_example() {
- $params = array(
+ $params = [
'pledge_start_date_high' => '20170205024740',
- );
+ ];
try{
$result = civicrm_api3('Pledge', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function pledge_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'contact_id' => '8',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'pledge_campaign_id' => '',
'pledge_currency' => 'USD',
'id' => '2',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function pledge_payment_create_example() {
- $params = array(
+ $params = [
'contact_id' => 1,
'pledge_id' => 1,
'contribution_id' => 1,
'status_id' => 1,
'actual_amount' => 20,
- );
+ ];
try{
$result = civicrm_api3('PledgePayment', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function pledge_payment_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'pledge_id' => '1',
'contribution_id' => '1',
'reminder_date' => '',
'reminder_count' => '',
'status_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function pledge_payment_delete_example() {
- $params = array(
+ $params = [
'id' => 1,
- );
+ ];
try{
$result = civicrm_api3('PledgePayment', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function pledge_payment_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 'id',
- 'values' => array(
+ 'values' => [
'id' => 1,
- ),
- );
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function pledge_payment_get_example() {
- $params = array();
+ $params = [];
try{
$result = civicrm_api3('PledgePayment', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function pledge_payment_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 5,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'pledge_id' => '1',
'scheduled_amount' => '20.00',
'scheduled_date' => '20130728085413',
'reminder_count' => 0,
'status_id' => '2',
- ),
- '2' => array(
+ ],
+ '2' => [
'id' => '2',
'pledge_id' => '1',
'scheduled_amount' => '20.00',
'scheduled_date' => '20130728085413',
'reminder_count' => 0,
'status_id' => '2',
- ),
- '3' => array(
+ ],
+ '3' => [
'id' => '3',
'pledge_id' => '1',
'scheduled_amount' => '20.00',
'scheduled_date' => '20130728085413',
'reminder_count' => 0,
'status_id' => '2',
- ),
- '4' => array(
+ ],
+ '4' => [
'id' => '4',
'pledge_id' => '1',
'scheduled_amount' => '20.00',
'scheduled_date' => '20130728085413',
'reminder_count' => 0,
'status_id' => '2',
- ),
- '5' => array(
+ ],
+ '5' => [
'id' => '5',
'pledge_id' => '1',
'scheduled_amount' => '20.00',
'scheduled_date' => '20130728085413',
'reminder_count' => 0,
'status_id' => '2',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function pledge_payment_update_example() {
- $params = array(
+ $params = [
'id' => 1,
'status_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('PledgePayment', 'update', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function pledge_payment_update_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'pledge_id' => '1',
'contribution_id' => '1',
'reminder_date' => '',
'reminder_count' => 0,
'status_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function price_field_create_example() {
- $params = array(
+ $params = [
'price_set_id' => 3,
'name' => 'grassvariety',
'label' => 'Grass Variety',
'html_type' => 'Text',
'is_enter_qty' => 1,
'is_active' => 1,
- );
+ ];
try{
$result = civicrm_api3('PriceField', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function price_field_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'price_set_id' => '3',
'name' => 'grassvariety',
'expire_on' => '',
'javascript' => '',
'visibility_id' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function price_field_delete_example() {
- $params = array(
+ $params = [
'id' => 4,
- );
+ ];
try{
$result = civicrm_api3('PriceField', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function price_field_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function price_field_get_example() {
- $params = array(
+ $params = [
'name' => 'contribution_amount',
- );
+ ];
try{
$result = civicrm_api3('PriceField', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function price_field_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'price_set_id' => '1',
'name' => 'contribution_amount',
'is_active' => '1',
'is_required' => '1',
'visibility_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function price_field_value_create_example() {
- $params = array(
+ $params = [
'price_field_id' => 13,
'membership_type_id' => 5,
'name' => 'memType1',
'membership_num_terms' => 2,
'is_active' => 1,
'financial_type_id' => 2,
- );
+ ];
try{
$result = civicrm_api3('PriceFieldValue', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function price_field_value_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 10,
- 'values' => array(
- '10' => array(
+ 'values' => [
+ '10' => [
'id' => '10',
'price_field_id' => '13',
'name' => 'memType1',
'financial_type_id' => '2',
'non_deductible_amount' => '',
'contribution_type_id' => '2',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function price_field_value_delete_example() {
- $params = array(
+ $params = [
'id' => 7,
- );
+ ];
try{
$result = civicrm_api3('PriceFieldValue', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function price_field_value_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function price_field_value_get_example() {
- $params = array(
+ $params = [
'name' => 'contribution_amount',
- );
+ ];
try{
$result = civicrm_api3('PriceFieldValue', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function price_field_value_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'price_field_id' => '1',
'name' => 'contribution_amount',
'financial_type_id' => '1',
'non_deductible_amount' => '0.00',
'contribution_type_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function price_set_create_example() {
- $params = array(
+ $params = [
'entity_table' => 'civicrm_event',
'entity_id' => 1,
'name' => 'event price',
'title' => 'event price',
'extends' => 1,
- );
+ ];
try{
$result = civicrm_api3('PriceSet', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function price_set_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 18,
- 'values' => array(
- '18' => array(
+ 'values' => [
+ '18' => [
'id' => '18',
'domain_id' => '',
'name' => 'event price',
'is_quick_config' => '',
'is_reserved' => '',
'min_amount' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function price_set_delete_example() {
- $params = array(
+ $params = [
'id' => 19,
- );
+ ];
try{
$result = civicrm_api3('PriceSet', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function price_set_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function price_set_get_example() {
- $params = array(
+ $params = [
'name' => 'default_contribution_amount',
- );
+ ];
try{
$result = civicrm_api3('PriceSet', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function price_set_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'name' => 'default_contribution_amount',
'title' => 'Contribution Amount',
'is_quick_config' => '1',
'is_reserved' => '1',
'min_amount' => 0,
- 'entity' => array(),
- ),
- ),
- );
+ 'entity' => [],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function profile_apply_example() {
- $params = array(
+ $params = [
'profile_id' => 31,
'contact_id' => 3,
'first_name' => 'abc2',
'phone-1-1' => '022 321 826',
'country-1' => '1013',
'state_province-1' => '1000',
- );
+ ];
try{
$result = civicrm_api3('Profile', 'apply', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function profile_apply_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 11,
- 'values' => array(
+ 'values' => [
'contact_type' => 'Individual',
'contact_sub_type' => '',
'contact_id' => 3,
'profile_id' => 31,
'first_name' => 'abc2',
'last_name' => 'xyz2',
- 'email' => array(
- '1' => array(
+ 'email' => [
+ '1' => [
'location_type_id' => '1',
'is_primary' => 1,
'email' => 'abc2.xyz2@gmail.com',
- ),
- ),
- 'phone' => array(
- '2' => array(
+ ],
+ ],
+ 'phone' => [
+ '2' => [
'location_type_id' => '1',
'is_primary' => 1,
'phone_type_id' => '1',
'phone' => '022 321 826',
- ),
- ),
- 'address' => array(
- '1' => array(
+ ],
+ ],
+ 'address' => [
+ '1' => [
'location_type_id' => '1',
'is_primary' => 1,
'country_id' => '1013',
'state_province_id' => '1000',
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function profile_get_example() {
- $params = array(
- 'profile_id' => array(
+ $params = [
+ 'profile_id' => [
'0' => 15,
'1' => 1,
'2' => 'Billing',
- ),
+ ],
'contact_id' => 3,
- );
+ ];
try{
$result = civicrm_api3('Profile', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function profile_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 3,
- 'values' => array(
- '15' => array(
+ 'values' => [
+ '15' => [
'postal_code-1' => '90210',
'state_province-1' => '1021',
'country-1' => '1228',
'last_name' => 'xyz1',
'first_name' => 'abc1',
'email-primary' => 'abc1.xyz1@yahoo.com',
- ),
- '1' => array(
+ ],
+ '1' => [
'first_name' => 'abc1',
'last_name' => 'xyz1',
'street_address-1' => '5 Saint Helier St',
'postal_code-1' => '90210',
'country-1' => '1228',
'state_province-1' => '1021',
- ),
- 'Billing' => array(
+ ],
+ 'Billing' => [
'billing_first_name' => 'abc1',
'billing_middle_name' => 'J.',
'billing_last_name' => 'xyz1',
'billing_postal_code-5' => '90210',
'billing-email-5' => 'abc1.xyz1@yahoo.com',
'email-5' => 'abc1.xyz1@yahoo.com',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function profile_getfields_example() {
- $params = array(
+ $params = [
'action' => 'submit',
'profile_id' => 27,
- );
+ ];
try{
$result = civicrm_api3('Profile', 'getfields', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function profile_getfields_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 9,
- 'values' => array(
- 'custom_1' => array(
+ 'values' => [
+ 'custom_1' => [
'label' => '_addCustomFieldToProfile',
'groupTitle' => '_addCustomFie',
'data_type' => 'String',
'help_post' => '',
'entity' => 'contact',
'weight' => '1',
- 'api.aliases' => array(),
- ),
- 'postal_code-1' => array(
+ 'api.aliases' => [],
+ ],
+ 'postal_code-1' => [
'name' => 'postal_code',
'type' => 2,
'title' => 'State Province',
'table_name' => 'civicrm_address',
'entity' => 'address',
'bao' => 'CRM_Core_BAO_Address',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 64,
'size' => 6,
- ),
+ ],
'api.required' => 0,
'help_pre' => '',
'help_post' => '',
'weight' => '2',
- 'api.aliases' => array(),
- ),
- 'state_province-1' => array(
+ 'api.aliases' => [],
+ ],
+ 'state_province-1' => [
'name' => 'state_province_id',
'type' => 1,
'title' => 'State Province',
'entity' => 'address',
'bao' => 'CRM_Core_BAO_Address',
'FKClassName' => 'CRM_Core_DAO_StateProvince',
- 'html' => array(
+ 'html' => [
'type' => 'ChainSelect',
'size' => 6,
'maxlength' => 14,
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'table' => 'civicrm_state_province',
'keyColumn' => 'id',
'labelColumn' => 'name',
- ),
+ ],
'FKApiName' => 'StateProvince',
'api.required' => '1',
'help_pre' => '',
'help_post' => '',
'weight' => '3',
- 'api.aliases' => array(),
- ),
- 'country-1' => array(
+ 'api.aliases' => [],
+ ],
+ 'country-1' => [
'name' => 'country_id',
'type' => 1,
'title' => 'Country',
'entity' => 'address',
'bao' => 'CRM_Core_BAO_Address',
'FKClassName' => 'CRM_Core_DAO_Country',
- 'html' => array(
+ 'html' => [
'type' => 'Select',
'size' => 6,
'maxlength' => 14,
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'table' => 'civicrm_country',
'keyColumn' => 'id',
'labelColumn' => 'name',
'nameColumn' => 'iso_code',
- ),
+ ],
'FKApiName' => 'Country',
'api.required' => '1',
'help_pre' => '',
'help_post' => '',
'weight' => '4',
- 'api.aliases' => array(),
- ),
- 'phone-1-1' => array(
+ 'api.aliases' => [],
+ ],
+ 'phone-1-1' => [
'name' => 'phone',
'type' => 2,
'title' => 'Phone',
'table_name' => 'civicrm_phone',
'entity' => 'phone',
'bao' => 'CRM_Core_BAO_Phone',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 32,
'size' => 20,
- ),
+ ],
'api.required' => '1',
'help_pre' => '',
'help_post' => '',
'weight' => '5',
- 'api.aliases' => array(),
- ),
- 'email-primary' => array(
+ 'api.aliases' => [],
+ ],
+ 'email-primary' => [
'name' => 'email',
'type' => 2,
'title' => 'Email',
'table_name' => 'civicrm_email',
'entity' => 'email',
'bao' => 'CRM_Core_BAO_Email',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 254,
'size' => 30,
- ),
+ ],
'api.required' => '1',
'help_pre' => '',
'help_post' => '',
'weight' => '6',
- 'api.aliases' => array(
+ 'api.aliases' => [
'0' => 'email-Primary',
- ),
- ),
- 'last_name' => array(
+ ],
+ ],
+ 'last_name' => [
'name' => 'last_name',
'type' => 2,
'title' => 'Last Name',
'table_name' => 'civicrm_contact',
'entity' => 'contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 64,
'size' => 30,
- ),
+ ],
'api.required' => '1',
'help_pre' => '',
'help_post' => '',
'weight' => '7',
- 'api.aliases' => array(),
- ),
- 'first_name' => array(
+ 'api.aliases' => [],
+ ],
+ 'first_name' => [
'name' => 'first_name',
'type' => 2,
'title' => 'First Name',
'table_name' => 'civicrm_contact',
'entity' => 'contact',
'bao' => 'CRM_Contact_BAO_Contact',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 64,
'size' => 30,
- ),
+ ],
'api.required' => '1',
'help_pre' => '',
'help_post' => '',
'weight' => '8',
- 'api.aliases' => array(),
- ),
- 'profile_id' => array(
+ 'api.aliases' => [],
+ ],
+ 'profile_id' => [
'api.required' => TRUE,
'title' => 'Profile ID',
'name' => 'profile_id',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function profile_submit_example() {
- $params = array(
+ $params = [
'profile_id' => 29,
'contact_id' => 3,
'first_name' => 'abc2',
'phone-1-1' => '022 321 826',
'country-1' => '1013',
'state_province-1' => '1000',
- );
+ ];
try{
$result = civicrm_api3('Profile', 'submit', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function profile_submit_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'id' => '3',
'contact_type' => 'Individual',
'contact_sub_type' => '',
'user_unique_id' => '',
'created_date' => '2013-07-28 08:49:19',
'modified_date' => '2012-11-14 16:02:35',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function relationship_get_example() {
- $params = array(
- 'relationship_type_id' => array(
- 'BETWEEN' => array(
+ $params = [
+ 'relationship_type_id' => [
+ 'BETWEEN' => [
'0' => 36,
'1' => 38,
- ),
- ),
- );
+ ],
+ ],
+ ];
try{
$result = civicrm_api3('Relationship', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function relationship_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 3,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'contact_id_a' => '99',
'contact_id_b' => '101',
'is_active' => '1',
'is_permission_a_b' => 0,
'is_permission_b_a' => 0,
- ),
- '3' => array(
+ ],
+ '3' => [
'id' => '3',
'contact_id_a' => '99',
'contact_id_b' => '101',
'is_active' => '1',
'is_permission_a_b' => 0,
'is_permission_b_a' => 0,
- ),
- '4' => array(
+ ],
+ '4' => [
'id' => '4',
'contact_id_a' => '99',
'contact_id_b' => '101',
'is_active' => '1',
'is_permission_a_b' => 0,
'is_permission_b_a' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function relationship_create_example() {
- $params = array(
+ $params = [
'contact_id_a' => 31,
'contact_id_b' => 33,
'relationship_type_id' => 18,
'end_date' => '2010-12-30',
'is_active' => 1,
'note' => 'note',
- );
+ ];
try{
$result = civicrm_api3('Relationship', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function relationship_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id_a' => '31',
'contact_id_b' => '33',
'is_permission_a_b' => 0,
'is_permission_b_a' => 0,
'case_id' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function relationship_delete_example() {
- $params = array(
+ $params = [
'id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Relationship', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function relationship_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 'Deleted relationship successfully',
- );
+ ];
return $expectedResult;
}
* API result array
*/
function relationship_get_example() {
- $params = array(
+ $params = [
'id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Relationship', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function relationship_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id_a' => '47',
'contact_id_b' => '49',
'is_permission_b_a' => 0,
'custom_1' => 'custom string',
'custom_1_1' => 'custom string',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function relationship_get_example() {
- $params = array(
- 'relationship_type_id' => array(
- 'IN' => array(
+ $params = [
+ 'relationship_type_id' => [
+ 'IN' => [
'0' => 36,
'1' => 37,
- ),
- ),
- );
+ ],
+ ],
+ ];
try{
$result = civicrm_api3('Relationship', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function relationship_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'contact_id_a' => '99',
'contact_id_b' => '101',
'is_active' => '1',
'is_permission_a_b' => 0,
'is_permission_b_a' => 0,
- ),
- '3' => array(
+ ],
+ '3' => [
'id' => '3',
'contact_id_a' => '99',
'contact_id_b' => '101',
'is_active' => '1',
'is_permission_a_b' => 0,
'is_permission_b_a' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function relationship_get_example() {
- $params = array(
- 'relationship_type_id' => array(
- 'NOT BETWEEN' => array(
+ $params = [
+ 'relationship_type_id' => [
+ 'NOT BETWEEN' => [
'0' => 36,
'1' => 38,
- ),
- ),
- );
+ ],
+ ],
+ ];
try{
$result = civicrm_api3('Relationship', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function relationship_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id_a' => '99',
'contact_id_b' => '101',
'is_active' => '1',
'is_permission_a_b' => 0,
'is_permission_b_a' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function relationship_get_example() {
- $params = array(
- 'relationship_type_id' => array(
- 'NOT IN' => array(
+ $params = [
+ 'relationship_type_id' => [
+ 'NOT IN' => [
'0' => 36,
'1' => 37,
- ),
- ),
- );
+ ],
+ ],
+ ];
try{
$result = civicrm_api3('Relationship', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function relationship_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 2,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id_a' => '99',
'contact_id_b' => '101',
'is_active' => '1',
'is_permission_a_b' => 0,
'is_permission_b_a' => 0,
- ),
- '4' => array(
+ ],
+ '4' => [
'id' => '4',
'contact_id_a' => '99',
'contact_id_b' => '101',
'is_active' => '1',
'is_permission_a_b' => 0,
'is_permission_b_a' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function relationship_get_example() {
- $params = array(
- 'filters' => array(
+ $params = [
+ 'filters' => [
'is_current' => 1,
- ),
- );
+ ],
+ ];
try{
$result = civicrm_api3('Relationship', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function relationship_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'contact_id_a' => '95',
'contact_id_b' => '97',
'is_active' => '1',
'is_permission_a_b' => 0,
'is_permission_b_a' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function relationship_type_create_example() {
- $params = array(
+ $params = [
'name_a_b' => 'Relation 1 for relationship type create',
'name_b_a' => 'Relation 2 for relationship type create',
'contact_type_a' => 'Individual',
'is_reserved' => 1,
'is_active' => 1,
'sequential' => 1,
- );
+ ];
try{
$result = civicrm_api3('RelationshipType', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function relationship_type_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '1',
'name_a_b' => 'Relation 1 for relationship type create',
'label_a_b' => 'Relation 1 for relationship type create',
'contact_sub_type_b' => '',
'is_reserved' => '1',
'is_active' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function relationship_type_delete_example() {
- $params = array(
+ $params = [
'id' => 1,
- );
+ ];
try{
$result = civicrm_api3('RelationshipType', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function relationship_type_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function report_template_getrows_example() {
- $params = array(
+ $params = [
'report_id' => 'contact/summary',
- 'options' => array(
- 'metadata' => array(
+ 'options' => [
+ 'metadata' => [
'0' => 'labels',
'1' => 'title',
- ),
- ),
- );
+ ],
+ ],
+ ];
try{
$result = civicrm_api3('ReportTemplate', 'getrows', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function report_template_getrows_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 2,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'civicrm_contact_sort_name' => 'Second Domain',
'civicrm_contact_id' => '2',
'civicrm_contact_sort_name_link' => '/index.php?q=civicrm/report/contact/detail&reset=1&force=1&id_op=eq&id_value=2',
'civicrm_contact_sort_name_hover' => 'View Contact Detail Report for this contact',
- ),
- '1' => array(
+ ],
+ '1' => [
'civicrm_contact_sort_name' => 'Unit Test Organization',
'civicrm_contact_id' => '1',
'civicrm_contact_sort_name_link' => '/index.php?q=civicrm/report/contact/detail&reset=1&force=1&id_op=eq&id_value=1',
'civicrm_contact_sort_name_hover' => 'View Contact Detail Report for this contact',
- ),
- ),
- 'metadata' => array(
+ ],
+ ],
+ 'metadata' => [
'title' => 'ERROR: Title is not Set',
- 'labels' => array(
+ 'labels' => [
'civicrm_contact_sort_name' => 'Contact Name',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function report_template_getstatistics_example() {
- $params = array(
+ $params = [
'report_id' => 'contribute/deferredrevenue',
- );
+ ];
try{
$result = civicrm_api3('ReportTemplate', 'getstatistics', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function report_template_getstatistics_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 0,
'values' => '',
- );
+ ];
return $expectedResult;
}
* API result array
*/
function saved_search_create_example() {
- $params = array(
- 'form_values' => array(
+ $params = [
+ 'form_values' => [
'relation_type_id' => '6_a_b',
'relation_target_name' => 'Default Organization',
- ),
- 'api.Group.create' => array(
+ ],
+ 'api.Group.create' => [
'name' => 'my_smartgroup',
'title' => 'my smartgroup',
'description' => 'Volunteers for the default organization',
'visibility' => 'User and User Admin Only',
'is_hidden' => 0,
'is_reserved' => 0,
- ),
- );
+ ],
+ ];
try{
$result = civicrm_api3('SavedSearch', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function saved_search_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'id' => '3',
- 'form_values' => array(
+ 'form_values' => [
'relation_type_id' => '6_a_b',
'relation_target_name' => 'Default Organization',
- ),
+ ],
'mapping_id' => '',
'search_custom_id' => '',
'where_clause' => '',
'select_tables' => '',
'where_tables' => '',
- 'api.Group.create' => array(
+ 'api.Group.create' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '1',
'name' => 'my_smartgroup',
'title' => 'my smartgroup',
'is_reserved' => 0,
'created_id' => '',
'modified_id' => '',
- ),
- ),
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function saved_search_delete_example() {
- $params = array(
+ $params = [
'id' => 4,
- );
+ ];
try{
$result = civicrm_api3('SavedSearch', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function saved_search_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function saved_search_get_example() {
- $params = array(
+ $params = [
'id' => 2,
- );
+ ];
try{
$result = civicrm_api3('SavedSearch', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function saved_search_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
- 'form_values' => array(
+ 'form_values' => [
'relation_type_id' => '6_a_b',
'relation_target_name' => 'Default Organization',
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function setting_create_example() {
- $params = array(
+ $params = [
'domain_id' => 2,
'uniq_email_per_site' => 1,
- );
+ ];
try{
$result = civicrm_api3('Setting', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function setting_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'uniq_email_per_site' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function setting_create_example() {
- $params = array(
+ $params = [
'domain_id' => 'all',
'uniq_email_per_site' => 1,
- );
+ ];
try{
$result = civicrm_api3('Setting', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function setting_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 3,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'uniq_email_per_site' => '1',
- ),
- '2' => array(
+ ],
+ '2' => [
'uniq_email_per_site' => '1',
- ),
- '3' => array(
+ ],
+ '3' => [
'uniq_email_per_site' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function setting_create_example() {
- $params = array(
+ $params = [
'uniq_email_per_site' => 1,
- );
+ ];
try{
$result = civicrm_api3('Setting', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function setting_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'uniq_email_per_site' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function setting_create_example() {
- $params = array(
- 'domain_id' => array(
+ $params = [
+ 'domain_id' => [
'0' => 1,
'1' => 3,
- ),
+ ],
'uniq_email_per_site' => 0,
- );
+ ];
try{
$result = civicrm_api3('Setting', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function setting_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 2,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'uniq_email_per_site' => 0,
- ),
- '3' => array(
+ ],
+ '3' => [
'uniq_email_per_site' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function setting_get_example() {
- $params = array(
+ $params = [
'domain_id' => 2,
'return' => 'uniq_email_per_site',
- );
+ ];
try{
$result = civicrm_api3('Setting', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function setting_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'uniq_email_per_site' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function setting_get_example() {
- $params = array(
+ $params = [
'domain_id' => 'all',
'return' => 'uniq_email_per_site',
- );
+ ];
try{
$result = civicrm_api3('Setting', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function setting_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 3,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'uniq_email_per_site' => '1',
- ),
- '2' => array(
+ ],
+ '2' => [
'uniq_email_per_site' => '1',
- ),
- '3' => array(
+ ],
+ '3' => [
'uniq_email_per_site' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function setting_getdefaults_example() {
- $params = array(
+ $params = [
'name' => 'address_format',
- );
+ ];
try{
$result = civicrm_api3('Setting', 'getdefaults', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function setting_getdefaults_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'address_format' => '{contact.address_name}
{contact.street_address}
{contact.supplemental_address_1}
{contact.supplemental_address_3}
{contact.city}{, }{contact.state_province}{ }{contact.postal_code}
{contact.country}',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function setting_getfields_example() {
- $params = array();
+ $params = [];
try{
$result = civicrm_api3('Setting', 'getfields', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function setting_getfields_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 157,
- 'values' => array(
- 'address_standardization_provider' => array(
+ 'values' => [
+ 'address_standardization_provider' => [
'group_name' => 'Address Preferences',
'group' => 'address',
'name' => 'address_standardization_provider',
'is_contact' => 0,
'description' => '',
'help_text' => 'CiviCRM includes an optional plugin for interfacing with the United States Postal Services (USPS) Address Standardization web service. You must register to use the USPS service at https://www.usps.com/business/web-tools-apis/address-information.htm. If you are approved, they will provide you with a User ID and the URL for the service. Plugins for other address standardization services may be available from 3rd party developers. If installed, they will be included in the drop-down below. ',
- ),
- 'address_standardization_userid' => array(
+ ],
+ 'address_standardization_userid' => [
'group_name' => 'Address Preferences',
'group' => 'address',
'name' => 'address_standardization_userid',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'address_standardization_url' => array(
+ ],
+ 'address_standardization_url' => [
'group_name' => 'Address Preferences',
'group' => 'address',
'name' => 'address_standardization_url',
'description' => '',
'help_text' => 'Web Service URL',
'validate_callback' => 'CRM_Utils_Rule::url',
- ),
- 'hideCountryMailingLabels' => array(
+ ],
+ 'hideCountryMailingLabels' => [
'group_name' => 'Address Preferences',
'group' => 'address',
'name' => 'hideCountryMailingLabels',
'is_contact' => 0,
'description' => 'Do not display the country field in mailing labels when the country is the same as that of the domain',
'help_text' => '',
- ),
- 'tag_unconfirmed' => array(
+ ],
+ 'tag_unconfirmed' => [
'group_name' => 'Campaign Preferences',
'group' => 'campaign',
'name' => 'tag_unconfirmed',
'is_contact' => 0,
'description' => '',
'help_text' => 'If set, new contacts that are created when signing a petition are assigned a tag of this name.',
- ),
- 'petition_contacts' => array(
+ ],
+ 'petition_contacts' => [
'group_name' => 'Campaign Preferences',
'group' => 'campaign',
'name' => 'petition_contacts',
'is_contact' => 0,
'description' => '',
'help_text' => 'If set, new contacts that are created when signing a petition are assigned a tag of this name.',
- ),
- 'civicaseRedactActivityEmail' => array(
+ ],
+ 'civicaseRedactActivityEmail' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'civicaseRedactActivityEmail',
'type' => 'String',
'quick_form_type' => 'Select',
'html_type' => 'Select',
- 'html_attributes' => array(),
+ 'html_attributes' => [],
'default' => 'default',
'add' => '4.7',
'title' => 'Redact Activity Email',
'is_domain' => 1,
'is_contact' => 0,
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'callback' => 'CRM_Case_Info::getRedactOptions',
- ),
+ ],
'description' => 'Should activity emails be redacted? (Set \"Default\" to load setting from the legacy \"Settings.xml\" file.)',
'help_text' => '',
- ),
- 'civicaseAllowMultipleClients' => array(
+ ],
+ 'civicaseAllowMultipleClients' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'civicaseAllowMultipleClients',
'type' => 'String',
'quick_form_type' => 'Select',
'html_type' => 'Select',
- 'html_attributes' => array(),
+ 'html_attributes' => [],
'default' => 'default',
'add' => '4.7',
'title' => 'Allow Multiple Case Clients',
'is_domain' => 1,
'is_contact' => 0,
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'callback' => 'CRM_Case_Info::getMultiClientOptions',
- ),
+ ],
'description' => 'How many clients may be associated with a given case? (Set \"Default\" to load setting from the legacy \"Settings.xml\" file.)',
'help_text' => '',
- ),
- 'civicaseNaturalActivityTypeSort' => array(
+ ],
+ 'civicaseNaturalActivityTypeSort' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'civicaseNaturalActivityTypeSort',
'type' => 'String',
'quick_form_type' => 'Select',
'html_type' => 'Select',
- 'html_attributes' => array(),
+ 'html_attributes' => [],
'default' => 'default',
'add' => '4.7',
'title' => 'Activity Type Sorting',
'is_domain' => 1,
'is_contact' => 0,
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'callback' => 'CRM_Case_Info::getSortOptions',
- ),
+ ],
'description' => 'How to sort activity-types on the \"Manage Case\" screen? (Set \"Default\" to load setting from the legacy \"Settings.xml\" file.)',
'help_text' => '',
- ),
- 'cvv_backoffice_required' => array(
+ ],
+ 'cvv_backoffice_required' => [
'group_name' => 'Contribute Preferences',
'group' => 'contribute',
'name' => 'cvv_backoffice_required',
'is_contact' => 0,
'description' => 'Is the CVV code required for back office credit card transactions',
'help_text' => 'If set it back-office credit card transactions will required a cvv code. Leave as required unless you have a very strong reason to change',
- ),
- 'contribution_invoice_settings' => array(
+ ],
+ 'contribution_invoice_settings' => [
'group_name' => 'Contribute Preferences',
'group' => 'contribute',
'name' => 'contribution_invoice_settings',
'type' => 'Array',
- 'default' => array(
+ 'default' => [
'invoice_prefix' => 'INV_',
'credit_notes_prefix' => 'CN_',
'due_date' => '10',
'notes' => '',
'tax_term' => 'Sales Tax',
'tax_display_settings' => 'Inclusive',
- ),
+ ],
'add' => '4.7',
'title' => 'Contribution Invoice Settings',
'is_domain' => 1,
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'invoicing' => array(
+ ],
+ 'invoicing' => [
'group_name' => 'Contribute Preferences',
'group' => 'contribute',
'name' => 'invoicing',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'acl_financial_type' => array(
+ ],
+ 'acl_financial_type' => [
'group_name' => 'Contribute Preferences',
'group' => 'contribute',
'name' => 'acl_financial_type',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'deferred_revenue_enabled' => array(
+ ],
+ 'deferred_revenue_enabled' => [
'group_name' => 'Contribute Preferences',
'group' => 'contribute',
'name' => 'deferred_revenue_enabled',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'default_invoice_page' => array(
+ ],
+ 'default_invoice_page' => [
'group_name' => 'Contribute Preferences',
'group' => 'contribute',
'name' => 'default_invoice_page',
'type' => 'Integer',
'quick_form_type' => 'Element',
'default' => '',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'name' => 'contributionPage',
- ),
+ ],
'html_type' => 'select',
'add' => '4.7',
'title' => 'Default invoice payment page',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'always_post_to_accounts_receivable' => array(
+ ],
+ 'always_post_to_accounts_receivable' => [
'group_name' => 'Contribute Preferences',
'group' => 'contribute',
'name' => 'always_post_to_accounts_receivable',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'update_contribution_on_membership_type_change' => array(
+ ],
+ 'update_contribution_on_membership_type_change' => [
'group_name' => 'Contribute Preferences',
'group' => 'contribute',
'name' => 'update_contribution_on_membership_type_change',
'is_contact' => 0,
'description' => 'Enabling this setting will update related contribution of membership(s) except if the membership is paid for with a recurring contribution.',
'help_text' => '',
- ),
- 'contact_view_options' => array(
+ ],
+ 'contact_view_options' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'contact_view_options',
'type' => 'String',
'html_type' => 'checkboxes',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'optionGroupName' => 'contact_view_options',
- ),
+ ],
'default' => '\ 11\ 12\ 13\ 14\ 15\ 16\ 17\ 18\ 19\ 110\ 111\ 113\ 1',
'add' => '4.1',
'title' => 'Viewing Contacts',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'contact_edit_options' => array(
+ ],
+ 'contact_edit_options' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'contact_edit_options',
'type' => 'String',
'html_type' => 'checkboxes',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'optionGroupName' => 'contact_edit_options',
- ),
+ ],
'default' => '\ 11\ 12\ 13\ 14\ 15\ 16\ 17\ 18\ 19\ 111\ 112\ 114\ 115\ 116\ 117\ 1',
'add' => '4.1',
'title' => 'Editing Contacts',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'advanced_search_options' => array(
+ ],
+ 'advanced_search_options' => [
'group_name' => 'CiviCRM Preferences',
'name' => 'advanced_search_options',
'type' => 'String',
'html_type' => 'checkboxes',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'optionGroupName' => 'advanced_search_options',
- ),
+ ],
'default' => '\ 11\ 12\ 13\ 14\ 15\ 16\ 17\ 18\ 19\ 110\ 111\ 112\ 113\ 115\ 116\ 117\ 118\ 119\ 1',
'add' => '4.1',
'title' => 'Contact Search',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'user_dashboard_options' => array(
+ ],
+ 'user_dashboard_options' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'user_dashboard_options',
'type' => 'String',
'html_type' => 'checkboxes',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'optionGroupName' => 'user_dashboard_options',
- ),
+ ],
'default' => '\ 11\ 12\ 13\ 14\ 15\ 17\ 18\ 1',
'add' => '4.1',
'title' => 'Contact Dashboard',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'address_options' => array(
+ ],
+ 'address_options' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'address_options',
'type' => 'String',
'html_type' => 'Text',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'optionGroupName' => 'address_options',
- ),
+ ],
'default' => '\ 11\ 12\ 13\ 14\ 15\ 16\ 18\ 19\ 110\ 111\ 1',
'add' => '4.1',
'title' => 'Addressing Options',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'address_format' => array(
+ ],
+ 'address_format' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'address_format',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'mailing_format' => array(
+ ],
+ 'mailing_format' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'mailing_format',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'display_name_format' => array(
+ ],
+ 'display_name_format' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'display_name_format',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'sort_name_format' => array(
+ ],
+ 'sort_name_format' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'sort_name_format',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'remote_profile_submissions' => array(
+ ],
+ 'remote_profile_submissions' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'remote_profile_submissions',
'is_contact' => 0,
'description' => 'If enabled, CiviCRM will permit submissions from external sites to profiles. This is disabled by default to limit abuse.',
'help_text' => '',
- ),
- 'allow_alert_autodismissal' => array(
+ ],
+ 'allow_alert_autodismissal' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'allow_alert_autodismissal',
'is_contact' => 0,
'description' => 'If disabled, alert messages in CiviCRM will never be automatically dismissed after 10 seconds.',
'help_text' => '',
- ),
- 'editor_id' => array(
+ ],
+ 'editor_id' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'editor_id',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'contact_ajax_check_similar' => array(
+ ],
+ 'contact_ajax_check_similar' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'contact_ajax_check_similar',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'ajaxPopupsEnabled' => array(
+ ],
+ 'ajaxPopupsEnabled' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'ajaxPopupsEnabled',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'activity_assignee_notification' => array(
+ ],
+ 'activity_assignee_notification' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'activity_assignee_notification',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'activity_assignee_notification_ics' => array(
+ ],
+ 'activity_assignee_notification_ics' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'activity_assignee_notification_ics',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'contact_autocomplete_options' => array(
+ ],
+ 'contact_autocomplete_options' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'contact_autocomplete_options',
'type' => 'String',
'quick_form_type' => 'CheckBox',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'callback' => 'CRM_Admin_Form_Setting_Search::getContactAutocompleteOptions',
- ),
+ ],
'default' => '\ 11\ 12\ 1',
'add' => '4.1',
'title' => 'Autocomplete Contact Search',
'is_contact' => 0,
'description' => 'Selected fields will be displayed in back-office autocomplete dropdown search results (Quick Search, etc.). Contact Name is always included.',
'help_text' => '',
- ),
- 'contact_reference_options' => array(
+ ],
+ 'contact_reference_options' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'contact_reference_options',
'type' => 'String',
'quick_form_type' => 'CheckBox',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'callback' => 'CRM_Admin_Form_Setting_Search::getContactReferenceOptions',
- ),
+ ],
'default' => '\ 11\ 12\ 1',
'add' => '4.1',
'title' => 'Contact Reference Options',
'is_contact' => 0,
'description' => 'Selected fields will be displayed in autocomplete dropdown search results for \'Contact Reference\' custom fields. Contact Name is always included. NOTE: You must assign \'access contact reference fields\' permission to the anonymous role if you want to use custom contact reference fields in profiles on public pages. For most situations, you should use the \'Limit List to Group\' setting when configuring a contact reference field which will be used in public forms to prevent exposing your entire contact list.',
'help_text' => '',
- ),
- 'contact_smart_group_display' => array(
+ ],
+ 'contact_smart_group_display' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'contact_smart_group_display',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'smart_group_cache_refresh_mode' => array(
+ ],
+ 'smart_group_cache_refresh_mode' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'smart_group_cache_refresh_mode',
'title' => 'Smart Group Refresh Mode',
'is_domain' => 1,
'is_contact' => 0,
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'callback' => 'CRM_Contact_BAO_GroupContactCache::getModes',
- ),
+ ],
'description' => 'Should the smart groups be by cron jobs or user actions',
'help_text' => 'In \"Opportunistic Flush\" mode, caches are flushed in response to user actions; this mode is broadly compatible but may add latency during form-submissions. In \"Cron Flush\" mode, you should schedule a cron job to flush caches; this can improve latency on form-submissions but requires more setup.',
- ),
- 'installed' => array(
+ ],
+ 'installed' => [
'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().',
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'is_contact' => 0,
'description' => 'A flag indicating whether this system has run a post-installation routine',
'help_text' => '',
- ),
- 'max_attachments' => array(
+ ],
+ 'max_attachments' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'max_attachments',
'type' => 'Integer',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 2,
'maxlength' => 8,
- ),
+ ],
'default' => 3,
'add' => '4.3',
'title' => 'Maximum Attachments',
'is_contact' => 0,
'description' => 'Maximum number of files (documents, images, etc.) which can attached to emails or activities.',
'help_text' => '',
- ),
- 'maxFileSize' => array(
+ ],
+ 'maxFileSize' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'maxFileSize',
'type' => 'Integer',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 2,
'maxlength' => 8,
- ),
+ ],
'default' => 3,
'add' => '4.3',
'title' => 'Maximum File Size (in MB)',
'is_contact' => 0,
'description' => 'Maximum Size of file (documents, images, etc.) which can attached to emails or activities.<br />Note: php.ini should support this file size.',
'help_text' => '',
- ),
- 'contact_undelete' => array(
+ ],
+ 'contact_undelete' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'contact_undelete',
'is_contact' => 0,
'description' => 'If enabled, deleted contacts will be moved to trash (instead of being destroyed). Users with the proper permission are able to search for the deleted contacts and restore them (or delete permanently).',
'help_text' => '',
- ),
- 'allowPermDeleteFinancial' => array(
+ ],
+ 'allowPermDeleteFinancial' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'allowPermDeleteFinancial',
'is_contact' => 0,
'description' => 'Allow Permanent Delete for contacts who are linked to live financial transactions',
'help_text' => '',
- ),
- 'securityAlert' => array(
+ ],
+ 'securityAlert' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'securityAlert',
'is_contact' => 0,
'description' => 'If enabled, CiviCRM will display pop-up notifications (no more than once per day) for security and misconfiguration issues identified in the system check.',
'help_text' => '',
- ),
- 'doNotAttachPDFReceipt' => array(
+ ],
+ 'doNotAttachPDFReceipt' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'doNotAttachPDFReceipt',
'is_contact' => 0,
'description' => 'If enabled, CiviCRM sends PDF receipt as an attachment during event signup or online contribution.',
'help_text' => '',
- ),
- 'recordGeneratedLetters' => array(
+ ],
+ 'recordGeneratedLetters' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'recordGeneratedLetters',
'type' => 'String',
'quick_form_type' => 'Select',
'html_type' => 'Select',
- 'html_attributes' => array(
+ 'html_attributes' => [
'class' => 'crm-select2',
- ),
+ ],
'default' => 'multiple',
'add' => '4.7',
'title' => 'Record generated letters',
'is_contact' => 0,
'description' => 'When generating a letter (PDF/Word) via mail-merge, how should the letter be recorded?',
'help_text' => '',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'callback' => 'CRM_Contact_Form_Task_PDFLetterCommon::getLoggingOptions',
- ),
- ),
- 'wkhtmltopdfPath' => array(
+ ],
+ ],
+ 'wkhtmltopdfPath' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'wkhtmltopdfPath',
'type' => 'String',
'quick_form_type' => 'Element',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 64,
'maxlength' => 256,
- ),
+ ],
'html_type' => 'Text',
'default' => '',
'add' => '4.3',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'recaptchaOptions' => array(
+ ],
+ 'recaptchaOptions' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'recaptchaOptions',
'type' => 'String',
'quick_form_type' => 'Element',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 64,
'maxlength' => 64,
- ),
+ ],
'html_type' => 'Text',
'default' => '',
'add' => '4.3',
'is_contact' => 0,
'description' => 'You can specify the reCAPTCHA theme options as comma separated data.(eg: theme:\'blackglass\', lang : \'fr\' ). Check the available options at <a href=\"https://developers.google.com/recaptcha/docs/display#config\">Customizing the Look and Feel of reCAPTCHA</a>.',
'help_text' => '',
- ),
- 'recaptchaPublicKey' => array(
+ ],
+ 'recaptchaPublicKey' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'recaptchaPublicKey',
'type' => 'String',
'quick_form_type' => 'Element',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 64,
'maxlength' => 64,
- ),
+ ],
'html_type' => 'Text',
'default' => '',
'add' => '4.3',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'recaptchaPrivateKey' => array(
+ ],
+ 'recaptchaPrivateKey' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'recaptchaPrivateKey',
'type' => 'String',
'quick_form_type' => 'Element',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 64,
'maxlength' => 64,
- ),
+ ],
'html_type' => 'Text',
'default' => '',
'add' => '4.3',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'checksum_timeout' => array(
+ ],
+ 'checksum_timeout' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'checksum_timeout',
'type' => 'Integer',
'quick_form_type' => 'Element',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 2,
'maxlength' => 8,
- ),
+ ],
'html_type' => 'Text',
'default' => 7,
'add' => '4.3',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'blogUrl' => array(
+ ],
+ 'blogUrl' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'blogUrl',
'type' => 'String',
'quick_form_type' => 'Element',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 64,
'maxlength' => 128,
- ),
+ ],
'html_type' => 'Text',
'default' => '*default*',
'add' => '4.3',
'is_contact' => 0,
'description' => 'Blog feed URL used by the blog dashlet',
'help_text' => 'Use \"*default*\" for the system default or override with a custom URL',
- ),
- 'communityMessagesUrl' => array(
+ ],
+ 'communityMessagesUrl' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'communityMessagesUrl',
'type' => 'String',
'quick_form_type' => 'Element',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 64,
'maxlength' => 128,
- ),
+ ],
'html_type' => 'Text',
'default' => '*default*',
'add' => '4.3',
'is_contact' => 0,
'description' => 'Service providing CiviCRM community messages',
'help_text' => 'Use \"*default*\" for the system default or override with a custom URL',
- ),
- 'gettingStartedUrl' => array(
+ ],
+ 'gettingStartedUrl' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'gettingStartedUrl',
'type' => 'String',
'quick_form_type' => 'Element',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 64,
'maxlength' => 128,
- ),
+ ],
'html_type' => 'Text',
'default' => '*default*',
'add' => '4.3',
'is_contact' => 0,
'description' => 'Service providing the Getting Started data',
'help_text' => 'Use \"*default*\" for the system default or override with a custom URL',
- ),
- 'resCacheCode' => array(
+ ],
+ 'resCacheCode' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'resCacheCode',
'is_contact' => 0,
'description' => 'Code appended to resource URLs (JS/CSS) to coerce HTTP caching',
'help_text' => '',
- ),
- 'verifySSL' => array(
+ ],
+ 'verifySSL' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'verifySSL',
'is_contact' => 0,
'description' => 'If disabled, outbound web-service requests will allow unverified, insecure HTTPS connections',
'help_text' => 'Unless you are absolutely unable to configure your server to check the SSL certificate of the remote server you should leave this set to Yes',
- ),
- 'enableSSL' => array(
+ ],
+ 'enableSSL' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'enableSSL',
'is_contact' => 0,
'description' => 'If enabled, inbound HTTP requests for sensitive pages will be redirected to HTTPS.',
'help_text' => 'If enabled, inbound HTTP requests for sensitive pages will be redirected to HTTPS.',
- ),
- 'wpBasePage' => array(
+ ],
+ 'wpBasePage' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'wpBasePage',
'is_contact' => 0,
'description' => 'If set, CiviCRM will use this setting as the base url.',
'help_text' => 'By default, CiviCRM will generate front-facing pages using the home page at http://wp/ as its base. If you want to use a different template for CiviCRM pages, set the path here.',
- ),
- 'secondDegRelPermissions' => array(
+ ],
+ 'secondDegRelPermissions' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'secondDegRelPermissions',
'is_contact' => 0,
'description' => 'If enabled, contacts with the permission to edit a related contact will inherit that contact\'s permission to edit other related contacts',
'help_text' => '',
- ),
- 'enable_components' => array(
+ ],
+ 'enable_components' => [
'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().',
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'type' => 'Array',
'quick_form_type' => 'Element',
'html_type' => 'advmultiselect',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 5,
'style' => 'width:150px',
'class' => 'advmultiselect',
- ),
+ ],
'default' => '',
'add' => '4.4',
'title' => 'Enable Components',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- 'on_change' => array(
+ 'on_change' => [
'0' => 'CRM_Case_Info::onToggleComponents',
'1' => 'CRM_Core_Component::flushEnabledComponents',
'2' => 'call://resources/resetCacheCode',
- ),
- ),
- 'disable_core_css' => array(
+ ],
+ ],
+ 'disable_core_css' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'disable_core_css',
'is_contact' => 0,
'description' => 'Prevent the stylesheet \"civicrm.css\" from being loaded.',
'help_text' => '',
- ),
- 'empoweredBy' => array(
+ ],
+ 'empoweredBy' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'empoweredBy',
'is_contact' => 0,
'description' => 'When enabled, \"empowered by CiviCRM\" is displayed at the bottom of public forms.',
'help_text' => '',
- ),
- 'logging_no_trigger_permission' => array(
+ ],
+ 'logging_no_trigger_permission' => [
'add' => '4.7',
'is_domain' => 1,
'is_contact' => 0,
'default' => 0,
'title' => '(EXPERIMENTAL) MySQL user does not have trigger permissions',
'description' => 'Set this when you intend to manage trigger creation outside of CiviCRM',
- ),
- 'logging' => array(
+ ],
+ 'logging' => [
'add' => '4.7',
'help_text' => '',
'is_domain' => 1,
'title' => 'Logging',
'description' => 'If enabled, all actions will be logged with a complete record of changes.',
'validate_callback' => 'CRM_Logging_Schema::checkLoggingSupport',
- 'on_change' => array(
+ 'on_change' => [
'0' => 'CRM_Logging_Schema::onToggle',
- ),
- ),
- 'logging_uniqueid_date' => array(
+ ],
+ ],
+ 'logging_uniqueid_date' => [
'add' => '4.7',
'help_text' => 'This is the date when CRM-18193 was implemented',
'is_domain' => 1,
'default' => '',
'title' => 'Logging Unique ID not recorded before',
'description' => 'This is the date when CRM-18193 was implemented',
- ),
- 'logging_all_tables_uniquid' => array(
+ ],
+ 'logging_all_tables_uniquid' => [
'add' => '4.7',
'help_text' => 'This indicates there are no tables holdng pre-uniqid log_conn_id values (CRM-18193)',
'is_domain' => 1,
'default' => 0,
'title' => 'All tables use Unique Connection ID',
'description' => 'Do some tables pre-date CRM-18193?',
- ),
- 'userFrameworkUsersTableName' => array(
+ ],
+ 'userFrameworkUsersTableName' => [
'add' => '4.7',
'help_text' => '',
'is_domain' => 1,
'type' => 'String',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => '32',
'maxlength' => '64',
- ),
+ ],
'default' => '',
'title' => 'CMS Users Table Name',
'description' => '',
- ),
- 'wpLoadPhp' => array(
+ ],
+ 'wpLoadPhp' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'wpLoadPhp',
'is_contact' => 0,
'description' => 'CiviCRM will use this setting as path to bootstrap WP.',
'help_text' => '',
- ),
- 'secure_cache_timeout_minutes' => array(
+ ],
+ 'secure_cache_timeout_minutes' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'secure_cache_timeout_minutes',
'type' => 'Integer',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 2,
'maxlength' => 8,
- ),
+ ],
'default' => 20,
'add' => '4.7',
'title' => 'Secure Cache Timeout',
'is_contact' => 0,
'description' => 'Maximum number of minutes that secure form data should linger',
'help_text' => '',
- ),
- 'site_id' => array(
+ ],
+ 'site_id' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'site_id',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'recentItemsMaxCount' => array(
+ ],
+ 'recentItemsMaxCount' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'recentItemsMaxCount',
'type' => 'Integer',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 2,
'maxlength' => 3,
- ),
+ ],
'default' => 20,
'add' => '4.7',
'title' => 'Size of \"Recent Items\" stack',
'is_contact' => 0,
'description' => 'How many items should CiviCRM store in it\'s \"Recently viewed\" list.',
'help_text' => '',
- ),
- 'recentItemsProviders' => array(
+ ],
+ 'recentItemsProviders' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'recentItemsProviders',
'type' => 'Array',
'html_type' => 'Select',
'quick_form_type' => 'Select',
- 'html_attributes' => array(
+ 'html_attributes' => [
'multiple' => 1,
'class' => 'crm-select2',
- ),
+ ],
'default' => '',
'add' => '4.7',
'title' => 'Recent Items Providers',
'is_contact' => 0,
'description' => 'What providers may save views in CiviCRM\'s \"Recently viewed\" list. If empty, all are in.',
'help_text' => '',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'callback' => 'CRM_Utils_Recent::getProviders',
- ),
- ),
- 'dedupe_default_limit' => array(
+ ],
+ ],
+ 'dedupe_default_limit' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'dedupe_default_limit',
'is_contact' => 0,
'description' => 'Default to only loading matches against this number of contacts',
'help_text' => 'Deduping larger databases can crash the server. By configuring a limit other than 0 here the dedupe query will only search for matches against a limited number of contacts.',
- ),
- 'syncCMSEmail' => array(
+ ],
+ 'syncCMSEmail' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'syncCMSEmail',
'is_contact' => 0,
'description' => 'If enabled, then CMS email id will be syncronised with CiviCRM contacts\'s primary email.',
'help_text' => '',
- ),
- 'preserve_activity_tab_filter' => array(
+ ],
+ 'preserve_activity_tab_filter' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'preserve_activity_tab_filter',
'is_contact' => 0,
'description' => 'When enabled, any filter settings a user selects on the contact\'s Activity tab will be remembered as they visit other contacts',
'help_text' => '',
- ),
- 'assetCache' => array(
+ ],
+ 'assetCache' => [
'group_name' => 'Developer Preferences',
'group' => 'developer',
'name' => 'assetCache',
'type' => 'String',
'quick_form_type' => 'Select',
'html_type' => 'Select',
- 'html_attributes' => array(),
+ 'html_attributes' => [],
'default' => 'auto',
'add' => '4.7',
'title' => 'Asset Caching',
'is_contact' => 0,
'description' => 'Store computed JS/CSS content in cache files? (Note: In \"Auto\" mode, the \"Debug\" setting will determine whether to activate the cache.)',
'help_text' => '',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'callback' => '\Civi\Core\AssetBuilder::getCacheModes',
- ),
- ),
- 'userFrameworkLogging' => array(
+ ],
+ ],
+ 'userFrameworkLogging' => [
'group_name' => 'Developer Preferences',
'group' => 'developer',
'name' => 'userFrameworkLogging',
'is_contact' => 0,
'description' => 'Set this value to Yes if you want CiviCRM error/debugging messages to appear in the Drupal error logs',
'help_text' => 'Set this value to Yes if you want CiviCRM error/debugging messages the appear in your CMS\' error log. In the case of Drupal, this will cause all CiviCRM error messages to appear in the watchdog (assuming you have Drupal\'s watchdog enabled)',
- ),
- 'debug_enabled' => array(
+ ],
+ 'debug_enabled' => [
'group_name' => 'Developer Preferences',
'group' => 'developer',
'name' => 'debug_enabled',
'is_contact' => 0,
'description' => 'Set this value to Yes if you want to use one of CiviCRM\'s debugging tools. This feature should NOT be enabled for production sites',
'help_text' => 'Do not turn this on on production sites',
- ),
- 'backtrace' => array(
+ ],
+ 'backtrace' => [
'group_name' => 'Developer Preferences',
'group' => 'developer',
'name' => 'backtrace',
'is_domain' => 1,
'is_contact' => 0,
'description' => 'Set this value to Yes if you want to display a backtrace listing when a fatal error is encountered. This feature should NOT be enabled for production sites',
- ),
- 'fatalErrorHandler' => array(
+ ],
+ 'fatalErrorHandler' => [
'group_name' => 'Developer Preferences',
'group' => 'developer',
'name' => 'fatalErrorHandler',
'is_domain' => 1,
'is_contact' => 0,
'description' => 'Enter the path and class for a custom PHP error-handling function if you want to override built-in CiviCRM error handling for your site.',
- ),
- 'uploadDir' => array(
+ ],
+ 'uploadDir' => [
'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().',
'group_name' => 'Directory Preferences',
'group' => 'directory',
'is_contact' => 0,
'description' => '',
'help_text' => 'File system path where temporary CiviCRM files - such as import data files - are uploaded.',
- ),
- 'imageUploadDir' => array(
+ ],
+ 'imageUploadDir' => [
'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().',
'group_name' => 'Directory Preferences',
'group' => 'directory',
'is_contact' => 0,
'description' => 'File system path where image files are uploaded. Currently, this path is used for images associated with premiums (CiviContribute thank-you gifts).',
'help_text' => '',
- ),
- 'customFileUploadDir' => array(
+ ],
+ 'customFileUploadDir' => [
'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().',
'group_name' => 'Directory Preferences',
'group' => 'directory',
'is_contact' => 0,
'description' => 'Path where documents and images which are attachments to contact records are stored (e.g. contact photos, resumes, contracts, etc.). These attachments are defined using \'file\' type custom fields.',
'help_text' => '',
- ),
- 'customTemplateDir' => array(
+ ],
+ 'customTemplateDir' => [
'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().',
'group_name' => 'Directory Preferences',
'group' => 'directory',
'is_contact' => 0,
'description' => 'Path where site specific templates are stored if any. This directory is searched first if set. Custom JavaScript code can be added to templates by creating files named templateFile.extra.tpl. (learn more...)',
'help_text' => '',
- ),
- 'customPHPPathDir' => array(
+ ],
+ 'customPHPPathDir' => [
'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().',
'group_name' => 'Directory Preferences',
'group' => 'directory',
'is_contact' => 0,
'description' => 'Path where site specific PHP code files are stored if any. This directory is searched first if set.',
'help_text' => '',
- ),
- 'extensionsDir' => array(
+ ],
+ 'extensionsDir' => [
'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().',
'group_name' => 'Directory Preferences',
'group' => 'directory',
'is_contact' => 0,
'description' => 'Path where CiviCRM extensions are stored.',
'help_text' => '',
- ),
- 'enable_cart' => array(
+ ],
+ 'enable_cart' => [
'name' => 'enable_cart',
'group_name' => 'Event Preferences',
'group' => 'event',
'is_contact' => 0,
'description' => 'WRITE ME',
'help_text' => 'WRITE ME',
- ),
- 'show_events' => array(
+ ],
+ 'show_events' => [
'name' => 'show_events',
'group_name' => 'Event Preferences',
'group' => 'event',
'is_contact' => 0,
'description' => 'Configure how many events should be shown on the dashboard. This overrides the default value of 10 entries.',
'help_text' => '',
- ),
- 'ext_repo_url' => array(
+ ],
+ 'ext_repo_url' => [
'group_name' => 'Extension Preferences',
'group' => 'ext',
'name' => 'ext_repo_url',
'type' => 'String',
'quick_form_type' => 'Element',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 64,
'maxlength' => 128,
- ),
+ ],
'html_type' => 'Text',
'default' => 'https://civicrm.org/extdir/ver={ver}|cms={uf}',
'add' => '4.3',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'customTranslateFunction' => array(
+ ],
+ 'customTranslateFunction' => [
'add' => '4.7',
'help_text' => '',
'is_domain' => 1,
'type' => 'String',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => '30',
'maxlength' => '100',
- ),
+ ],
'default' => '',
'title' => 'Custom Translate Function',
'description' => '',
- ),
- 'monetaryThousandSeparator' => array(
+ ],
+ 'monetaryThousandSeparator' => [
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'monetaryThousandSeparator',
'type' => 'String',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 2,
- ),
+ ],
'default' => ',',
'add' => '4.3',
'title' => 'Thousands Separator',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'monetaryDecimalPoint' => array(
+ ],
+ 'monetaryDecimalPoint' => [
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'monetaryDecimalPoint',
'type' => 'String',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 2,
- ),
+ ],
'default' => '.',
'add' => '4.3',
'title' => 'Decimal Delimiter',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'moneyformat' => array(
+ ],
+ 'moneyformat' => [
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'moneyformat',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'moneyvalueformat' => array(
+ ],
+ 'moneyvalueformat' => [
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'moneyvalueformat',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'defaultCurrency' => array(
+ ],
+ 'defaultCurrency' => [
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'defaultCurrency',
'type' => 'String',
'quick_form_type' => 'Select',
'html_type' => 'Select',
- 'html_attributes' => array(
+ 'html_attributes' => [
'class' => 'crm-select2',
- ),
+ ],
'default' => 'USD',
'add' => '4.3',
'title' => 'Default Currency',
'is_contact' => 0,
'description' => 'Default currency assigned to contributions and other monetary transactions.',
'help_text' => '',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'callback' => 'CRM_Admin_Form_Setting_Localization::getCurrencySymbols',
- ),
- 'on_change' => array(
+ ],
+ 'on_change' => [
'0' => 'CRM_Admin_Form_Setting_Localization::onChangeDefaultCurrency',
- ),
- ),
- 'defaultContactCountry' => array(
+ ],
+ ],
+ 'defaultContactCountry' => [
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'defaultContactCountry',
'type' => 'String',
'quick_form_type' => 'Select',
'html_type' => 'Select',
- 'html_attributes' => array(),
+ 'html_attributes' => [],
'default' => '1228',
'add' => '4.4',
'title' => 'Default Country',
'is_contact' => 0,
'description' => 'This value is selected by default when adding a new contact address.',
'help_text' => '',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'callback' => 'CRM_Admin_Form_Setting_Localization::getAvailableCountries',
- ),
- ),
- 'defaultContactStateProvince' => array(
+ ],
+ ],
+ 'defaultContactStateProvince' => [
'add' => '4.7',
'help_text' => '',
'is_domain' => 1,
'default' => '',
'title' => 'Default State/Province',
'description' => 'This value is selected by default when adding a new contact address.',
- ),
- 'countryLimit' => array(
+ ],
+ 'countryLimit' => [
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'countryLimit',
'type' => 'Array',
'quick_form_type' => 'Element',
'html_type' => 'advmultiselect',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 5,
'style' => 'width:150px',
'class' => 'advmultiselect',
- ),
- 'default' => array(),
+ ],
+ 'default' => [],
'add' => '4.3',
'title' => 'Available Countries',
'is_domain' => 1,
'is_contact' => 0,
'description' => '',
'help_text' => '',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'callback' => 'CRM_Admin_Form_Setting_Localization::getAvailableCountries',
- ),
- ),
- 'provinceLimit' => array(
+ ],
+ ],
+ 'provinceLimit' => [
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'provinceLimit',
'type' => 'Array',
'quick_form_type' => 'Element',
'html_type' => 'advmultiselect',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 5,
'style' => 'width:150px',
'class' => 'advmultiselect',
- ),
- 'default' => array(),
+ ],
+ 'default' => [],
'add' => '4.3',
'title' => 'Available States and Provinces (by Country)',
'is_domain' => 1,
'is_contact' => 0,
'description' => '',
'help_text' => '',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'callback' => 'CRM_Admin_Form_Setting_Localization::getAvailableCountries',
- ),
- ),
- 'inheritLocale' => array(
+ ],
+ ],
+ 'inheritLocale' => [
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'inheritLocale',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'dateformatDatetime' => array(
+ ],
+ 'dateformatDatetime' => [
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'dateformatDatetime',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'dateformatFull' => array(
+ ],
+ 'dateformatFull' => [
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'dateformatFull',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'dateformatPartial' => array(
+ ],
+ 'dateformatPartial' => [
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'dateformatPartial',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'dateformatTime' => array(
+ ],
+ 'dateformatTime' => [
'add' => '4.7',
'help_text' => '',
'is_domain' => 1,
'type' => 'String',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => '12',
'maxlength' => '60',
- ),
+ ],
'default' => '%l:%M %P',
'title' => 'Date Format: Time Only',
'description' => '',
- ),
- 'dateformatYear' => array(
+ ],
+ 'dateformatYear' => [
'add' => '4.7',
'help_text' => '',
'is_domain' => 1,
'type' => 'String',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => '12',
'maxlength' => '60',
- ),
+ ],
'default' => '%Y',
'title' => 'Date Format: Year Only',
'description' => '',
- ),
- 'dateformatFinancialBatch' => array(
+ ],
+ 'dateformatFinancialBatch' => [
'add' => '4.7',
'help_text' => '',
'is_domain' => 1,
'type' => 'String',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => '12',
'maxlength' => '60',
- ),
+ ],
'default' => '%m/%d/%Y',
'title' => 'Date Format: Financial Batch',
'description' => '',
- ),
- 'dateformatshortdate' => array(
+ ],
+ 'dateformatshortdate' => [
'add' => '4.7',
'help_text' => '',
'is_domain' => 1,
'type' => 'String',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => '12',
'maxlength' => '60',
- ),
+ ],
'default' => '%m/%d/%Y',
'title' => 'Date Format: Short date Month Day Year',
'description' => '',
- ),
- 'dateInputFormat' => array(
+ ],
+ 'dateInputFormat' => [
'add' => '4.7',
'help_text' => '',
'is_domain' => 1,
'type' => 'String',
'quick_form_type' => 'Select',
'html_type' => 'Select',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'callback' => 'CRM_Core_SelectValues::getDatePluginInputFormats',
- ),
+ ],
'default' => 'mm/dd/yy',
'title' => 'Date Input Format',
'description' => '',
- ),
- 'fieldSeparator' => array(
+ ],
+ 'fieldSeparator' => [
'add' => '4.7',
'help_text' => '',
'is_domain' => 1,
'type' => 'String',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => '2',
'maxlength' => '8',
- ),
+ ],
'default' => ',',
'title' => 'Import / Export Field Separator',
'description' => 'Global CSV separator character. Modify this setting to enable import and export of different kinds of CSV files (for example: \',\' \';\' \':\' \'|\' ).',
- ),
- 'fiscalYearStart' => array(
+ ],
+ 'fiscalYearStart' => [
'add' => '4.7',
'help_text' => '',
'is_domain' => 1,
'type' => 'Array',
'quick_form_type' => 'MonthDay',
'html_type' => 'MonthDay',
- 'default' => array(
+ 'default' => [
'M' => 1,
'd' => 1,
- ),
+ ],
'title' => 'Fiscal Year Start',
'description' => '',
- ),
- 'languageLimit' => array(
+ ],
+ 'languageLimit' => [
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'languageLimit',
'type' => 'Array',
'quick_form_type' => 'Select',
'html_type' => 'Select',
- 'html_attributes' => array(
+ 'html_attributes' => [
'multiple' => 1,
'class' => 'crm-select2',
- ),
+ ],
'default' => '',
'add' => '4.3',
'title' => 'Available Languages (Multi-lingual)',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'callback' => 'CRM_Core_I18n::languages',
- ),
- ),
- 'lcMessages' => array(
+ ],
+ ],
+ 'lcMessages' => [
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'lcMessages',
'type' => 'String',
'quick_form_type' => 'Select',
'html_type' => 'Select',
- 'html_attributes' => array(
+ 'html_attributes' => [
'class' => 'crm-select2',
- ),
+ ],
'default' => 'en_US',
'add' => '4.3',
'title' => 'Default Language',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'callback' => 'CRM_Admin_Form_Setting_Localization::getDefaultLocaleOptions',
- ),
- 'on_change' => array(
+ ],
+ 'on_change' => [
'0' => 'CRM_Admin_Form_Setting_Localization::onChangeLcMessages',
- ),
- ),
- 'legacyEncoding' => array(
+ ],
+ ],
+ 'legacyEncoding' => [
'add' => '4.7',
'help_text' => '',
'is_domain' => 1,
'type' => 'String',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => '12',
'maxlength' => '30',
- ),
+ ],
'default' => 'Windows-1252',
'title' => 'Legacy Encoding',
'description' => 'If import files are NOT encoded as UTF-8, specify an alternate character encoding for these files. The default of Windows-1252 will work for Excel-created .CSV files on many computers.',
- ),
- 'timeInputFormat' => array(
+ ],
+ 'timeInputFormat' => [
'add' => '4.7',
'help_text' => '',
'is_domain' => 1,
'type' => 'String',
'quick_form_type' => 'Select',
'html_type' => 'Select',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'callback' => 'CRM_Core_SelectValues::getTimeFormats',
- ),
+ ],
'default' => '1',
'title' => 'Time Input Format',
'description' => '',
- 'on_change' => array(
+ 'on_change' => [
'0' => 'CRM_Core_BAO_PreferencesDate::onChangeSetting',
- ),
- ),
- 'weekBegins' => array(
+ ],
+ ],
+ 'weekBegins' => [
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'weekBegins',
'type' => 'String',
'quick_form_type' => 'Select',
'html_type' => 'Select',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'callback' => 'CRM_Utils_Date::getFullWeekdayNames',
- ),
+ ],
'default' => 0,
'add' => '4.7',
'title' => 'Week begins on',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'contact_default_language' => array(
+ ],
+ 'contact_default_language' => [
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'contact_default_language',
'type' => 'String',
'quick_form_type' => 'Select',
'html_type' => 'Select',
- 'html_attributes' => array(
+ 'html_attributes' => [
'class' => 'crm-select2',
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'callback' => 'CRM_Admin_Form_Setting_Localization::getDefaultLanguageOptions',
- ),
+ ],
'default' => '*default*',
'add' => '4.7',
'title' => 'Default Language for contacts',
'is_contact' => 0,
'description' => 'Default language (if any) for contact records',
'help_text' => 'If a contact is created with no language this setting will determine the language data (if any) to save.You may or may not wish to make an assumption here about whether it matches the site language',
- ),
- 'profile_double_optin' => array(
+ ],
+ 'profile_double_optin' => [
'group_name' => 'Mailing Preferences',
'group' => 'mailing',
'name' => 'profile_double_optin',
'is_contact' => 0,
'description' => 'When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.',
'help_text' => '',
- ),
- 'track_civimail_replies' => array(
+ ],
+ 'track_civimail_replies' => [
'group_name' => 'Mailing Preferences',
'group' => 'mailing',
'name' => 'track_civimail_replies',
'description' => 'If checked, mailings will default to tracking replies using VERP-ed Reply-To. ',
'help_text' => '',
'validate_callback' => 'CRM_Core_BAO_Setting::validateBoolSetting',
- ),
- 'civimail_workflow' => array(
+ ],
+ 'civimail_workflow' => [
'group_name' => 'Mailing Preferences',
'group' => 'mailing',
'name' => 'civimail_workflow',
'is_contact' => 0,
'description' => 'When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.',
'help_text' => '',
- ),
- 'civimail_server_wide_lock' => array(
+ ],
+ 'civimail_server_wide_lock' => [
'group_name' => 'Mailing Preferences',
'group' => 'mailing',
'name' => 'civimail_server_wide_lock',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'replyTo' => array(
+ ],
+ 'replyTo' => [
'group_name' => 'Mailing Preferences',
'group' => 'mailing',
'name' => 'replyTo',
'is_contact' => 0,
'description' => 'Allow CiviMail users to send mailings with a custom Reply-To header',
'help_text' => '',
- ),
- 'mailing_backend' => array(
+ ],
+ 'mailing_backend' => [
'group_name' => 'Mailing Preferences',
'group' => 'mailing',
'name' => 'mailing_backend',
'type' => 'Array',
'html_type' => 'checkbox',
- 'default' => array(
+ 'default' => [
'outBound_option' => '3',
- ),
+ ],
'add' => '4.1',
'title' => 'Mailing Backend',
'is_domain' => 1,
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'profile_add_to_group_double_optin' => array(
+ ],
+ 'profile_add_to_group_double_optin' => [
'group_name' => 'Mailing Preferences',
'group' => 'mailing',
'name' => 'profile_add_to_group_double_optin',
'is_contact' => 0,
'description' => 'When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.',
'help_text' => '',
- ),
- 'disable_mandatory_tokens_check' => array(
+ ],
+ 'disable_mandatory_tokens_check' => [
'group_name' => 'Mailing Preferences',
'group' => 'mailing',
'name' => 'disable_mandatory_tokens_check',
'is_contact' => 0,
'description' => 'Don\'t check for presence of mandatory tokens (domain address; unsubscribe/opt-out) before sending mailings. WARNING: Mandatory tokens are a safe-guard which facilitate compliance with the US CAN-SPAM Act. They should only be disabled if your organization adopts other mechanisms for compliance or if your organization is not subject to CAN-SPAM.',
'help_text' => '',
- ),
- 'dedupe_email_default' => array(
+ ],
+ 'dedupe_email_default' => [
'group_name' => 'Mailing Preferences',
'group' => 'mailing',
'name' => 'dedupe_email_default',
'is_contact' => 0,
'description' => 'Set the \"dedupe e-mail\" option when sending a new mailing to \"true\" by default.',
'help_text' => '',
- ),
- 'hash_mailing_url' => array(
+ ],
+ 'hash_mailing_url' => [
'group_name' => 'Mailing Preferences',
'group' => 'mailing',
'name' => 'hash_mailing_url',
'is_contact' => 0,
'description' => 'If enabled, a randomized hash key will be used to reference the mailing URL in the mailing.viewUrl token, instead of the mailing ID',
'help_text' => '',
- ),
- 'civimail_multiple_bulk_emails' => array(
+ ],
+ 'civimail_multiple_bulk_emails' => [
'group_name' => 'Mailing Preferences',
'group' => 'mailing',
'name' => 'civimail_multiple_bulk_emails',
'is_contact' => 0,
'description' => 'If enabled, CiviMail will deliver a copy of the email to each bulk email listed for the contact.',
'help_text' => '',
- ),
- 'include_message_id' => array(
+ ],
+ 'include_message_id' => [
'group_name' => 'Mailing Preferences',
'group' => 'mailing',
'name' => 'include_message_id',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'mailerBatchLimit' => array(
+ ],
+ 'mailerBatchLimit' => [
'group_name' => 'Mailing Preferences',
'group' => 'mailing',
'name' => 'mailerBatchLimit',
'type' => 'Integer',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 4,
'maxlength' => 8,
- ),
+ ],
'default' => 0,
'add' => '4.7',
'title' => 'Mailer Batch Limit',
'is_contact' => 0,
'description' => 'Throttle email delivery by setting the maximum number of emails sent during each CiviMail run (0 = unlimited).',
'help_text' => '',
- ),
- 'mailerJobSize' => array(
+ ],
+ 'mailerJobSize' => [
'group_name' => 'Mailing Preferences',
'group' => 'mailing',
'name' => 'mailerJobSize',
'type' => 'Integer',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 4,
'maxlength' => 8,
- ),
+ ],
'default' => 0,
'add' => '4.7',
'title' => 'Mailer Job Size',
'is_contact' => 0,
'description' => 'If you want to utilize multi-threading enter the size you want your sub jobs to be split into. Recommended values are between 1,000 and 10,000. Use a lower value if your server has multiple cron jobs running simultaneously, but do not use values smaller than 1,000. Enter \"0\" to disable multi-threading and process mail as one single job - batch limits still apply.',
'help_text' => '',
- ),
- 'mailerJobsMax' => array(
+ ],
+ 'mailerJobsMax' => [
'group_name' => 'Mailing Preferences',
'group' => 'mailing',
'name' => 'mailerJobsMax',
'type' => 'Integer',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 4,
'maxlength' => 8,
- ),
+ ],
'default' => 0,
'add' => '4.7',
'title' => 'Mailer Cron Job Limit',
'is_contact' => 0,
'description' => 'The maximum number of mailer delivery jobs executing simultaneously (0 = allow as many processes to execute as started by cron)',
'help_text' => '',
- ),
- 'mailThrottleTime' => array(
+ ],
+ 'mailThrottleTime' => [
'group_name' => 'Mailing Preferences',
'group' => 'mailing',
'name' => 'mailThrottleTime',
'type' => 'Integer',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 4,
'maxlength' => 8,
- ),
+ ],
'default' => 0,
'add' => '4.7',
'title' => 'Mailer Throttle Time',
'is_contact' => 0,
'description' => 'The time to sleep in between each e-mail in micro seconds. Setting this above 0 allows you to control the rate at which e-mail messages are sent to the mail server, avoiding filling up the mail queue very quickly. Set to 0 to disable.',
'help_text' => '',
- ),
- 'verpSeparator' => array(
+ ],
+ 'verpSeparator' => [
'group_name' => 'Mailing Preferences',
'group' => 'mailing',
'name' => 'verpSeparator',
'type' => 'String',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 4,
'maxlength' => 32,
- ),
+ ],
'default' => '.',
'add' => '4.7',
'title' => 'VERP Separator',
'is_contact' => 0,
'description' => 'Separator character used when CiviMail generates VERP (variable envelope return path) Mail-From addresses.',
'help_text' => '',
- ),
- 'write_activity_record' => array(
+ ],
+ 'write_activity_record' => [
'group_name' => 'Mailing Preferences',
'group' => 'mailing',
'name' => 'write_activity_record',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'simple_mail_limit' => array(
+ ],
+ 'simple_mail_limit' => [
'group_name' => 'Mailing Preferences',
'group' => 'mailing',
'name' => 'simple_mail_limit',
'type' => 'Integer',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 4,
'maxlength' => 8,
- ),
+ ],
'default' => 50,
'title' => 'Simple mail limit',
'is_domain' => 1,
'is_contact' => 0,
'description' => 'The number of emails sendable via simple mail. Make sure you understand the implications for your spam reputation and legal requirements for bulk emails before editing. As there is some risk both to your spam reputation and the products if this is misused it is a hidden setting',
'help_text' => 'CiviCRM forces users sending more than this number of mails to use CiviMails. CiviMails have additional precautions: not sending to contacts who do not want bulk mail, adding domain name and opt out links. You should familiarise yourself with the law relevant to you on bulk mailings if changing this setting. For the US https://en.wikipedia.org/wiki/CAN-SPAM_Act_of_2003 is a good place to start.',
- ),
- 'geoAPIKey' => array(
+ ],
+ 'geoAPIKey' => [
'add' => '4.7',
'help_text' => '',
'is_domain' => 1,
'type' => 'String',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => '32',
'maxlength' => '64',
- ),
+ ],
'default' => '',
'title' => 'Geo Provider Key',
'description' => 'Enter the API key or Application ID associated with your geocoding provider (not required for Yahoo).',
- ),
- 'geoProvider' => array(
+ ],
+ 'geoProvider' => [
'add' => '4.7',
'help_text' => '',
'is_domain' => 1,
'type' => 'String',
'quick_form_type' => 'Select',
'html_type' => 'Select',
- 'html_attributes' => array(
+ 'html_attributes' => [
'class' => 'crm-select2',
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'callback' => 'CRM_Core_SelectValues::geoProvider',
- ),
+ ],
'default' => '',
'title' => 'Geocoding Provider',
'description' => 'This can be the same or different from the mapping provider selected.',
- ),
- 'mapAPIKey' => array(
+ ],
+ 'mapAPIKey' => [
'add' => '4.7',
'help_text' => '',
'is_domain' => 1,
'type' => 'String',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => '32',
'maxlength' => '64',
- ),
+ ],
'default' => '',
'title' => 'Map Provider Key',
'description' => 'Enter your API Key or Application ID. An API Key is required for the Google Maps API. Refer to developers.google.com for the latest information.',
- ),
- 'mapProvider' => array(
+ ],
+ 'mapProvider' => [
'add' => '4.7',
'help_text' => '',
'is_domain' => 1,
'type' => 'String',
'quick_form_type' => 'Select',
'html_type' => 'Select',
- 'html_attributes' => array(
+ 'html_attributes' => [
'class' => 'crm-select2',
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'callback' => 'CRM_Core_SelectValues::mapProvider',
- ),
+ ],
'default' => '',
'title' => 'Mapping Provider',
'description' => 'Choose the mapping provider that has the best coverage for the majority of your contact addresses.',
- ),
- 'default_renewal_contribution_page' => array(
+ ],
+ 'default_renewal_contribution_page' => [
'group_name' => 'Member Preferences',
'group' => 'member',
'name' => 'default_renewal_contribution_page',
'type' => 'Integer',
'html_type' => 'Select',
'default' => '',
- 'pseudoconstant' => array(
+ 'pseudoconstant' => [
'name' => 'contributionPage',
- ),
+ ],
'add' => '4.1',
'title' => 'Default online membership renewal page',
'is_domain' => 1,
'is_contact' => 0,
'description' => 'If you select a default online contribution page for self-service membership renewals, a \"renew\" link pointing to that page will be displayed on the Contact Dashboard for memberships which were entered offline. You will need to ensure that the membership block for the selected online contribution page includes any currently available memberships.',
'help_text' => '',
- ),
- 'is_enabled' => array(
+ ],
+ 'is_enabled' => [
'group_name' => 'Multi Site Preferences',
'group' => 'multisite',
'name' => 'is_enabled',
'is_contact' => 0,
'description' => 'Multisite is enabled',
'help_text' => '',
- ),
- 'domain_group_id' => array(
+ ],
+ 'domain_group_id' => [
'group_name' => 'Multi Site Preferences',
'group' => 'multisite',
'name' => 'domain_group_id',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'event_price_set_domain_id' => array(
+ ],
+ 'event_price_set_domain_id' => [
'group_name' => 'Multi Site Preferences',
'group' => 'multisite',
'name' => 'event_price_set_domain_id',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'uniq_email_per_site' => array(
+ ],
+ 'uniq_email_per_site' => [
'group_name' => 'Multi Site Preferences',
'group' => 'multisite',
'name' => 'uniq_email_per_site',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'search_autocomplete_count' => array(
+ ],
+ 'search_autocomplete_count' => [
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
'name' => 'search_autocomplete_count',
'type' => 'Integer',
'quick_form_type' => 'Element',
'html_type' => 'text',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 2,
'maxlength' => 2,
- ),
+ ],
'default' => 10,
'add' => '4.3',
'title' => 'Autocomplete Results',
'is_contact' => 0,
'description' => 'The maximum number of contacts to show at a time when typing in an autocomplete field.',
'help_text' => '',
- ),
- 'enable_innodb_fts' => array(
+ ],
+ 'enable_innodb_fts' => [
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
'name' => 'enable_innodb_fts',
'is_contact' => 0,
'description' => 'Enable InnoDB full-text search optimizations. (Requires MySQL 5.6+)',
'help_text' => '',
- 'on_change' => array(
- '0' => array(
+ 'on_change' => [
+ '0' => [
'0' => 'CRM_Core_InnoDBIndexer',
'1' => 'onToggleFts',
- ),
- ),
- ),
- 'fts_query_mode' => array(
+ ],
+ ],
+ ],
+ 'fts_query_mode' => [
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
'name' => 'fts_query_mode',
'type' => 'String',
'quick_form_type' => 'Element',
- 'html_attributes' => array(
+ 'html_attributes' => [
'size' => 64,
'maxlength' => 64,
- ),
+ ],
'html_type' => 'Text',
'default' => 'simple',
'add' => '4.5',
'is_contact' => 0,
'description' => '',
'help_text' => '',
- ),
- 'includeOrderByClause' => array(
+ ],
+ 'includeOrderByClause' => [
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
'name' => 'includeOrderByClause',
'is_contact' => 0,
'description' => 'If disabled, the search results will not be ordered. This may improve response time on search results on large datasets',
'help_text' => '',
- ),
- 'includeWildCardInName' => array(
+ ],
+ 'includeWildCardInName' => [
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
'name' => 'includeWildCardInName',
'is_contact' => 0,
'description' => 'If enabled, wildcards are automatically added to the beginning AND end of the search term when users search for contacts by Name. EXAMPLE: Searching for \'ada\' will return any contact whose name includes those letters - e.g. \'Adams, Janet\', \'Nadal, Jorge\', etc. If disabled, a wildcard is added to the end of the search term only. EXAMPLE: Searching for \'ada\' will return any contact whose last name begins with those letters - e.g. \'Adams, Janet\' but NOT \'Nadal, Jorge\'. Disabling this feature will speed up search significantly for larger databases, but users must manually enter wildcards (\'%\' or \'_\') to the beginning of the search term if they want to find all records which contain those letters. EXAMPLE: \'%ada\' will return \'Nadal, Jorge\'.',
'help_text' => '',
- ),
- 'includeEmailInName' => array(
+ ],
+ 'includeEmailInName' => [
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
'name' => 'includeEmailInName',
'is_contact' => 0,
'description' => 'If enabled, email addresses are automatically included when users search by Name. Disabling this feature will speed up search significantly for larger databases, but users will need to use the Email search fields (from Advanced Search, Search Builder, or Profiles) to find contacts by email address.',
'help_text' => '',
- ),
- 'includeNickNameInName' => array(
+ ],
+ 'includeNickNameInName' => [
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
'name' => 'includeNickNameInName',
'is_contact' => 0,
'description' => 'If enabled, nicknames are automatically included when users search by Name.',
'help_text' => '',
- ),
- 'includeAlphabeticalPager' => array(
+ ],
+ 'includeAlphabeticalPager' => [
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
'name' => 'includeAlphabeticalPager',
'is_contact' => 0,
'description' => 'If disabled, the alphabetical pager will not be displayed on the search screens. This will improve response time on search results on large datasets.',
'help_text' => '',
- ),
- 'smartGroupCacheTimeout' => array(
+ ],
+ 'smartGroupCacheTimeout' => [
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
'name' => 'smartGroupCacheTimeout',
'is_contact' => 0,
'description' => 'The number of minutes to cache smart group contacts. We strongly recommend that this value be greater than zero, since a value of zero means no caching at all. If your contact data changes frequently, you should set this value to at least 5 minutes.',
'help_text' => '',
- ),
- 'defaultSearchProfileID' => array(
+ ],
+ 'defaultSearchProfileID' => [
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
'name' => 'defaultSearchProfileID',
'type' => 'Integer',
'quick_form_type' => 'Select',
'html_type' => 'Select',
- 'html_attributes' => array(
+ 'html_attributes' => [
'class' => 'crm-select2',
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'callback' => 'CRM_Admin_Form_Setting_Search::getAvailableProfiles',
- ),
+ ],
'default' => '',
'add' => '4.6',
'title' => 'Default Contact Search Profile',
'is_contact' => 0,
'description' => 'If set, this will be the default profile used for contact search.',
'help_text' => '',
- ),
- 'searchPrimaryDetailsOnly' => array(
+ ],
+ 'searchPrimaryDetailsOnly' => [
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
'name' => 'searchPrimaryDetailsOnly',
'is_contact' => 0,
'description' => 'If enabled, only primary details (eg contact\'s primary email, phone, etc) will be included in Basic and Advanced Search results. Disabling this feature will allow users to match contacts using any email, phone etc detail.',
'help_text' => '',
- ),
- 'userFrameworkResourceURL' => array(
+ ],
+ 'userFrameworkResourceURL' => [
'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().',
'group' => 'url',
'group_name' => 'URL Preferences',
'description' => 'Absolute URL of the location where the civicrm module or component has been installed.',
'help_text' => '',
'validate_callback' => 'CRM_Utils_Rule::urlish',
- ),
- 'imageUploadURL' => array(
+ ],
+ 'imageUploadURL' => [
'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().',
'group' => 'url',
'group_name' => 'URL Preferences',
'description' => 'URL of the location for uploaded image files.',
'help_text' => '',
'validate_callback' => 'CRM_Utils_Rule::urlish',
- ),
- 'customCSSURL' => array(
+ ],
+ 'customCSSURL' => [
'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().',
'group' => 'url',
'group_name' => 'URL Preferences',
'description' => 'You can modify the look and feel of CiviCRM by adding your own stylesheet. For small to medium sized modifications, use your css file to override some of the styles in civicrm.css. Or if you need to make drastic changes, you can choose to disable civicrm.css completely.',
'help_text' => '',
'validate_callback' => 'CRM_Utils_Rule::urlish',
- ),
- 'extensionsURL' => array(
+ ],
+ 'extensionsURL' => [
'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().',
'group' => 'url',
'group_name' => 'URL Preferences',
'description' => 'Base URL for extension resources (images, stylesheets, etc). This should match extensionsDir.',
'help_text' => '',
'validate_callback' => 'CRM_Utils_Rule::urlish',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function setting_get_example() {
- $params = array(
+ $params = [
'return' => 'uniq_email_per_site',
- );
+ ];
try{
$result = civicrm_api3('Setting', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function setting_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'uniq_email_per_site' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function setting_get_example() {
- $params = array(
- 'domain_id' => array(
+ $params = [
+ 'domain_id' => [
'0' => 1,
'1' => 2,
- ),
- 'return' => array(
+ ],
+ 'return' => [
'0' => 'uniq_email_per_site',
- ),
- );
+ ],
+ ];
try{
$result = civicrm_api3('Setting', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function setting_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 2,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'uniq_email_per_site' => 0,
- ),
- '2' => array(
+ ],
+ '2' => [
'uniq_email_per_site' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function setting_getvalue_example() {
- $params = array(
+ $params = [
'name' => 'petition_contacts',
'group' => 'Campaign Preferences',
- );
+ ];
try{
$result = civicrm_api3('Setting', 'getvalue', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
* API result array
*/
function setting_revert_example() {
- $params = array(
+ $params = [
'name' => 'address_format',
- );
+ ];
try{
$result = civicrm_api3('Setting', 'revert', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function setting_revert_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 5,
'id' => 1,
- 'values' => array(
+ 'values' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'address_format' => '{contact.address_name}
{contact.street_address}
{contact.supplemental_address_1}
{contact.supplemental_address_3}
{contact.city}{, }{contact.state_province}{ }{contact.postal_code}
{contact.country}',
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function state_province_create_example() {
- $params = array(
+ $params = [
'name' => 'Wessex',
'abbreviation' => 'WEX',
'country_id' => 1226,
- );
+ ];
try{
$result = civicrm_api3('StateProvince', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function state_province_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 13947,
- 'values' => array(
- '13947' => array(
+ 'values' => [
+ '13947' => [
'id' => '13947',
'name' => 'Wessex',
'abbreviation' => 'WEX',
'country_id' => '1226',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function state_province_delete_example() {
- $params = array(
+ $params = [
'id' => 13948,
- );
+ ];
try{
$result = civicrm_api3('StateProvince', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function state_province_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function state_province_get_example() {
- $params = array(
+ $params = [
'name' => 'Wessex',
- );
+ ];
try{
$result = civicrm_api3('StateProvince', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function state_province_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 13949,
- 'values' => array(
- '13949' => array(
+ 'values' => [
+ '13949' => [
'id' => '13949',
'name' => 'Wessex',
'abbreviation' => 'WEX',
'country_id' => '1226',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function status_preference_create_example() {
- $params = array(
+ $params = [
'name' => 'test_check',
'domain_id' => 1,
'hush_until' => '20151212',
'ignore_severity' => 'cRItical',
'check_info' => '',
- );
+ ];
try{
$result = civicrm_api3('StatusPreference', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function status_preference_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 4,
- 'values' => array(
- '4' => array(
+ 'values' => [
+ '4' => [
'id' => '4',
'domain_id' => '1',
'name' => 'test_check',
'ignore_severity' => '5',
'prefs' => '',
'check_info' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function status_preference_delete_example() {
- $params = array(
+ $params = [
'id' => 2,
- );
+ ];
try{
$result = civicrm_api3('StatusPreference', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function status_preference_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function status_preference_get_example() {
- $params = array(
+ $params = [
'id' => 3,
- );
+ ];
try{
$result = civicrm_api3('StatusPreference', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function status_preference_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
+ 'values' => [
+ '3' => [
'id' => '3',
'domain_id' => '1',
'name' => 'test_check',
'hush_until' => '2015-12-12',
'ignore_severity' => '4',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function survey_get_example() {
- $params = array(
+ $params = [
'title' => 'survey title',
'api.survey.delete' => 1,
- );
+ ];
try{
$result = civicrm_api3('Survey', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function survey_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 4,
- 'values' => array(
- '4' => array(
+ 'values' => [
+ '4' => [
'id' => '4',
'title' => 'survey title',
'activity_type_id' => '30',
'created_date' => '2013-07-28 08:49:19',
'bypass_confirm' => 0,
'is_share' => '1',
- 'api.survey.delete' => array(
+ 'api.survey.delete' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function survey_create_example() {
- $params = array(
+ $params = [
'title' => 'survey title',
'activity_type_id' => '30',
'max_number_of_contacts' => 12,
'instructions' => 'Call people, ask for money',
- );
+ ];
try{
$result = civicrm_api3('Survey', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function survey_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'title' => 'survey title',
'campaign_id' => '',
'thankyou_title' => '',
'thankyou_text' => '',
'is_share' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function survey_delete_example() {
- $params = array(
+ $params = [
'id' => 3,
- );
+ ];
try{
$result = civicrm_api3('Survey', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function survey_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function survey_get_example() {
- $params = array(
+ $params = [
'title' => 'survey title',
'activity_type_id' => '30',
'max_number_of_contacts' => 12,
'instructions' => 'Call people, ask for money',
- );
+ ];
try{
$result = civicrm_api3('Survey', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function survey_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'title' => 'survey title',
'activity_type_id' => '30',
'created_date' => '2013-07-28 08:49:19',
'bypass_confirm' => 0,
'is_share' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function survey_respondant_get_example() {
- $params = array(
+ $params = [
'sequential' => '1',
'survey_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('SurveyRespondant', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function survey_respondant_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 0,
- 'values' => array(),
+ 'values' => [],
'deprecated' => 'The SurveyRespondant api is not currently supported.',
- );
+ ];
return $expectedResult;
}
* API result array
*/
function system_flush_example() {
- $params = array();
+ $params = [];
try{
$result = civicrm_api3('System', 'flush', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function system_flush_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function tag_create_example() {
- $params = array(
+ $params = [
'name' => 'Super Heros',
'description' => 'Outside undie-wearers',
- );
+ ];
try{
$result = civicrm_api3('Tag', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function tag_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 12,
- 'values' => array(
- '12' => array(
+ 'values' => [
+ '12' => [
'id' => '12',
'name' => 'Super Heros',
'description' => 'Outside undie-wearers',
'created_id' => '',
'color' => '',
'created_date' => '2013-07-28 08:49:19',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function tag_delete_example() {
- $params = array(
+ $params = [
'id' => '17',
- );
+ ];
try{
$result = civicrm_api3('Tag', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function tag_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function tag_get_example() {
- $params = array(
+ $params = [
'id' => '7',
'name' => 'New Tag3',
- );
+ ];
try{
$result = civicrm_api3('Tag', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function tag_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 7,
- 'values' => array(
- '7' => array(
+ 'values' => [
+ '7' => [
'id' => '7',
'name' => 'New Tag3',
'description' => 'This is description for Our New Tag ',
'is_tagset' => 0,
'used_for' => 'civicrm_contact',
'created_date' => '2013-07-28 08:49:19',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function tag_getfields_example() {
- $params = array(
+ $params = [
'action' => 'create',
- );
+ ];
try{
$result = civicrm_api3('Tag', 'getfields', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function tag_getfields_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 11,
- 'values' => array(
- 'id' => array(
+ 'values' => [
+ 'id' => [
'name' => 'id',
'type' => 1,
'title' => 'Tag ID',
'table_name' => 'civicrm_tag',
'entity' => 'Tag',
'bao' => 'CRM_Core_BAO_Tag',
- 'api.aliases' => array(
+ 'api.aliases' => [
'0' => 'tag',
- ),
- ),
- 'name' => array(
+ ],
+ ],
+ 'name' => [
'name' => 'name',
'type' => 2,
'title' => 'Tag Name',
'entity' => 'Tag',
'bao' => 'CRM_Core_BAO_Tag',
'api.required' => 1,
- ),
- 'description' => array(
+ ],
+ 'description' => [
'name' => 'description',
'type' => 2,
'title' => 'Description',
'table_name' => 'civicrm_tag',
'entity' => 'Tag',
'bao' => 'CRM_Core_BAO_Tag',
- ),
- 'parent_id' => array(
+ ],
+ 'parent_id' => [
'name' => 'parent_id',
'type' => 1,
'title' => 'Parent Tag',
'bao' => 'CRM_Core_BAO_Tag',
'FKClassName' => 'CRM_Core_DAO_Tag',
'FKApiName' => 'Tag',
- ),
- 'is_selectable' => array(
+ ],
+ 'is_selectable' => [
'name' => 'is_selectable',
'type' => 16,
'title' => 'Display Tag?',
'table_name' => 'civicrm_tag',
'entity' => 'Tag',
'bao' => 'CRM_Core_BAO_Tag',
- ),
- 'is_reserved' => array(
+ ],
+ 'is_reserved' => [
'name' => 'is_reserved',
'type' => 16,
'title' => 'Reserved',
'table_name' => 'civicrm_tag',
'entity' => 'Tag',
'bao' => 'CRM_Core_BAO_Tag',
- ),
- 'is_tagset' => array(
+ ],
+ 'is_tagset' => [
'name' => 'is_tagset',
'type' => 16,
'title' => 'Tagset',
'table_name' => 'civicrm_tag',
'entity' => 'Tag',
'bao' => 'CRM_Core_BAO_Tag',
- ),
- 'used_for' => array(
+ ],
+ 'used_for' => [
'name' => 'used_for',
'type' => 2,
'title' => 'Used For',
'table_name' => 'civicrm_tag',
'entity' => 'Tag',
'bao' => 'CRM_Core_BAO_Tag',
- 'html' => array(
+ 'html' => [
'type' => 'Select',
'maxlength' => 64,
'size' => 30,
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'optionGroupName' => 'tag_used_for',
'optionEditPath' => 'civicrm/admin/options/tag_used_for',
- ),
+ ],
'api.default' => 'civicrm_contact',
- ),
- 'created_id' => array(
+ ],
+ 'created_id' => [
'name' => 'created_id',
'type' => 1,
'title' => 'Tag Created By',
'bao' => 'CRM_Core_BAO_Tag',
'FKClassName' => 'CRM_Contact_DAO_Contact',
'FKApiName' => 'Contact',
- ),
- 'color' => array(
+ ],
+ 'color' => [
'name' => 'color',
'type' => 2,
'title' => 'Color',
'table_name' => 'civicrm_tag',
'entity' => 'Tag',
'bao' => 'CRM_Core_BAO_Tag',
- ),
- 'created_date' => array(
+ ],
+ 'created_date' => [
'name' => 'created_date',
'type' => 12,
'title' => 'Tag Created Date',
'table_name' => 'civicrm_tag',
'entity' => 'Tag',
'bao' => 'CRM_Core_BAO_Tag',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function tag_getlist_example() {
- $params = array(
+ $params = [
'input' => 'New Tag3',
- 'extra' => array(
+ 'extra' => [
'0' => 'used_for',
- ),
- );
+ ],
+ ];
try{
$result = civicrm_api3('Tag', 'getlist', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function tag_getlist_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 0,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '19',
'label' => 'New Tag3',
- 'description' => array(
+ 'description' => [
'0' => 'This is description for Our New Tag ',
- ),
- 'extra' => array(
+ ],
+ 'extra' => [
'used_for' => 'civicrm_contact',
- ),
- ),
- ),
+ ],
+ ],
+ ],
'page_num' => 1,
'more_results' => '',
- );
+ ];
return $expectedResult;
}
* API result array
*/
function tag_get_example() {
- $params = array(
+ $params = [
'id' => '8',
'name' => 'New Tag3',
- 'return' => array(
+ 'return' => [
'0' => 'name',
- ),
- );
+ ],
+ ];
try{
$result = civicrm_api3('Tag', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function tag_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 8,
- 'values' => array(
- '8' => array(
+ 'values' => [
+ '8' => [
'id' => '8',
'name' => 'New Tag3',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function tax_contribution_page_create_example() {
- $params = array(
+ $params = [
'contact_id' => 1,
'receive_date' => '20120511',
'total_amount' => '100',
'invoice_id' => 67890,
'source' => 'SSF',
'contribution_status_id' => 2,
- );
+ ];
try{
$result = civicrm_api3('tax_contribution_page', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'error' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function tax_contribution_page_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '1',
'financial_type_id' => '11',
'creditnote_id' => '',
'tax_amount' => '20',
'contribution_type_id' => '11',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function tax_contribution_page_create_example() {
- $params = array(
+ $params = [
'contact_id' => 1,
'receive_date' => '20120511',
'total_amount' => '400',
'source' => 'SSF',
'contribution_status_id' => 1,
'skipLineItem' => 1,
- 'api.line_item.create' => array(
- '0' => array(
- 'price_field_id' => array(
+ 'api.line_item.create' => [
+ '0' => [
+ 'price_field_id' => [
'0' => 3,
- ),
+ ],
'qty' => 1,
'line_total' => '100',
'unit_price' => '100',
'financial_type_id' => 7,
- ),
- '1' => array(
- 'price_field_id' => array(
+ ],
+ '1' => [
+ 'price_field_id' => [
'0' => 3,
- ),
+ ],
'qty' => 1,
'line_total' => '300',
'unit_price' => '300',
'financial_type_id' => 8,
- ),
- ),
- );
+ ],
+ ],
+ ];
try{
$result = civicrm_api3('tax_contribution_page', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'error' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function tax_contribution_page_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '1',
'financial_type_id' => '7',
'creditnote_id' => '',
'tax_amount' => '35',
'contribution_type_id' => '7',
- 'api.line_item.create' => array(
- '0' => array(
+ 'api.line_item.create' => [
+ '0' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '1',
'entity_table' => 'civicrm_contribution',
'entity_id' => '1',
'contribution_id' => '1',
- 'price_field_id' => array(
+ 'price_field_id' => [
'0' => '3',
- ),
+ ],
'label' => 'line item',
'qty' => '1',
'unit_price' => '100',
'financial_type_id' => '7',
'deductible_amount' => '',
'tax_amount' => '20',
- ),
- ),
- ),
- '1' => array(
+ ],
+ ],
+ ],
+ '1' => [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '2',
'entity_table' => 'civicrm_contribution',
'entity_id' => '1',
'contribution_id' => '1',
- 'price_field_id' => array(
+ 'price_field_id' => [
'0' => '3',
- ),
+ ],
'label' => 'line item',
'qty' => '1',
'unit_price' => '300',
'financial_type_id' => '8',
'deductible_amount' => '',
'tax_amount' => '15',
- ),
- ),
- ),
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function tax_contribution_page_delete_example() {
- $params = array(
+ $params = [
'id' => 1,
- );
+ ];
try{
$result = civicrm_api3('tax_contribution_page', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'error' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function tax_contribution_page_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
+ 'values' => [
'1' => 1,
- ),
- );
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function uf_field_create_example() {
- $params = array(
+ $params = [
'field_name' => 'phone',
'field_type' => 'Contact',
'visibility' => 'Public Pages and Listings',
'location_type_id' => 1,
'phone_type_id' => 1,
'uf_group_id' => 11,
- );
+ ];
try{
$result = civicrm_api3('UFField', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function uf_field_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'uf_group_id' => '11',
'field_name' => 'phone',
'field_type' => 'Contact',
'is_reserved' => '',
'is_multi_summary' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function uf_field_delete_example() {
- $params = array(
+ $params = [
'field_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('UFField', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function uf_field_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => TRUE,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function uf_field_get_example() {
- $params = array();
+ $params = [];
try{
$result = civicrm_api3('UFField', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function uf_field_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'uf_group_id' => '11',
'field_name' => 'phone',
'label' => 'Test Phone',
'field_type' => 'Contact',
'is_multi_summary' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function uf_field_replace_example() {
- $params = array(
+ $params = [
'uf_group_id' => 11,
'option.autoweight' => '',
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'field_name' => 'first_name',
'field_type' => 'Contact',
'visibility' => 'Public Pages and Listings',
'label' => 'Test First Name',
'is_searchable' => 1,
'is_active' => 1,
- ),
- '1' => array(
+ ],
+ '1' => [
'field_name' => 'country',
'field_type' => 'Contact',
'visibility' => 'Public Pages and Listings',
'is_searchable' => 1,
'is_active' => 1,
'location_type_id' => 1,
- ),
- '2' => array(
+ ],
+ '2' => [
'field_name' => 'phone',
'field_type' => 'Contact',
'visibility' => 'Public Pages and Listings',
'is_active' => 1,
'location_type_id' => 1,
'phone_type_id' => 1,
- ),
- ),
+ ],
+ ],
'check_permissions' => TRUE,
- );
+ ];
try{
$result = civicrm_api3('UFField', 'replace', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function uf_field_replace_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 3,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'uf_group_id' => '11',
'field_name' => 'first_name',
'field_type' => 'Contact',
'is_reserved' => '',
'is_multi_summary' => '',
- ),
- '2' => array(
+ ],
+ '2' => [
'id' => '2',
'uf_group_id' => '11',
'field_name' => 'country',
'field_type' => 'Contact',
'is_reserved' => '',
'is_multi_summary' => '',
- ),
- '3' => array(
+ ],
+ '3' => [
'id' => '3',
'uf_group_id' => '11',
'field_name' => 'phone',
'field_type' => 'Contact',
'is_reserved' => '',
'is_multi_summary' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function uf_group_create_example() {
- $params = array(
+ $params = [
'add_captcha' => 1,
'add_contact_to_group' => 1,
'group' => 1,
'notify' => 'admin@example.org',
'post_URL' => 'http://example.org/post',
'title' => 'Test Group',
- );
+ ];
try{
$result = civicrm_api3('UFGroup', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function uf_group_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'is_active' => 0,
'group_type' => 'Individual,Contact',
'created_id' => '1',
'created_date' => '2013-07-28 08:49:19',
'is_proximity_search' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function uf_group_delete_example() {
- $params = array(
+ $params = [
'id' => 2,
- );
+ ];
try{
$result = civicrm_api3('UFGroup', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function uf_group_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function uf_group_get_example() {
- $params = array(
+ $params = [
'id' => 2,
- );
+ ];
try{
$result = civicrm_api3('UFGroup', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function uf_group_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'is_active' => 0,
'group_type' => 'Individual,Contact',
'created_id' => '1',
'created_date' => '2013-07-28 08:49:19',
'is_proximity_search' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function uf_join_create_example() {
- $params = array(
+ $params = [
'module' => 'CiviCampaign',
'entity_table' => 'civicrm_survey',
'entity_id' => 1,
'uf_group_id' => 11,
'is_active' => 1,
'sequential' => 1,
- );
+ ];
try{
$result = civicrm_api3('UFJoin', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function uf_join_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 0,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '1',
'is_active' => '1',
'module' => 'CiviCampaign',
'weight' => '1',
'uf_group_id' => '11',
'module_data' => '',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function uf_join_get_example() {
- $params = array(
+ $params = [
'entity_table' => 'civicrm_contribution_page',
'entity_id' => 1,
'sequential' => 1,
- );
+ ];
try{
$result = civicrm_api3('UFJoin', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function uf_join_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '0' => array(
+ 'values' => [
+ '0' => [
'id' => '1',
'is_active' => '1',
'module' => 'CiviContribute',
'entity_id' => '1',
'weight' => '1',
'uf_group_id' => '11',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function uf_match_get_example() {
- $params = array(
+ $params = [
'contact_id' => 69,
- );
+ ];
try{
$result = civicrm_api3('UFMatch', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function uf_match_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'domain_id' => '1',
'uf_id' => '42',
'contact_id' => '69',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function website_create_example() {
- $params = array(
+ $params = [
'contact_id' => 3,
'url' => 'website.com',
'website_type_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Website', 'create', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function website_create_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
- 'values' => array(
- '1' => array(
+ 'values' => [
+ '1' => [
'id' => '1',
'contact_id' => '3',
'url' => 'website.com',
'website_type_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function website_delete_example() {
- $params = array(
+ $params = [
'id' => 3,
- );
+ ];
try{
$result = civicrm_api3('Website', 'delete', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function website_delete_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => 1,
- );
+ ];
return $expectedResult;
}
* API result array
*/
function website_get_example() {
- $params = array(
+ $params = [
'contact_id' => 4,
'url' => 'website.com',
'website_type_id' => 1,
- );
+ ];
try{
$result = civicrm_api3('Website', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function website_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => [
+ '2' => [
'id' => '2',
'contact_id' => '4',
'url' => 'website.com',
'website_type_id' => '1',
- ),
- ),
- );
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function website_getfields_example() {
- $params = array(
+ $params = [
'action' => 'get',
- );
+ ];
try{
$result = civicrm_api3('Website', 'getfields', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function website_getfields_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 4,
- 'values' => array(
- 'id' => array(
+ 'values' => [
+ 'id' => [
'name' => 'id',
'type' => 1,
'title' => 'Website ID',
'table_name' => 'civicrm_website',
'entity' => 'Website',
'bao' => 'CRM_Core_BAO_Website',
- 'api.aliases' => array(
+ 'api.aliases' => [
'0' => 'website_id',
- ),
- ),
- 'contact_id' => array(
+ ],
+ ],
+ 'contact_id' => [
'name' => 'contact_id',
'type' => 1,
'title' => 'Contact',
'bao' => 'CRM_Core_BAO_Website',
'FKClassName' => 'CRM_Contact_DAO_Contact',
'FKApiName' => 'Contact',
- ),
- 'url' => array(
+ ],
+ 'url' => [
'name' => 'url',
'type' => 2,
'title' => 'Website',
'table_name' => 'civicrm_website',
'entity' => 'Website',
'bao' => 'CRM_Core_BAO_Website',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => 128,
'size' => 30,
- ),
- ),
- 'website_type_id' => array(
+ ],
+ ],
+ 'website_type_id' => [
'name' => 'website_type_id',
'type' => 1,
'title' => 'Website Type',
'table_name' => 'civicrm_website',
'entity' => 'Website',
'bao' => 'CRM_Core_BAO_Website',
- 'html' => array(
+ 'html' => [
'type' => 'Select',
'size' => 6,
'maxlength' => 14,
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'optionGroupName' => 'website_type',
'optionEditPath' => 'civicrm/admin/options/website_type',
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* API result array
*/
function website_get_example() {
- $params = array(
- 'options' => array(
- 'metadata' => array(
+ $params = [
+ 'options' => [
+ 'metadata' => [
'0' => 'fields',
- ),
- ),
- );
+ ],
+ ],
+ ];
try{
$result = civicrm_api3('Website', 'get', $params);
$errorMessage = $e->getMessage();
$errorCode = $e->getErrorCode();
$errorData = $e->getExtraParams();
- return array(
+ return [
'is_error' => 1,
'error_message' => $errorMessage,
'error_code' => $errorCode,
'error_data' => $errorData,
- );
+ ];
}
return $result;
*/
function website_get_expectedresult() {
- $expectedResult = array(
+ $expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 0,
- 'values' => array(),
- 'metadata' => array(
- 'fields' => array(
- 'id' => array(
+ 'values' => [],
+ 'metadata' => [
+ 'fields' => [
+ 'id' => [
'name' => 'id',
'type' => '1',
'title' => 'Website ID',
'table_name' => 'civicrm_website',
'entity' => 'Website',
'bao' => 'CRM_Core_BAO_Website',
- 'api.aliases' => array(
+ 'api.aliases' => [
'0' => 'website_id',
- ),
- ),
- 'contact_id' => array(
+ ],
+ ],
+ 'contact_id' => [
'name' => 'contact_id',
'type' => '1',
'title' => 'Contact',
'bao' => 'CRM_Core_BAO_Website',
'FKClassName' => 'CRM_Contact_DAO_Contact',
'FKApiName' => 'Contact',
- ),
- 'url' => array(
+ ],
+ 'url' => [
'name' => 'url',
'type' => '2',
'title' => 'Website',
'table_name' => 'civicrm_website',
'entity' => 'Website',
'bao' => 'CRM_Core_BAO_Website',
- 'html' => array(
+ 'html' => [
'type' => 'Text',
'maxlength' => '128',
'size' => '30',
- ),
- ),
- 'website_type_id' => array(
+ ],
+ ],
+ 'website_type_id' => [
'name' => 'website_type_id',
'type' => '1',
'title' => 'Website Type',
'table_name' => 'civicrm_website',
'entity' => 'Website',
'bao' => 'CRM_Core_BAO_Website',
- 'html' => array(
+ 'html' => [
'type' => 'Select',
'size' => '6',
'maxlength' => '14',
- ),
- 'pseudoconstant' => array(
+ ],
+ 'pseudoconstant' => [
'optionGroupName' => 'website_type',
'optionEditPath' => 'civicrm/admin/options/website_type',
- ),
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ],
+ ];
return $expectedResult;
}
* @param array $keyoptions
* List of required fields options. One of the options is required.
*/
-function civicrm_api3_verify_one_mandatory($params, $daoName = NULL, $keyoptions = array()) {
- $keys = array(array());
+function civicrm_api3_verify_one_mandatory($params, $daoName = NULL, $keyoptions = []) {
+ $keys = [[]];
foreach ($keyoptions as $key) {
$keys[0][] = $key;
}
*
* @throws \API_Exception
*/
-function civicrm_api3_verify_mandatory($params, $daoName = NULL, $keys = array(), $verifyDAO = TRUE) {
- $unmatched = array();
+function civicrm_api3_verify_mandatory($params, $daoName = NULL, $keys = [], $verifyDAO = TRUE) {
+ $unmatched = [];
if (!empty($params['id'])) {
- $keys = array('version');
+ $keys = ['version'];
}
else {
if (!in_array('version', $keys)) {
foreach ($keys as $key) {
if (is_array($key)) {
$match = 0;
- $optionset = array();
+ $optionset = [];
foreach ($key as $subkey) {
if (!array_key_exists($subkey, $params) || empty($params[$subkey])) {
$optionset[] = $subkey;
}
}
if (!empty($unmatched)) {
- throw new API_Exception("Mandatory key(s) missing from params array: " . implode(", ", $unmatched), "mandatory_missing", array("fields" => $unmatched));
+ throw new API_Exception("Mandatory key(s) missing from params array: " . implode(", ", $unmatched), "mandatory_missing", ["fields" => $unmatched]);
}
}
*
* @return array
*/
-function civicrm_api3_create_error($msg, $data = array()) {
+function civicrm_api3_create_error($msg, $data = []) {
$data['is_error'] = 1;
$data['error_message'] = $msg;
*
* @return array
*/
-function civicrm_api3_create_success($values = 1, $params = array(), $entity = NULL, $action = NULL, &$dao = NULL, $extraReturnValues = array()) {
- $result = array();
+function civicrm_api3_create_success($values = 1, $params = [], $entity = NULL, $action = NULL, &$dao = NULL, $extraReturnValues = []) {
+ $result = [];
$lowercase_entity = _civicrm_api_get_entity_name_from_camel($entity);
// TODO: This shouldn't be necessary but this fn sometimes gets called with lowercase entity
$entity = _civicrm_api_get_camel_name($entity);
if (is_array($params) && !empty($params['debug'])) {
if (is_string($action) && $action != 'getfields') {
- $apiFields = civicrm_api($entity, 'getfields', array('version' => 3, 'action' => $action) + $params);
+ $apiFields = civicrm_api($entity, 'getfields', ['version' => 3, 'action' => $action] + $params);
}
elseif ($action != 'getfields') {
- $apiFields = civicrm_api($entity, 'getfields', array('version' => 3) + $params);
+ $apiFields = civicrm_api($entity, 'getfields', ['version' => 3] + $params);
}
else {
$apiFields = FALSE;
}
- $allFields = array();
+ $allFields = [];
if ($action != 'getfields' && is_array($apiFields) && is_array(CRM_Utils_Array::value('values', $apiFields))) {
$allFields = array_keys($apiFields['values']);
}
$paramFields = array_keys($params);
- $undefined = array_diff($paramFields, $allFields, array_keys($_COOKIE), array(
+ $undefined = array_diff($paramFields, $allFields, array_keys($_COOKIE), [
'action',
'entity',
'debug',
'option_sort',
'options',
'prettyprint',
- ));
+ ]);
if ($undefined) {
$result['undefined_fields'] = array_merge($undefined);
}
if (!empty($params['options']['metadata'])) {
// We've made metadata an array but only supporting 'fields' atm.
if (in_array('fields', (array) $params['options']['metadata']) && $action !== 'getfields') {
- $fields = civicrm_api3($entity, 'getfields', array(
+ $fields = civicrm_api3($entity, 'getfields', [
'action' => substr($action, 0, 3) == 'get' ? 'get' : 'create',
- ));
+ ]);
$result['metadata']['fields'] = $fields['values'];
}
}
$deprecated = _civicrm_api3_deprecation_check($entity, $result);
// Always report "setvalue" action as deprecated.
if (!is_string($deprecated) && ($action == 'getactions' || $action == 'setvalue')) {
- $deprecated = ((array) $deprecated) + array('setvalue' => 'The "setvalue" action is deprecated. Use "create" with an id instead.');
+ $deprecated = ((array) $deprecated) + ['setvalue' => 'The "setvalue" action is deprecated. Use "create" with an id instead.'];
}
// Always report "update" action as deprecated.
if (!is_string($deprecated) && ($action == 'getactions' || $action == 'update')) {
- $deprecated = ((array) $deprecated) + array('update' => 'The "update" action is deprecated. Use "create" with an id instead.');
+ $deprecated = ((array) $deprecated) + ['update' => 'The "update" action is deprecated. Use "create" with an id instead.'];
}
if ($deprecated) {
// Metadata-level deprecations or wholesale entity deprecations.
* @param array $values
*/
function _civicrm_api3_filter_fields_for_bao($entity, &$params, &$values) {
- $fields = civicrm_api($entity, 'getfields', array('version' => 3, 'action' => 'create'));
+ $fields = civicrm_api($entity, 'getfields', ['version' => 3, 'action' => 'create']);
$fields = $fields['values'];
_civicrm_api3_store_values($fields, $params, $values);
}
* @return array
*/
function _civicrm_api3_field_names($fields) {
- $result = array();
+ $result = [];
foreach ($fields as $key => $value) {
if (!empty($value['name'])) {
$result[] = $value['name'];
* @return array
* @throws API_Exception
*/
-function _civicrm_api3_get_using_query_object($entity, $params, $additional_options = array(), $getCount = NULL, $mode = 1, $defaultReturnProperties = NULL) {
+function _civicrm_api3_get_using_query_object($entity, $params, $additional_options = [], $getCount = NULL, $mode = 1, $defaultReturnProperties = NULL) {
$lowercase_entity = _civicrm_api_get_entity_name_from_camel($entity);
// Convert id to e.g. contact_id
if (empty($params[$lowercase_entity . '_id']) && isset($params['id'])) {
$options = _civicrm_api3_get_options_from_params($params, TRUE);
$inputParams = array_merge(
- CRM_Utils_Array::value('input_params', $options, array()),
- CRM_Utils_Array::value('input_params', $additional_options, array())
+ CRM_Utils_Array::value('input_params', $options, []),
+ CRM_Utils_Array::value('input_params', $additional_options, [])
);
$returnProperties = array_merge(
- CRM_Utils_Array::value('return', $options, array()),
- CRM_Utils_Array::value('return', $additional_options, array())
+ CRM_Utils_Array::value('return', $options, []),
+ CRM_Utils_Array::value('return', $additional_options, [])
);
if (empty($returnProperties)) {
$returnProperties = $defaultReturnProperties;
}
if (!empty($params['check_permissions'])) {
// we will filter query object against getfields
- $fields = civicrm_api($entity, 'getfields', array('version' => 3, 'action' => 'get'));
+ $fields = civicrm_api($entity, 'getfields', ['version' => 3, 'action' => 'get']);
// we need to add this in as earlier in this function 'id' was unset in favour of $entity_id
- $fields['values'][$lowercase_entity . '_id'] = array();
- $varsToFilter = array('returnProperties', 'inputParams');
+ $fields['values'][$lowercase_entity . '_id'] = [];
+ $varsToFilter = ['returnProperties', 'inputParams'];
foreach ($varsToFilter as $varToFilter) {
if (!is_array($$varToFilter)) {
continue;
$sort = CRM_Utils_Array::value('sort', $options, NULL);
$offset = CRM_Utils_Array::value('offset', $options);
$rowCount = CRM_Utils_Array::value('limit', $options);
- $inputParams = CRM_Utils_Array::value('input_params', $options, array());
+ $inputParams = CRM_Utils_Array::value('input_params', $options, []);
$returnProperties = CRM_Utils_Array::value('return', $options, NULL);
if (empty($returnProperties)) {
$returnProperties = CRM_Contribute_BAO_Query::defaultReturnProperties($mode);
$sql .= " LIMIT $offset, $rowCount ";
}
$dao = CRM_Core_DAO::executeQuery($sql);
- return array($dao, $query);
+ return [$dao, $query];
}
/**
* @throws API_Exception
* @throws Exception
*/
-function _civicrm_api3_dao_set_filter(&$dao, $params, $unique = TRUE, $extraSql = array()) {
+function _civicrm_api3_dao_set_filter(&$dao, $params, $unique = TRUE, $extraSql = []) {
$entity = _civicrm_api_get_entity_name_from_dao($dao);
$lowercase_entity = _civicrm_api_get_entity_name_from_camel($entity);
if (!empty($params[$lowercase_entity . "_id"]) && empty($params['id'])) {
}
}
if (!$fields) {
- $fields = array();
+ $fields = [];
}
foreach ($fields as $field) {
$sort = CRM_Utils_Array::value('sort', $params['options'], $sort);
}
- $returnProperties = array();
+ $returnProperties = [];
// handle the format return =sort_name,display_name...
if (array_key_exists('return', $params)) {
if (is_array($params['return'])) {
}
}
- $options = array(
+ $options = [
'offset' => CRM_Utils_Rule::integer($offset) ? $offset : NULL,
'limit' => (!$is_count && CRM_Utils_Rule::integer($limit)) ? $limit : NULL,
'is_count' => $is_count,
- 'return' => !empty($returnProperties) ? $returnProperties : array(),
- );
+ 'return' => !empty($returnProperties) ? $returnProperties : [],
+ ];
- $finalSort = array();
+ $finalSort = [];
$options['sort'] = NULL;
if (!empty($sort)) {
if (!is_array($sort)) {
}
//here comes the legacy support for $returnProperties, $inputParams e.g for contat_get
// if the query object is being used this should be used
- $inputParams = array();
- $legacyreturnProperties = array();
- $otherVars = array(
+ $inputParams = [];
+ $legacyreturnProperties = [];
+ $otherVars = [
'sort', 'offset', 'rowCount', 'options', 'return',
'version', 'prettyprint', 'check_permissions', 'sequential',
- );
+ ];
foreach ($params as $n => $v) {
if (substr($n, 0, 7) == 'return.') {
$legacyreturnProperties[substr($n, 7)] = $v;
* @return array
*/
function _civicrm_api3_dao_to_array($dao, $params = NULL, $uniqueFields = TRUE, $entity = "", $autoFind = TRUE) {
- $result = array();
+ $result = [];
if (isset($params['options']) && !empty($params['options']['is_count'])) {
return $dao->count();
}
if (empty($dao)) {
- return array();
+ return [];
}
if ($autoFind && !$dao->find()) {
- return array();
+ return [];
}
if (isset($dao->count)) {
$fields = array_keys(_civicrm_api3_build_fields_array($dao, FALSE));
while ($dao->fetch()) {
- $tmp = array();
+ $tmp = [];
foreach ($fields as $key) {
if (array_key_exists($key, $dao)) {
// not sure on that one
* ID of entity per $extends.
*/
function _civicrm_api3_custom_format_params($params, &$values, $extends, $entityId = NULL) {
- $values['custom'] = array();
+ $values['custom'] = [];
$checkCheckBoxField = FALSE;
$entity = $extends;
- if (in_array($extends, array('Household', 'Individual', 'Organization'))) {
+ if (in_array($extends, ['Household', 'Individual', 'Organization'])) {
$entity = 'Contact';
}
- $fields = civicrm_api($entity, 'getfields', array('version' => 3, 'action' => 'create'));
+ $fields = civicrm_api($entity, 'getfields', ['version' => 3, 'action' => 'create']);
if (!$fields['is_error']) {
// not sure if fields could be error - maybe change to using civicrm_api3 wrapper later - this is conservative
$fields = $fields['values'];
* @param $entity
*/
function _civicrm_api3_format_params_for_create(&$params, $entity) {
- $nonGenericEntities = array('Contact', 'Individual', 'Household', 'Organization');
+ $nonGenericEntities = ['Contact', 'Individual', 'Household', 'Organization'];
$customFieldEntities = array_diff_key(CRM_Core_SelectValues::customGroupExtends(), array_fill_keys($nonGenericEntities, 1));
if (!array_key_exists($entity, $customFieldEntities)) {
return;
}
- $values = array();
+ $values = [];
_civicrm_api3_custom_format_params($params, $values, $entity);
$params = array_merge($params, $values);
}
// We can assume it's pre-formatted.
return;
}
- $options = civicrm_api($entity, 'getoptions', array('field' => $customFieldLabel, 'version' => 3));
+ $options = civicrm_api($entity, 'getoptions', ['field' => $customFieldLabel, 'version' => 3]);
if (!empty($options['is_error'])) {
// The check is precautionary - can probably be removed later.
return;
$query = new \Civi\API\Api3SelectQuery($entity, CRM_Utils_Array::value('check_permissions', $params, FALSE));
$query->where = $params;
if ($options['is_count']) {
- $query->select = array('count_rows');
+ $query->select = ['count_rows'];
}
else {
$query->select = array_keys(array_filter($options['return']));
_civicrm_api3_format_params_for_create($params, $entity);
$args = array(&$params);
if ($entity) {
- $ids = array($entity => CRM_Utils_Array::value('id', $params));
+ $ids = [$entity => CRM_Utils_Array::value('id', $params)];
$args[] = &$ids;
}
if (method_exists($bao_name, 'create')) {
$fct = 'create';
$fct_name = $bao_name . '::' . $fct;
- $bao = call_user_func_array(array($bao_name, $fct), $args);
+ $bao = call_user_func_array([$bao_name, $fct], $args);
}
elseif (method_exists($bao_name, 'add')) {
$fct = 'add';
$fct_name = $bao_name . '::' . $fct;
- $bao = call_user_func_array(array($bao_name, $fct), $args);
+ $bao = call_user_func_array([$bao_name, $fct], $args);
}
else {
$fct_name = '_civicrm_api3_basic_create_fallback';
if (isset($params['custom']) && empty(CRM_Core_BAO_CustomQuery::$extendsMap[$entity])) {
CRM_Core_BAO_CustomValueTable::store($params['custom'], CRM_Core_DAO_AllCoreTables::getTableForClass(CRM_Core_DAO_AllCoreTables::getFullName($entity)), $bao->id);
}
- $values = array();
+ $values = [];
_civicrm_api3_object_to_array($bao, $values[$bao->id]);
return civicrm_api3_create_success($values, $params, $entity, 'create', $bao);
}
}
$entityName = CRM_Core_DAO_AllCoreTables::getBriefName($dao_name);
if (empty($entityName)) {
- throw new API_Exception("Class \"$bao_name\" does not map to an entity name", "unmapped_class_to_entity", array(
+ throw new API_Exception("Class \"$bao_name\" does not map to an entity name", "unmapped_class_to_entity", [
'class_name' => $bao_name,
- ));
+ ]);
}
$hook = empty($params['id']) ? 'create' : 'edit';
* @throws \Civi\API\Exception\UnauthorizedException
*/
function _civicrm_api3_basic_delete($bao_name, &$params) {
- civicrm_api3_verify_mandatory($params, NULL, array('id'));
- _civicrm_api3_check_edit_permissions($bao_name, array('id' => $params['id']));
+ civicrm_api3_verify_mandatory($params, NULL, ['id']);
+ _civicrm_api3_check_edit_permissions($bao_name, ['id' => $params['id']]);
$args = array(&$params['id']);
if (method_exists($bao_name, 'del')) {
$dao = new $bao_name();
$dao->id = $params['id'];
if ($dao->find()) {
- $bao = call_user_func_array(array($bao_name, 'del'), $args);
+ $bao = call_user_func_array([$bao_name, 'del'], $args);
if ($bao !== FALSE) {
return civicrm_api3_create_success();
}
$checkPermission
);
$groupTree = CRM_Core_BAO_CustomGroup::formatGroupTree($groupTree, 1);
- $customValues = array();
+ $customValues = [];
CRM_Core_BAO_CustomGroup::setDefaults($groupTree, $customValues);
- $fieldInfo = array();
+ $fieldInfo = [];
foreach ($groupTree as $set) {
$fieldInfo += $set['fields'];
}
* @return array $errors
*/
function _civicrm_api3_validate($entity, $action, $params) {
- $errors = array();
- $fields = civicrm_api3($entity, 'getfields', array('sequential' => 1, 'api_action' => $action));
+ $errors = [];
+ $fields = civicrm_api3($entity, 'getfields', ['sequential' => 1, 'api_action' => $action]);
$fields = $fields['values'];
// Check for required fields.
foreach ($fields as $values) {
if (!empty($values['api.required']) && empty($params[$values['name']])) {
- $errors[$values['name']] = array(
+ $errors[$values['name']] = [
'message' => "Mandatory key(s) missing from params array: " . $values['name'],
'code' => "mandatory_missing",
- );
+ ];
}
}
// Select only the fields which have been input as a param.
- $finalfields = array();
+ $finalfields = [];
foreach ($fields as $values) {
if (array_key_exists($values['name'], $params)) {
$finalfields[] = $values;
_civicrm_api3_validate_switch_cases($fieldName, $fieldInfo, $entity, $params);
}
catch (Exception $e) {
- $errors[$fieldName] = array(
+ $errors[$fieldName] = [
'message' => $e->getMessage(),
'code' => 'incorrect_value',
- );
+ ];
}
}
- return array($errors);
+ return [$errors];
}
/**
if (strpos($op, 'NULL') !== FALSE || strpos($op, 'EMPTY') !== FALSE) {
return;
}
- $existing = civicrm_api($params['entity'], 'get', array(
+ $existing = civicrm_api($params['entity'], 'get', [
'version' => $params['version'],
$fieldName => $fieldValue,
- ));
+ ]);
// an entry already exists for this unique field
if ($existing['count'] == 1) {
// question - could this ever be a security issue?
}
// Save the new/updated records
- $creates = array();
+ $creates = [];
foreach ($params['values'] as $replacement) {
// Sugar: Don't force clients to duplicate the 'key' data
$replacement = array_merge($baseParams, $replacement);
array_keys($creates)
);
foreach ($staleIDs as $staleID) {
- $delete = civicrm_api($entity, 'delete', array(
+ $delete = civicrm_api($entity, 'delete', [
'version' => $params['version'],
'id' => $staleID,
- ));
+ ]);
if (civicrm_error($delete)) {
$transaction->rollback();
return $delete;
*
* @return array
*/
-function _civicrm_api_get_fields($entity, $unique = FALSE, &$params = array()) {
- $unsetIfEmpty = array(
+function _civicrm_api_get_fields($entity, $unique = FALSE, &$params = []) {
+ $unsetIfEmpty = [
'dataPattern',
'headerPattern',
'default',
'export',
'import',
- );
+ ];
$dao = _civicrm_api3_get_DAO($entity);
if (empty($dao)) {
- return array();
+ return [];
}
$d = new $dao();
$fields = $d->fields();
FALSE
);
- $ret = array();
+ $ret = [];
foreach ($customfields as $key => $value) {
// Regular fields have a 'name' property
if (!is_numeric($fieldValue) && is_scalar($fieldValue)) {
$realContactId = _civicrm_api3_resolve_contactID($fieldValue);
if ('unknown-user' === $realContactId) {
- throw new API_Exception("\"$fieldName\" \"{$fieldValue}\" cannot be resolved to a contact ID", 2002, array('error_field' => $fieldName, "type" => "integer"));
+ throw new API_Exception("\"$fieldName\" \"{$fieldValue}\" cannot be resolved to a contact ID", 2002, ['error_field' => $fieldName, "type" => "integer"]);
}
elseif (is_numeric($realContactId)) {
$fieldValue = $realContactId;
}
}
if (!empty($fieldInfo['pseudoconstant']) || !empty($fieldInfo['options'])) {
- $additional_lookup_params = array();
+ $additional_lookup_params = [];
if (strtolower($entity) == 'address' && $fieldName == 'state_province_id' && !empty($params['country_id'])) {
$additional_lookup_params = ['country_id' => $params['country_id']];
}
// After swapping options, ensure we have an integer(s)
foreach ((array) ($fieldValue) as $value) {
if ($value && !is_numeric($value) && $value !== 'null' && $value !== NULL && !is_array($value)) {
- throw new API_Exception("$fieldName is not a valid integer", 2001, array('error_field' => $fieldName, "type" => "integer"));
+ throw new API_Exception("$fieldName is not a valid integer", 2001, ['error_field' => $fieldName, "type" => "integer"]);
}
}
if (is_string($fieldValue) && !empty($fieldInfo['maxlength']) && strlen($fieldValue) > $fieldInfo['maxlength']
) {
throw new API_Exception($fieldValue . " is " . strlen($fieldValue) . " characters - longer than $fieldName length" . $fieldInfo['maxlength'] . ' characters',
- 2100, array('field' => $fieldName, "max_length" => $fieldInfo['maxlength'])
+ 2100, ['field' => $fieldName, "max_length" => $fieldInfo['maxlength']]
);
}
}
}
if ($fieldValue) {
if (!CRM_Utils_Rule::xssString($fieldValue)) {
- throw new API_Exception('Input contains illegal SCRIPT tag.', array("field" => $fieldName, "error_code" => "xss"));
+ throw new API_Exception('Input contains illegal SCRIPT tag.', ["field" => $fieldName, "error_code" => "xss"]);
}
}
}
// Check our field length
elseif (is_string($fieldValue) && !empty($fieldInfo['maxlength']) && strlen(utf8_decode($fieldValue)) > $fieldInfo['maxlength']) {
throw new API_Exception("Value for $fieldName is " . strlen(utf8_decode($value)) . " characters - This field has a maxlength of {$fieldInfo['maxlength']} characters.",
- 2100, array('field' => $fieldName)
+ 2100, ['field' => $fieldName]
);
}
*
* @throws \API_Exception
*/
-function _civicrm_api3_api_match_pseudoconstant(&$fieldValue, $entity, $fieldName, $fieldInfo, $op = '=', $additional_lookup_params = array()) {
- if (in_array($op, array('>', '<', '>=', '<=', 'LIKE', 'NOT LIKE'))) {
+function _civicrm_api3_api_match_pseudoconstant(&$fieldValue, $entity, $fieldName, $fieldInfo, $op = '=', $additional_lookup_params = []) {
+ if (in_array($op, ['>', '<', '>=', '<=', 'LIKE', 'NOT LIKE'])) {
return;
}
}
$options = civicrm_api($entity, 'getoptions', $options_lookup_params);
- $options = CRM_Utils_Array::value('values', $options, array());
+ $options = CRM_Utils_Array::value('values', $options, []);
}
// If passed a value-separated string, explode to an array, then re-implode after matching values.
// CiviMagic syntax for Nulling out the field - let it through.
return;
}
- throw new API_Exception("'$value' is not a valid option for field $fieldName", 2001, array('error_field' => $fieldName));
+ throw new API_Exception("'$value' is not a valid option for field $fieldName", 2001, ['error_field' => $fieldName]);
}
$value = $newValue;
}
if ($fieldName == _civicrm_api_get_entity_name_from_camel($entity) . '_id') {
return 'id';
}
- $result = civicrm_api($entity, 'getfields', array(
+ $result = civicrm_api($entity, 'getfields', [
'version' => 3,
'action' => $action,
- ));
+ ]);
$meta = $result['values'];
if (!isset($meta[$fieldName]['name']) && isset($meta[$fieldName . '_id'])) {
$fieldName = $fieldName . '_id';
if ($fieldName == $info['name'] || $fieldName == CRM_Utils_Array::value('uniqueName', $info)) {
return $info['name'];
}
- if (array_search($fieldName, CRM_Utils_Array::value('api.aliases', $info, array())) !== FALSE) {
+ if (array_search($fieldName, CRM_Utils_Array::value('api.aliases', $info, [])) !== FALSE) {
return $info['name'];
}
}
*
* @return string|array|null
*/
-function _civicrm_api3_deprecation_check($entity, $result = array()) {
+function _civicrm_api3_deprecation_check($entity, $result = []) {
if ($entity) {
$apiFile = "api/v3/$entity.php";
if (CRM_Utils_File::isIncludable($apiFile)) {
$op = key($fieldValue);
$fieldValue = CRM_Utils_Array::value($op, $fieldValue);
}
- return array($fieldValue, $op);
+ return [$fieldValue, $op];
}
/**
$offset = CRM_Utils_Array::value('offset', $options);
$limit = CRM_Utils_Array::value('limit', $options);
- $matches = array();
+ $matches = [];
$currentOffset = 0;
foreach ($records as $record) {
}
}
- $return = CRM_Utils_Array::value('return', $options, array());
+ $return = CRM_Utils_Array::value('return', $options, []);
if (!empty($return)) {
$return['id'] = 1;
$matches = CRM_Utils_Array::filterColumns($matches, array_keys($return));
// For lack of something more clever, here's a whitelist of entities whos permissions
// are inherited from a contact record.
// Note, when adding here, also remember to modify _civicrm_api3_permissions()
- $contactEntities = array(
+ $contactEntities = [
'CRM_Core_BAO_Email',
'CRM_Core_BAO_Phone',
'CRM_Core_BAO_Address',
'CRM_Core_BAO_IM',
'CRM_Core_BAO_Website',
'CRM_Core_BAO_OpenID',
- );
+ ];
if (!empty($params['check_permissions']) && in_array($bao_name, $contactEntities)) {
$cid = !empty($params['contact_id']) ? $params['contact_id'] : CRM_Core_DAO::getFieldValue($bao_name, $params['id'], 'contact_id');
if (!CRM_Contact_BAO_Contact_Permission::allow($cid, CRM_Core_Permission::EDIT)) {
* @return bool
*/
function _civicrm_api3_compare_timestamps($modifiedDate, $id, $entity) {
- $currentDbInfo = civicrm_api3($entity, 'getsingle', array('id' => $id));
+ $currentDbInfo = civicrm_api3($entity, 'getsingle', ['id' => $id]);
if (strtotime($currentDbInfo['modified_date']) <= strtotime($modifiedDate)) {
return TRUE;
}