return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'EntityRole');
}
-
/**
* AclRole create metadata.
*
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'ActionSchedule');
}
-
/**
* Create a new ActionSchedule.
*
* @package CiviCRM_APIv3
*/
-
/**
* Creates or updates an Activity.
*
* @param array $params
* Array per getfields documentation.
*
- * @return array API result array
+ * @return array
* API result array
*
* @throws \API_Exception
$typeMap = [
$assigneeType => 'assignee',
$sourceType => 'source',
- $targetType => 'target'
+ $targetType => 'target',
];
$activityContactTypes = [$sourceType];
'activity_id',
'record_type_id',
'contact_id.display_name',
- 'contact_id'
+ 'contact_id',
],
'check_permissions' => !empty($params['check_permissions']),
];
}
}
-
/**
* Delete a specified Activity.
*
// Would be hard to securely handle changes.
$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
+ // would be hard to securely handle changes
+ $spec['entity_id']['title'] = CRM_Utils_Array::value('title', $spec['entity_id'], 'Entity ID') . ' (write-once)';
$spec['url'] = [
'title' => 'URL (read-only)',
'description' => 'URL for downloading the file (not searchable, expire-able)',
* @package CiviCRM_APIv3
*/
-
/**
* Open a new case, add client and manager roles, and standard timeline.
*
if (empty($params['id'])) {
// Creating a new case, so make sure we have the necessary parameters
civicrm_api3_verify_mandatory($params, NULL, [
- 'contact_id',
- 'subject',
- ['case_type', 'case_type_id'],
- ]
- );
+ 'contact_id',
+ 'subject',
+ ['case_type', 'case_type_id'],
+ ]);
}
else {
// Update an existing case
}
}
-
/**
* It actually works a lot better to use the CaseContact api instead of the Case api
* for entityRef fields so we can perform the necessary joins,
}
// This is an existing case-type.
if (!empty($params['id']) && isset($params['definition'])
- && !CRM_Case_BAO_CaseType::isForked($params['id']) // which is not yet forked
- && !CRM_Case_BAO_CaseType::isForkable($params['id']) // for which new forks are prohibited
+ // which is not yet forked
+ && !CRM_Case_BAO_CaseType::isForked($params['id'])
+ // for which new forks are prohibited
+ && !CRM_Case_BAO_CaseType::isForkable($params['id'])
) {
unset($params['definition']);
}
}
}
-
/**
* Check parameters passed in.
*
case 'individual':
civicrm_api3_verify_one_mandatory($params, NULL, [
- 'first_name',
- 'last_name',
- 'email',
- 'display_name',
- ]
- );
+ 'first_name',
+ 'last_name',
+ 'email',
+ 'display_name',
+ ]);
break;
}
return civicrm_api3_create_success($contacts, $params, 'Contact', 'get_by_location', $dao);
}
-
/**
* Get parameters for getlist function.
*
return _ipn_process_transaction($params, $contribution, $input, $ids, $original_contribution);
}
- catch(Exception $e) {
+ catch (Exception $e) {
throw new API_Exception('failed to load related objects' . $e->getMessage() . "\n" . $e->getTraceAsString());
}
}
break;
}
- if (in_array($htmlType, [
- 'Select', 'Multi-Select', 'CheckBox', 'Radio']) &&
- !isset($errors[$fieldName])
+ 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)) {
* @package CiviCRM_APIv3
*/
-
/**
* Sets custom values for an entity.
*
return civicrm_api3_create_success($result, $params, 'Cxn', 'create');
}
- catch(Exception $ex){
+ catch (Exception $ex) {
throw $ex;
}
}
+--------------------------------------------------------------------+
*/
-use \Civi\Cxn\Rpc\Message\AppMetasMessage;
-use \Civi\Cxn\Rpc\Message\GarbledMessage;
+use Civi\Cxn\Rpc\Message\AppMetasMessage;
+use Civi\Cxn\Rpc\Message\GarbledMessage;
/**
* The CxnApp API provides a pseudo-entity for exploring the list
* @package CiviCRM_APIv3
*/
-
/**
* Creates or updates an Dashlet.
*
*/
function civicrm_api3_dashboard_create($params) {
civicrm_api3_verify_one_mandatory($params, NULL, [
- 'name',
- 'label',
- 'url',
- 'fullscreen_url',
- ]
- );
+ 'name',
+ 'label',
+ 'url',
+ 'fullscreen_url',
+ ]);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Dashboard');
}
if (!empty($values['location']['phone'])) {
$domain['domain_phone'] = [
'phone_type' => CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_Phone', 'phone_type_id',
- CRM_Utils_Array::value(
- 'phone_type_id',
- $values['location']['phone'][1]
- )
- ),
- 'phone' => CRM_Utils_Array::value(
- 'phone',
- $values['location']['phone'][1]
- ),
- ];
+ CRM_Utils_Array::value('phone_type_id', $values['location']['phone'][1])),
+ 'phone' => CRM_Utils_Array::value('phone', $values['location']['phone'][1]),
+ ];
}
if (!empty($values['location']['address'])) {
return civicrm_api3_create_success($result, $params, 'EntityTag', 'replace');
}
- catch(Exception $e) {
+ catch (Exception $e) {
$transaction->rollback();
return civicrm_api3_create_error($e->getMessage());
}
$event[$event_id]['is_full'] = $event[$event_id]['available_places'] == 0 ? 1 : 0;
}
-
/**
* Get event list parameters.
*
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
+
/**
* Get a Dedupe Exception.
*
function civicrm_api3_exception_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
+
/**
* Create or update an dedupe exception.
*
if ($params['local']) {
$system->getManager()->refresh();
- $system->getManager()->getStatuses(); // force immediate scan
+ // force immediate scan
+ $system->getManager()->getStatuses();
}
if ($params['remote']) {
if ($system->getBrowser()->isEnabled() && empty($system->getBrowser()->checkRequirements)) {
$system->getBrowser()->refresh();
- $system->getBrowser()->getExtensions(); // force immediate download
+ // force immediate download
+ $system->getBrowser()->getExtensions();
}
}
continue;
}
$info = CRM_Extension_System::createExtendedInfo($obj);
- $info['id'] = $id++; // backward compatibility with indexing scheme
+ // backward compatibility with indexing scheme
+ $info['id'] = $id++;
if (!empty($keys)) {
if (in_array($key, $keys)) {
$result[] = $info;
$id = 0;
foreach ($extensions as $key => $obj) {
$info = [];
- $info['id'] = $id++; // backward compatibility with indexing scheme
+ // backward compatibility with indexing scheme
+ $info['id'] = $id++;
$info = array_merge($info, (array) $obj);
$result[] = $info;
}
'api.required' => 1,
'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
$fields = civicrm_api($entity, 'getFields', [
'version' => 3,
'action' => 'create',
- "sequential"]
- );
+ ]);
// getfields error, shouldn't happen.
if ($fields['is_error']) {
return $fields;
* @package CiviCRM_APIv3
*/
-
/**
* Get group organization record/s.
*
return civicrm_api3_create_error($result['messages']);
}
}
+
/**
* Adjust metadata for "send_reminder" action.
*
'title' => 'Action Schedule ID',
];
}
+
/**
* Execute a specific report instance and send the output via email.
*
}
}
-
/**
* This api checks and updates the status of all membership records for a given domain.
*
_civicrm_api3_object_to_array($dao, $values[$dao->id]);
return civicrm_api3_create_success($values, $params, 'LocBlock', 'create', $dao);
}
- throw New API_Exception('Unable to create LocBlock. Please check your params.');
+ throw new API_Exception('Unable to create LocBlock. Please check your params.');
}
/**
* @param array $params
*
* @return array
- * API Success Array
+ * API Success Array
* @throws \API_Exception
* @throws \Civi\API\Exception\UnauthorizedException
*/
* @param array $params
*
* @return array
- * API Success Array
+ * API Success Array
* @throws \API_Exception
* @throws \Civi\API\Exception\UnauthorizedException
*/
* @param array $params
*
* @return array
- * API Success Array
+ * API Success Array
* @throws \API_Exception
* @throws \Civi\API\Exception\UnauthorizedException
*/
$params['hash']['api.required'] = 1;
$params['hash']['title'] = 'Hash';
$params['replyTo']['api.required'] = 0;
- $params['replyTo']['title'] = 'Reply To';//doesn't really explain adequately
+ //doesn't really explain adequately
+ $params['replyTo']['title'] = 'Reply To';
}
/**
$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(['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)', ['@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(['e.is_bulkmail DESC', 'e.is_primary DESC'])
- ->toSQL();
+ ->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)', ['@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(['e.is_bulkmail DESC', 'e.is_primary DESC'])
+ ->toSQL();
$dao = CRM_Core_DAO::executeQuery($query);
$emailDetail = [];
// fetch contact_id and email id for all existing emails
throw new API_Exception("Cannot transition to state 'Testing'");
}
civicrm_api3('Mailing', 'submit', $submitParams + [
- 'id' => $dao->mailing_id_a,
- '_skip_evil_bao_auto_recipients_' => 0,
- ]);
+ 'id' => $dao->mailing_id_a,
+ '_skip_evil_bao_auto_recipients_' => 0,
+ ]);
civicrm_api3('Mailing', 'submit', $submitParams + [
- 'id' => $dao->mailing_id_b,
- '_skip_evil_bao_auto_recipients_' => 1,
- ]);
+ 'id' => $dao->mailing_id_b,
+ '_skip_evil_bao_auto_recipients_' => 1,
+ ]);
CRM_Mailing_BAO_MailingAB::distributeRecipients($dao);
break;
throw new API_Exception("Cannot transition to state 'Final'");
}
civicrm_api3('Mailing', 'submit', $submitParams + [
- 'id' => $dao->mailing_id_c,
- '_skip_evil_bao_auto_recipients_' => 1,
- ]);
+ 'id' => $dao->mailing_id_c,
+ '_skip_evil_bao_auto_recipients_' => 1,
+ ]);
break;
default:
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MailingComponent');
}
-
/**
* Adjust Metadata for Create action.
*
$params['type'] = [
'api.default' => 'Delivered',
- 'title' => 'Type', // doesn't really explain the field - but not sure I understand it to explain it better
+ // doesn't really explain the field - but not sure I understand it to explain it better
+ 'title' => 'Type',
'type' => CRM_Utils_Type::T_STRING,
'options' => [
'Delivered' => 'Delivered',
* @package CiviCRM_APIv3
*/
-
/**
* Returns array of MailingRecipients.
*
return $membershipValues;
}
-
/**
* Non-standard behaviour inherited from v2.
*
*/
function _civicrm_api3_order_cancel_spec(&$params) {
$params['contribution_id'] = [
- 'api.required' => 1 ,
+ 'api.required' => 1,
'title' => 'Contribution ID',
'type' => CRM_Utils_Type::T_INT,
];
}
}
-
/**
* Adjust Metadata for Create action.
*
function _civicrm_api3_payment_create_spec(&$params) {
$params = [
'contribution_id' => [
- 'api.required' => 1 ,
+ 'api.required' => 1,
'title' => 'Contribution ID',
'type' => CRM_Utils_Type::T_INT,
],
'total_amount' => [
- 'api.required' => 1 ,
+ 'api.required' => 1,
'title' => 'Total Payment Amount',
'type' => CRM_Utils_Type::T_FLOAT,
],
function _civicrm_api3_payment_delete_spec(&$params) {
$params = [
'id' => [
- 'api.required' => 1 ,
+ 'api.required' => 1,
'title' => 'Payment ID',
'type' => CRM_Utils_Type::T_INT,
'api.aliases' => ['payment_id'],
function _civicrm_api3_payment_cancel_spec(&$params) {
$params = [
'id' => [
- 'api.required' => 1 ,
+ 'api.required' => 1,
'title' => 'Payment ID',
'type' => CRM_Utils_Type::T_INT,
'api.aliases' => ['payment_id'],
'subject' => $result[1],
'message_txt' => $result[2],
'message_html' => $result[3],
- ]]);
+ ],
+ ]);
}
/**
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
-
/**
* Set default getlist parameters.
*
*
* @package CiviCRM_APIv3
*/
+
/**
* Create or update a survey.
*
'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 = [
}
/**
* putting this on hold -this would cause the api to set the default - but could have unexpected behaviour
- if (isset($result['values'][$realName]['default_value'])) {
- //this would be the case for a custom field with a configured default
- $profileFields[$profileID][$entityfield]['api.default'] = $result['values'][$realName]['default_value'];
- }
+ * if (isset($result['values'][$realName]['default_value'])) {
+ * //this would be the case for a custom field with a configured default
+ * $profileFields[$profileID][$entityfield]['api.default'] = $result['values'][$realName]['default_value'];
+ * }
*/
}
}
'title' => ts('Is Form?'),
'description' => $relationshipTypePrefix . ts('Formats the options for use'
. ' in a form if true. The format is <id>_a_b => <label>'),
- 'type' => CRM_Utils_Type::T_BOOLEAN
+ 'type' => CRM_Utils_Type::T_BOOLEAN,
];
}
'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 = [];
+ $rows = $metadata = $requiredMetadata = [];
$reportInstance->buildRows($sql, $rows);
$reportInstance->formatDisplay($rows);
$reportInstance->cleanUpTemporaryTables();
return civicrm_api3_create_success($stats, $params, 'ReportTemplate', 'getstatistics', CRM_Core_DAO::$_nullObject, $metadata);
}
+
/**
* Adjust metadata for template getrows action.
*
* @param array $params
* Associative array of property name-value pairs to insert in new saved search.
* @example SavedSearch/Create.php Std create example.
- * @return array api result array
+ * @return array
+ * api result array
* {@getfields saved_search_create}
* @access public
*/
* Associative array of property name-value pairs. $params['id'] should be
* the ID of the saved search to be deleted.
* @example SavedSearch/Delete.php Std delete example.
- * @return array api result array
+ * @return array
+ * api result array
* {@getfields saved_search_delete}
* @access public
*/
* @param array $params
* An associative array of name-value pairs.
* @example SavedSearch/Get.php Std get example.
- * @return array api result array
+ * @return array
+ * api result array
* {@getfields saved_search_get}
* @access public
*/
'name' => [
'title' => 'name of setting field',
'api.required' => 1,
- 'type' => CRM_Utils_Type::T_STRING],
+ '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');
}
}
return civicrm_api3_create_success($defaults, $params, 'Setting', 'getfields');
}
+
/**
* Metadata for Setting create function.
*
$result = CRM_Core_BAO_Setting::getItems($params, $domains, CRM_Utils_Array::value('return', $params, []));
return civicrm_api3_create_success($result, $params, 'Setting', 'get');
}
+
/**
* Metadata for setting create function.
*
'description' => 'if you know the group defining it will make the api more efficient',
];
}
+
/**
* Returns value for specific parameter.
*
}
if ($params['domain_id'] == 'current_domain') {
- $params['domain_id'] = CRM_Core_Config::domainID();
+ $params['domain_id'] = CRM_Core_Config::domainID();
}
if ($params['domain_id'] == 'all') {
* @package CiviCRM_APIv3
*/
-
/**
* Create or update a survey.
*
$config = CRM_Core_Config::singleton();
$returnValues = [
[
- 'version' => CRM_Utils_System::version(), // deprecated in favor of civi.version
- 'uf' => CIVICRM_UF, // deprecated in favor of cms.type
+ // deprecated in favor of civi.version
+ 'version' => CRM_Utils_System::version(),
+ // deprecated in favor of cms.type
+ 'uf' => CIVICRM_UF,
'php' => [
'version' => phpversion(),
'time' => time(),
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
-
/**
* Create a new Word Replacement.
*
'option_sort',
'options',
'prettyprint',
- ]);
+ ]);
if ($undefined) {
$result['undefined_fields'] = array_merge($undefined);
}
$fields = $fields['values'];
_civicrm_api3_store_values($fields, $params, $values);
}
+
/**
* Store values.
*
return;
}
$existing = civicrm_api($params['entity'], 'get', [
- 'version' => $params['version'],
- $fieldName => $fieldValue,
- ]);
+ '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?
);
foreach ($staleIDs as $staleID) {
$delete = civicrm_api($entity, 'delete', [
- 'version' => $params['version'],
- 'id' => $staleID,
- ]);
+ 'version' => $params['version'],
+ 'id' => $staleID,
+ ]);
if (civicrm_error($delete)) {
$transaction->rollback();
return $delete;
return civicrm_api3_create_success($creates, $params);
}
- catch(PEAR_Exception $e) {
+ catch (PEAR_Exception $e) {
$transaction->rollback();
return civicrm_api3_create_error($e->getMessage());
}
- catch(Exception $e) {
+ catch (Exception $e) {
$transaction->rollback();
return civicrm_api3_create_error($e->getMessage());
}
return $ret;
}
-
/**
* Fill params array with alternate (alias) values where a field has an alias and that is filled & the main field isn't.
*