}
else {
$params = $this->controller->exportValues($this->_name);
- $params['is_active'] = $params['is_active'] ?? FALSE;
+ $params['is_active'] ??= FALSE;
$params['entity_table'] = 'civicrm_acl_role';
// Figure out which type of object we're permissioning on and set object_table and object_id.
}
// ensure these are set so that they get assigned to the template
- $values['mailingId'] = $values['mailingId'] ?? NULL;
- $values['campaign'] = $values['campaign'] ?? NULL;
- $values['engagement_level'] = $values['engagement_level'] ?? NULL;
+ $values['mailingId'] ??= NULL;
+ $values['campaign'] ??= NULL;
+ $values['engagement_level'] ??= NULL;
// also this which doesn't get set for bulk emails
- $values['target_contact_value'] = $values['target_contact_value'] ?? NULL;
+ $values['target_contact_value'] ??= NULL;
// Get the campaign.
$campaignId = $defaults['campaign_id'] ?? NULL;
public function setDefaultValues() {
$defaults = parent::setDefaultValues();
- $defaults['is_ssl'] = $defaults['is_ssl'] ?? TRUE;
- $defaults['is_default'] = $defaults['is_default'] ?? 0;
+ $defaults['is_ssl'] ??= TRUE;
+ $defaults['is_default'] ??= 0;
$defaults['activity_type_id'] = $defaults['activity_type_id'] ??
CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Inbound Email');
- $defaults['activity_status'] = $defaults['activity_status'] ?? 'Completed';
- $defaults['activity_source'] = $defaults['activity_source'] ?? 'from';
- $defaults['activity_targets'] = $defaults['activity_targets'] ?? 'to,cc,bcc';
- $defaults['activity_assignees'] = $defaults['activity_assignees'] ?? 'from';
- $defaults['is_active'] = $defaults['is_active'] ?? TRUE;
+ $defaults['activity_status'] ??= 'Completed';
+ $defaults['activity_source'] ??= 'from';
+ $defaults['activity_targets'] ??= 'to,cc,bcc';
+ $defaults['activity_assignees'] ??= 'from';
+ $defaults['is_active'] ??= TRUE;
return $defaults;
}
else {
// store the submitted values in an array
$params = $this->exportValues();
- $params['is_active'] = $params['is_active'] ?? FALSE;
+ $params['is_active'] ??= FALSE;
if ($this->_action & CRM_Core_Action::UPDATE) {
$params['id'] = $this->_id;
* @return object
*/
public static function create(&$params) {
- $params['is_active'] = $params['is_active'] ?? FALSE;
- $params['is_default'] = $params['is_default'] ?? FALSE;
- $params['is_reserved'] = $params['is_reserved'] ?? FALSE;
+ $params['is_active'] ??= FALSE;
+ $params['is_default'] ??= FALSE;
+ $params['is_reserved'] ??= FALSE;
$params['label_type_id'] = CRM_Core_PseudoConstant::getKey('CRM_Core_DAO_PrintLabel', 'label_type_id', 'Event Badge');
* @deprecated
*/
public static function retrieve(array $params, ?array &$defaults = NULL) {
- $defaults = $defaults ?? [];
+ $defaults ??= [];
return self::commonRetrieve(self::class, $params, $defaults);
}
}
// The latter format would be normal here - it's unclear if it is sometimes in the former format.
- $row['membership_type_id'] = $row['membership_type_id'] ?? $row['membership_type'][1];
+ $row['membership_type_id'] ??= $row['membership_type'][1];
unset($row['membership_type']);
// total_amount is required.
$row['total_amount'] = (float) $row['total_amount'];
$params['created_date'] = date('YmdHis');
}
// format params
- $params['is_active'] = $params['is_active'] ?? FALSE;
+ $params['is_active'] ??= FALSE;
$params['last_modified_id'] = $session->get('userID');
$params['last_modified_date'] = date('YmdHis');
$result = self::submit($params, $this);
$params['last_modified_id'] = $session->get('userID');
$params['last_modified_date'] = date('YmdHis');
- $params['is_share'] = $params['is_share'] ?? FALSE;
+ $params['is_share'] ??= FALSE;
if ($this->_surveyId) {
$params['created_date'] = date('YmdHis');
}
- $params['bypass_confirm'] = $params['bypass_confirm'] ?? 0;
- $params['is_active'] = $params['is_active'] ?? 0;
- $params['is_default'] = $params['is_default'] ?? 0;
+ $params['bypass_confirm'] ??= 0;
+ $params['is_active'] ??= 0;
+ $params['is_default'] ??= 0;
$params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $this->getEntityId(), $this->getDefaultEntity());
$params['created_date'] = date('YmdHis');
}
- $params['is_active'] = $params['is_active'] ?? 0;
- $params['is_default'] = $params['is_default'] ?? 0;
+ $params['is_active'] ??= 0;
+ $params['is_default'] ??= 0;
$params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $this->getEntityId(), $this->getDefaultEntity());
// @todo This can go eventually but is still needed to keep them linked together if there is an existing revision. Just focusing right now on not creating new revisions.
// original_id always refers to the first activity, so if it's null or missing, then it means no previous revisions and we can keep it null.
- $openCaseParams['original_id'] = $openCaseParams['original_id'] ?? NULL;
+ $openCaseParams['original_id'] ??= NULL;
$newActivity = CRM_Activity_BAO_Activity::create($openCaseParams);
if (is_a($newActivity, 'CRM_Core_Error')) {
*/
public static function allow($id, $type = CRM_Core_Permission::VIEW, $userID = NULL) {
// Default to logged in user if not supplied
- $userID = $userID ?? CRM_Core_Session::getLoggedInContactID();
+ $userID ??= CRM_Core_Session::getLoggedInContactID();
// first: check if contact is trying to view own contact
if ($userID == $id && ($type == CRM_Core_Permission::VIEW && CRM_Core_Permission::check('view my contact')
}
// Default to currently logged in user
- $userID = $userID ?? CRM_Core_Session::getLoggedInContactID();
+ $userID ??= CRM_Core_Session::getLoggedInContactID();
if (empty($userID)) {
return [];
}
}
if ($secondDate) {
- $highDBFieldName = $highDBFieldName ?? $dbFieldName;
+ $highDBFieldName ??= $dbFieldName;
$this->_where[$grouping][] = "
( {$tableName}.{$dbFieldName} $firstOP '$firstDate' ) AND
( {$tableName}.{$highDBFieldName} $secondOP '$secondDate' )
}
// Ensure the tables are set, but don't whomp anything.
- $this->_tables[$tableName] = $this->_tables[$tableName] ?? 1;
- $this->_whereTables[$tableName] = $this->_whereTables[$tableName] ?? 1;
+ $this->_tables[$tableName] ??= 1;
+ $this->_whereTables[$tableName] ??= 1;
}
/**
$filters = CRM_Core_OptionGroup::values('relative_date_filters');
$grouping = $values[3] ?? NULL;
// If the table value is already set for a custom field it will be more nuanced than just '1'.
- $this->_tables[$tableName] = $this->_tables[$tableName] ?? 1;
- $this->_whereTables[$tableName] = $this->_whereTables[$tableName] ?? 1;
+ $this->_tables[$tableName] ??= 1;
+ $this->_whereTables[$tableName] ??= 1;
$dates = CRM_Utils_Date::getFromTo($value, NULL, NULL);
// Where end would be populated only if we are handling one of the weird ones with different from & to fields.
$loggedInContactID = CRM_Core_Session::getLoggedInContactID();
if ($loggedInContactID) {
if ($event->action === 'create') {
- $event->params['created_id'] = $event->params['created_id'] ?? $loggedInContactID;
+ $event->params['created_id'] ??= $loggedInContactID;
}
- $event->params['modified_id'] = $event->params['modified_id'] ?? $loggedInContactID;
+ $event->params['modified_id'] ??= $loggedInContactID;
}
// Set by mysql
unset($event->params['modified_date']);
if (array_key_exists('CommunicationPreferences', $this->_editOptions)) {
// this is a chekbox, so mark false if we dont get a POST value
- $params['is_opt_out'] = $params['is_opt_out'] ?? FALSE;
+ $params['is_opt_out'] ??= FALSE;
CRM_Utils_Array::formatArrayKeys($params['preferred_communication_method']);
}
// Process / save communication preferences
// this is a chekbox, so mark false if we dont get a POST value
- $params['is_opt_out'] = $params['is_opt_out'] ?? FALSE;
+ $params['is_opt_out'] ??= FALSE;
$params['contact_type'] = $this->_contactType;
$params['contact_id'] = $this->_contactId;
//get the button name
$buttonName = $this->controller->getButtonName();
- $this->_formValues['uf_group_id'] = $this->_formValues['uf_group_id'] ?? $this->get('uf_group_id');
+ $this->_formValues['uf_group_id'] ??= $this->get('uf_group_id');
if (isset($this->_componentMode) && empty($this->_formValues['component_mode'])) {
$this->_formValues['component_mode'] = $this->_componentMode;
}
}
- $contributionParams['source'] = $contributionParams['source'] ?? ts('Recurring contribution');
+ $contributionParams['source'] ??= ts('Recurring contribution');
$createContribution = civicrm_api3('Contribution', 'create', $contributionParams);
$temporaryObject = new CRM_Contribute_BAO_Contribution();
$templateContributionParams['on_behalf'] = TRUE;
$templateContributionParams['source_contact_id'] = $relatedContact['individual_id'];
}
- $templateContributionParams['source'] = $templateContributionParams['source'] ?? ts('Recurring contribution');
+ $templateContributionParams['source'] ??= ts('Recurring contribution');
$templateContribution = Contribution::create(FALSE)
->setValues($templateContributionParams)
->execute()
$form->_priceSet = $priceSet[$priceSetId] ?? NULL;
$validPriceFieldIds = array_keys($form->_priceSet['fields']);
- $form->_priceSet['id'] = $form->_priceSet['id'] ?? $priceSetId;
+ $form->_priceSet['id'] ??= $priceSetId;
$form->assign('priceSet', $form->_priceSet);
$feeBlock = &$form->_priceSet['fields'];
->addWhere('id', '=', $selectedMembershipTypeID)
->execute()
->first();
- $this->_params['frequency_interval'] = $this->_params['frequency_interval'] ?? $this->_values['fee'][$priceFieldId]['options'][$priceFieldValue]['membership_num_terms'];
- $this->_params['frequency_unit'] = $this->_params['frequency_unit'] ?? $membershipTypeDetails['duration_unit'];
+ $this->_params['frequency_interval'] ??= $this->_values['fee'][$priceFieldId]['options'][$priceFieldValue]['membership_num_terms'];
+ $this->_params['frequency_unit'] ??= $membershipTypeDetails['duration_unit'];
}
elseif (!$this->_separateMembershipPayment && (in_array($selectedMembershipTypeID, $membershipTypes['autorenew_required'])
|| in_array($selectedMembershipTypeID, $membershipTypes['autorenew_optional']))) {
$params['recur_frequency_unit'] = implode(CRM_Core_DAO::VALUE_SEPARATOR,
array_keys($params['recur_frequency_unit'])
);
- $params['is_recur_interval'] = $params['is_recur_interval'] ?? FALSE;
- $params['is_recur_installments'] = $params['is_recur_installments'] ?? FALSE;
+ $params['is_recur_interval'] ??= FALSE;
+ $params['is_recur_installments'] ??= FALSE;
}
if (!empty($params['adjust_recur_start_date'])) {
$params['id'] = $premiumID;
}
- $params['premiums_active'] = $params['premiums_active'] ?? FALSE;
- $params['premiums_display_min_contribution'] = $params['premiums_display_min_contribution'] ?? FALSE;
+ $params['premiums_active'] ??= FALSE;
+ $params['premiums_display_min_contribution'] ??= FALSE;
$params['entity_table'] = 'civicrm_contribution_page';
$params['entity_id'] = $this->_id;
$params['currency'] = $config->defaultCurrency;
}
- $params['is_confirm_enabled'] = $params['is_confirm_enabled'] ?? FALSE;
- $params['is_share'] = $params['is_share'] ?? FALSE;
- $params['is_active'] = $params['is_active'] ?? FALSE;
- $params['is_credit_card_only'] = $params['is_credit_card_only'] ?? FALSE;
- $params['honor_block_is_active'] = $params['honor_block_is_active'] ?? FALSE;
+ $params['is_confirm_enabled'] ??= FALSE;
+ $params['is_share'] ??= FALSE;
+ $params['is_active'] ??= FALSE;
+ $params['is_credit_card_only'] ??= FALSE;
+ $params['honor_block_is_active'] ??= FALSE;
$params['is_for_organization'] = !empty($params['is_organization']) ? CRM_Utils_Array::value('is_for_organization', $params, FALSE) : 0;
$params['goal_amount'] = CRM_Utils_Rule::cleanMoney($params['goal_amount']);
$params = $this->controller->exportValues($this->_name);
$params['id'] = $this->_id;
- $params['is_email_receipt'] = $params['is_email_receipt'] ?? FALSE;
+ $params['is_email_receipt'] ??= FALSE;
if (!$params['is_email_receipt']) {
$params['receipt_from_name'] = NULL;
$params['receipt_from_email'] = NULL;
$params['id'] = $this->_widget->id;
}
$params['contribution_page_id'] = $this->_id;
- $params['is_active'] = $params['is_active'] ?? FALSE;
+ $params['is_active'] ??= FALSE;
$params['url_homepage'] = 'null';
$widget = new CRM_Contribute_DAO_Widget();
private function addExampleData(GenericWorkflowMessage $messageTemplate, $example): void {
$messageTemplate->setContact(Test::example('entity/Contact/Barb'));
$contribution = Test::example('entity/Contribution/Euro5990/completed');
- $example['currency'] = $example['currency'] ?? \Civi::settings()->get('defaultCurrency');
+ $example['currency'] ??= \Civi::settings()->get('defaultCurrency');
if (isset($example['contribution_params'])) {
$contribution = array_merge($contribution, $example['contribution_params']);
}
];
private static function getInfo(): array {
- Civi::$statics[__CLASS__ . 'Info'] = Civi::$statics[__CLASS__ . 'Info'] ?? [
+ Civi::$statics[__CLASS__ . 'Info'] ??= [
self::ADD => [
'name' => 'add',
'label' => ts('Add'),
*/
public static function create($params) {
if (empty($params['id'])) {
- $params['action_date_time'] = $params['action_date_time'] ?? date('YmdHis');
+ $params['action_date_time'] ??= date('YmdHis');
}
return self::writeRecord($params);
];
}
foreach ($options as &$option) {
- $option['icon'] = $option['icon'] ?? \Civi\Api4\Utils\CoreUtil::getInfoItem($option['id'], 'icon');
+ $option['icon'] ??= \Civi\Api4\Utils\CoreUtil::getInfoItem($option['id'], 'icon');
}
return $options;
}
protected function joinCustomTableForField($field) {
$name = $field['table_name'];
$join = "\nLEFT JOIN $name ON $name.entity_id = {$field['search_table']}.id";
- $this->_tables[$name] = $this->_tables[$name] ?? $join;
- $this->_whereTables[$name] = $this->_whereTables[$name] ?? $join;
+ $this->_tables[$name] ??= $join;
+ $this->_whereTables[$name] ??= $join;
$joinTable = $field['search_table'];
if ($joinTable) {
}
if (empty($params['id'])) {
- $params['is_ssl'] = $params['is_ssl'] ?? FALSE;
- $params['is_default'] = $params['is_default'] ?? FALSE;
+ $params['is_ssl'] ??= FALSE;
+ $params['is_default'] ??= FALSE;
}
//handle is_default.
*/
public static function add(&$params) {
if (empty($params['id'])) {
- $params['is_active'] = $params['is_active'] ?? FALSE;
- $params['has_separator'] = $params['has_separator'] ?? FALSE;
+ $params['is_active'] ??= FALSE;
+ $params['has_separator'] ??= FALSE;
$params['domain_id'] = CRM_Utils_Array::value('domain_id', $params, CRM_Core_Config::domainID());
}
* @param array $params
*/
public static function setDefaults(&$params) {
- $params['label'] = $params['label'] ?? $params['name'];
- $params['name'] = $params['name'] ?? CRM_Utils_String::titleToVar($params['label']);
- $params['weight'] = $params['weight'] ?? self::getDefaultWeight($params);
- $params['value'] = $params['value'] ?? self::getDefaultValue($params);
+ $params['label'] ??= $params['name'];
+ $params['name'] ??= CRM_Utils_String::titleToVar($params['label']);
+ $params['weight'] ??= self::getDefaultWeight($params);
+ $params['value'] ??= self::getDefaultValue($params);
}
/**
$statusPreference = new CRM_Core_DAO_StatusPreference();
// Default severity level to ignore is 0 (DEBUG).
- $params['ignore_severity'] = $params['ignore_severity'] ?? 0;
+ $params['ignore_severity'] ??= 0;
// Severity can be either text ('critical') or an integer <= 7.
// It's a magic number, but based on PSR-3 standards.
// save creator id and time
if (!$id) {
- $params['created_id'] = $params['created_id'] ?? CRM_Core_Session::getLoggedInContactID();
+ $params['created_id'] ??= CRM_Core_Session::getLoggedInContactID();
}
$tag = self::writeRecord($params);
$field['usage'] = array_merge(array_fill_keys(['import', 'export', 'duplicate_matching'], $import), $usage);
// Usage for tokens has not historically been in the metadata so we can default to FALSE.
// historically hard-coded lists have been used.
- $field['usage']['token'] = $field['usage']['token'] ?? 'FALSE';
+ $field['usage']['token'] ??= 'FALSE';
$field['import'] = $field['usage']['import'];
$field['export'] = $export ?? $import;
$field['rule'] = $this->value('rule', $fieldXML);
throw new CRM_Core_Exception('getFieldValue failed');
}
- self::$_dbColumnValueCache = self::$_dbColumnValueCache ?? [];
+ self::$_dbColumnValueCache ??= [];
while (strpos($daoName, '_BAO_') !== FALSE) {
$daoName = get_parent_class($daoName);
*/
public static function getSelectWhereClause($tableAlias = NULL, $entityName = NULL, $conditions = []) {
$bao = new static();
- $tableAlias = $tableAlias ?? $bao->tableName();
- $entityName = $entityName ?? CRM_Core_DAO_AllCoreTables::getBriefName(get_class($bao));
+ $tableAlias ??= $bao->tableName();
+ $entityName ??= CRM_Core_DAO_AllCoreTables::getBriefName(get_class($bao));
$finalClauses = [];
$fields = static::getSupportedFields();
$selectWhereClauses = $bao->addSelectWhereClause($entityName, NULL, $conditions);
if ($field['type'] !== 'Custom' && !$isExposed) {
return;
}
- $field['audience'] = $field['audience'] ?? 'user';
+ $field['audience'] ??= 'user';
if ($field['name'] === 'contact_id') {
// Since {contact.id} is almost always present don't confuse users
// by also adding (e.g {participant.contact_id)
$attributes['data-crm-datepicker'] = json_encode((array) $extra);
if (!empty($attributes['aria-label']) || $label) {
- $attributes['aria-label'] = $attributes['aria-label'] ?? $label;
+ $attributes['aria-label'] ??= $label;
}
$type = 'text';
}
protected function handlePreApproval(&$params) {
try {
$payment = Civi\Payment\System::singleton()->getByProcessor($this->_paymentProcessor);
- $params['component'] = $params['component'] ?? 'contribute';
+ $params['component'] ??= 'contribute';
$result = $payment->doPreApproval($params);
if (empty($result)) {
// This could happen, for example, when paypal looks at the button value & decides it is not paypal express.
}
}
// We use a class here to avoid html5 issues with collapsed cutsomfield sets.
- $optAttributes['class'] = $optAttributes['class'] ?? '';
+ $optAttributes['class'] ??= '';
if ($required) {
$optAttributes['class'] .= ' required';
}
}
if ($context == 'search') {
$widget = $widget == 'Select2' ? $widget : 'Select';
- $props['multiple'] = $props['multiple'] ?? TRUE;
+ $props['multiple'] ??= TRUE;
}
elseif (!empty($fieldSpec['serialize'])) {
$props['multiple'] = TRUE;
case 'Number':
case 'Email':
//TODO: Autodetect ranges
- $props['size'] = $props['size'] ?? 60;
+ $props['size'] ??= 60;
return $this->add(strtolower($widget), $name, $label, $props, $required);
case 'hidden':
case 'TextArea':
//Set default columns and rows for textarea.
- $props['rows'] = $props['rows'] ?? 4;
- $props['cols'] = $props['cols'] ?? 60;
+ $props['rows'] ??= 4;
+ $props['cols'] ??= 60;
if (empty($props['maxlength']) && isset($fieldSpec['length'])) {
$props['maxlength'] = $fieldSpec['length'];
}
return $this->addEntityRef($name, $label, $props, $required);
case 'Password':
- $props['size'] = $props['size'] ?? 60;
+ $props['size'] ??= 60;
return $this->add('password', $name, $label, $props, $required);
// Check datatypes of fields
$props['api']['fieldName'] = $this->getDefaultEntity() . '.' . $name;
}
$props['class'] = ltrim(($props['class'] ?? '') . ' crm-form-autocomplete');
- $props['placeholder'] = $props['placeholder'] ?? self::selectOrAnyPlaceholder($props, $required);
+ $props['placeholder'] ??= self::selectOrAnyPlaceholder($props, $required);
$props['data-select-params'] = json_encode($props['select']);
$props['data-api-params'] = json_encode($props['api']);
$props['data-api-entity'] = $props['entity'];
unset($props['create']);
}
- $props['placeholder'] = $props['placeholder'] ?? self::selectOrAnyPlaceholder($props, $required);
+ $props['placeholder'] ??= self::selectOrAnyPlaceholder($props, $required);
$defaults = [];
if (!empty($props['multiple'])) {
*
*/
public static function addOptionValue(&$params, $optionGroupName, $action, $optionValueID) {
- $params['is_active'] = $params['is_active'] ?? FALSE;
+ $params['is_active'] ??= FALSE;
// checking if the group name with the given id or name (in $groupParams) exists
$groupParams = ['name' => $optionGroupName, 'is_active' => 1];
$optionGroup = CRM_Core_BAO_OptionGroup::retrieve($groupParams, $defaults);
protected static function addCommonFields(&$form, $paymentFields) {
$requiredPaymentFields = $paymentFieldsMetadata = [];
foreach ($paymentFields as $name => $field) {
- $field['extra'] = $field['extra'] ?? NULL;
+ $field['extra'] ??= NULL;
if ($field['htmlType'] == 'chainSelect') {
$form->addChainSelect($field['name'], ['required' => FALSE]);
}
$res = Civi::resources();
list ($ext, $file) = $snippet['scriptFile'];
- $snippet['translate'] = $snippet['translate'] ?? TRUE;
+ $snippet['translate'] ??= TRUE;
if ($snippet['translate']) {
$domain = ($snippet['translate'] === TRUE) ? $ext : $snippet['translate'];
// Is this too early?
$customGroups[$id]['style_display'] = $customGroupStyle[$customGroups[$id]['style']];
}
$customGroups[$id]['extends_display'] = $customGroupExtends[$customGroups[$id]['extends']];
- $customGroups[$id]['extends_entity_column_value'] = $customGroups[$id]['extends_entity_column_value'] ?? NULL;
+ $customGroups[$id]['extends_entity_column_value'] ??= NULL;
}
// FIXME: This hardcoded array is mostly redundant with CRM_Core_BAO_CustomGroup::getSubTypes
$mainContactValue = $mainTree[$gid]['fields'][$fid]['customValue'] ?? NULL;
$otherContactValue = $otherTree[$gid]['fields'][$fid]['customValue'] ?? NULL;
if (in_array($fid, $compareFields['custom'])) {
- $rows["custom_group_$gid"]['title'] = $rows["custom_group_$gid"]['title'] ?? $group['title'];
+ $rows["custom_group_$gid"]['title'] ??= $group['title'];
if ($mainContactValue) {
foreach ($mainContactValue as $valueId => $values) {
// unless we are explicitly trying to create a new template
// we want to set the `is_template` flag on the clone to false
// so that the copy is a new event rather than a new template
- $params['is_template'] = $params['is_template'] ?? 0;
+ $params['is_template'] ??= 0;
//fix for api from template creation bug
civicrm_api4('ActionSchedule', 'update', [
* @throws \CRM_Core_Exception
*/
public static function checkPermission(int $eventId, $permissionType = CRM_Core_Permission::VIEW, $userId = NULL) {
- $userId = $userId ?? CRM_Core_Session::getLoggedInContactID();
+ $userId ??= CRM_Core_Session::getLoggedInContactID();
switch ($permissionType) {
case CRM_Core_Permission::EDIT:
// We also set the cached "view" permission to TRUE if "edit" is TRUE
$this->assign('description', $defaults['description'] ?? '');
// Provide suggested text for event full and waitlist messages if they're empty
- $defaults['event_full_text'] = $defaults['event_full_text'] ?? ts('This event is currently full.');
+ $defaults['event_full_text'] ??= ts('This event is currently full.');
- $defaults['waitlist_text'] = $defaults['waitlist_text'] ?? ts('This event is currently full. However you can register now and get added to a waiting list. You will be notified if spaces become available.');
+ $defaults['waitlist_text'] ??= ts('This event is currently full. However you can register now and get added to a waiting list. You will be notified if spaces become available.');
$defaults['template_id'] = $this->_templateId;
return $defaults;
$params = array_merge($this->controller->exportValues($this->_name), $this->_submitValues);
//format params
- $params['start_date'] = $params['start_date'] ?? NULL;
- $params['end_date'] = $params['end_date'] ?? NULL;
- $params['has_waitlist'] = $params['has_waitlist'] ?? FALSE;
- $params['is_map'] = $params['is_map'] ?? FALSE;
- $params['is_active'] = $params['is_active'] ?? FALSE;
- $params['is_public'] = $params['is_public'] ?? FALSE;
- $params['is_share'] = $params['is_share'] ?? FALSE;
- $params['is_show_calendar_links'] = $params['is_show_calendar_links'] ?? FALSE;
- $params['default_role_id'] = $params['default_role_id'] ?? FALSE;
+ $params['start_date'] ??= NULL;
+ $params['end_date'] ??= NULL;
+ $params['has_waitlist'] ??= FALSE;
+ $params['is_map'] ??= FALSE;
+ $params['is_active'] ??= FALSE;
+ $params['is_public'] ??= FALSE;
+ $params['is_share'] ??= FALSE;
+ $params['is_show_calendar_links'] ??= FALSE;
+ $params['default_role_id'] ??= FALSE;
$params['id'] = $this->_id;
//merge params with defaults from templates
if (!empty($params['template_id'])) {
$params['payment_processor'] = 'null';
}
- $params['is_pay_later'] = $params['is_pay_later'] ?? 0;
- $params['is_billing_required'] = $params['is_billing_required'] ?? 0;
+ $params['is_pay_later'] ??= 0;
+ $params['is_billing_required'] ??= 0;
if ($this->_id) {
}
// provide defaults for required fields if empty (and as a 'hint' for approval message field)
- $defaults['registration_link_text'] = $defaults['registration_link_text'] ?? ts('Register Now');
- $defaults['confirm_title'] = $defaults['confirm_title'] ?? ts('Confirm Your Registration Information');
- $defaults['thankyou_title'] = $defaults['thankyou_title'] ?? ts('Thank You for Registering');
- $defaults['approval_req_text'] = $defaults['approval_req_text'] ?? ts('Participation in this event requires approval. Submit your registration request here. Once approved, you will receive an email with a link to a web page where you can complete the registration process.');
+ $defaults['registration_link_text'] ??= ts('Register Now');
+ $defaults['confirm_title'] ??= ts('Confirm Your Registration Information');
+ $defaults['thankyou_title'] ??= ts('Thank You for Registering');
+ $defaults['approval_req_text'] ??= ts('Participation in this event requires approval. Submit your registration request here. Once approved, you will receive an email with a link to a web page where you can complete the registration process.');
return $defaults;
}
$params['id'] = $this->_id;
// format params
- $params['is_online_registration'] = $params['is_online_registration'] ?? FALSE;
+ $params['is_online_registration'] ??= FALSE;
// CRM-11182
- $params['is_confirm_enabled'] = $params['is_confirm_enabled'] ?? FALSE;
- $params['is_multiple_registrations'] = $params['is_multiple_registrations'] ?? FALSE;
- $params['allow_same_participant_emails'] = $params['allow_same_participant_emails'] ?? FALSE;
- $params['requires_approval'] = $params['requires_approval'] ?? FALSE;
+ $params['is_confirm_enabled'] ??= FALSE;
+ $params['is_multiple_registrations'] ??= FALSE;
+ $params['allow_same_participant_emails'] ??= FALSE;
+ $params['requires_approval'] ??= FALSE;
// reset is_email confirm if not online reg
if (!$params['is_online_registration']) {
$this->assign('is_email_confirm', $this->_values['event']['is_email_confirm'] ?? NULL);
// assign pay later stuff
- $params['is_pay_later'] = $params['is_pay_later'] ?? FALSE;
+ $params['is_pay_later'] ??= FALSE;
$this->assign('is_pay_later', $params['is_pay_later']);
$this->assign('pay_later_text', $params['is_pay_later'] ? $this->getPayLaterLabel() : FALSE);
$this->assign('pay_later_receipt', $params['is_pay_later'] ? $this->_values['event']['pay_later_receipt'] : NULL);
}
}
}
- $form->_priceSet['id'] = $form->_priceSet['id'] ?? $priceSetID;
+ $form->_priceSet['id'] ??= $priceSetID;
$form->assign('priceSet', $form->_priceSet);
}
else {
elseif ($taxRate) {
$lineItem['tax_amount'] = ($taxRate / 100) * $lineItem['line_total'];
}
- $lineItem['membership_type_id'] = $lineItem['membership_type_id'] ?? NULL;
+ $lineItem['membership_type_id'] ??= NULL;
if ($lineItem['membership_type_id']) {
$lineItem['entity_table'] = 'civicrm_membership';
}
}
}
$lineItem['unit_price'] = $lineItem['line_total'] ?? $option['amount'];
- $lineItem['label'] = $lineItem['label'] ?? $option['label'];
- $lineItem['field_title'] = $lineItem['field_title'] ?? $option['label'];
+ $lineItem['label'] ??= $option['label'];
+ $lineItem['field_title'] ??= $option['label'];
$lineItem['financial_type_id'] = $lineItem['financial_type_id'] ?: ($this->getDefaultFinancialTypeID() ?? $option['financial_type_id']);
return $lineItem;
}
$paymentTrxnParams = array_intersect_key($params, array_fill_keys($whiteList, 1));
$paymentTrxnParams['is_payment'] = 1;
// Really we should have a DB default.
- $paymentTrxnParams['fee_amount'] = $paymentTrxnParams['fee_amount'] ?? 0;
+ $paymentTrxnParams['fee_amount'] ??= 0;
if (isset($paymentTrxnParams['payment_processor_id']) && empty($paymentTrxnParams['payment_processor_id'])) {
// Don't pass 0 - ie the Pay Later processor as it is a pseudo-processor.
$params['id'] = $this->_id;
}
foreach (['is_active', 'is_deductible', 'is_tax', 'is_default'] as $field) {
- $params[$field] = $params[$field] ?? FALSE;
+ $params[$field] ??= FALSE;
}
$financialAccount = CRM_Financial_BAO_FinancialAccount::writeRecord($params);
CRM_Core_Session::setStatus(ts('The Financial Account \'%1\' has been saved.', [1 => $financialAccount->name]), ts('Saved'), 'success');
$params['id'] = $this->_id;
}
foreach (['is_active', 'is_reserved', 'is_deductible'] as $field) {
- $params[$field] = $params[$field] ?? FALSE;
+ $params[$field] ??= FALSE;
}
$financialType = civicrm_api3('FinancialType', 'create', $params);
if ($this->_action & CRM_Core_Action::UPDATE) {
$params['group_type'] = [];
}
- $params['is_reserved'] = $params['is_reserved'] ?? FALSE;
- $params['is_active'] = $params['is_active'] ?? FALSE;
+ $params['is_reserved'] ??= FALSE;
+ $params['is_active'] ??= FALSE;
$params['custom'] = CRM_Core_BAO_CustomField::postProcess($params,
$this->_id,
'Group'
*/
protected function checkContactDuplicate(&$formatValues) {
//retrieve contact id using contact dedupe rule
- $formatValues['contact_type'] = $formatValues['contact_type'] ?? $this->getContactType();
+ $formatValues['contact_type'] ??= $this->getContactType();
$formatValues['version'] = 3;
$params = $formatValues;
static $cIndieFields = NULL;
$params = self::processWorkflowPermissions($params);
}
if (!$id) {
- $params['domain_id'] = $params['domain_id'] ?? CRM_Core_Config::domainID();
+ $params['domain_id'] ??= CRM_Core_Config::domainID();
}
if (
((!$id && empty($params['replyto_email'])) || !isset($params['replyto_email'])) &&
*/
public static function tableNames(&$tables) {
if (isset($tables['civicrm_mailing_job'])) {
- $tables['civicrm_mailing'] = $tables['civicrm_mailing'] ?? 1;
- $tables['civicrm_mailing_recipients'] = $tables['civicrm_mailing_recipients'] ?? 1;
+ $tables['civicrm_mailing'] ??= 1;
+ $tables['civicrm_mailing_recipients'] ??= 1;
}
}
$transaction = new CRM_Core_Transaction();
- $params['id'] = $params['id'] ?? $ids['membership'] ?? NULL;
+ $params['id'] ??= $ids['membership'] ?? NULL;
$membership = self::add($params);
if (is_a($membership, 'CRM_Core_Error')) {
if ($event->action === 'create') {
// For some reason `status_id` is allowed to be empty
// FIXME: Why?
- $event->params['status_id'] = $event->params['status_id'] ?? 0;
+ $event->params['status_id'] ??= 0;
// Supply default for `currency`
- $event->params['currency'] = $event->params['currency'] ?? Civi::settings()->get('defaultCurrency');
+ $event->params['currency'] ??= Civi::settings()->get('defaultCurrency');
}
}
$dao->find(TRUE);
$params['id'] = $dao->id;
$params['is_active'] = $params['pcp_active'] ?? FALSE;
- $params['is_approval_needed'] = $params['is_approval_needed'] ?? FALSE;
- $params['is_tellfriend_enabled'] = $params['is_tellfriend_enabled'] ?? FALSE;
+ $params['is_approval_needed'] ??= FALSE;
+ $params['is_tellfriend_enabled'] ??= FALSE;
CRM_PCP_BAO_PCPBlock::writeRecord($params);
$dao->find(TRUE);
$params['id'] = $dao->id;
$params['is_active'] = $params['pcp_active'] ?? FALSE;
- $params['is_approval_needed'] = $params['is_approval_needed'] ?? FALSE;
- $params['is_tellfriend_enabled'] = $params['is_tellfriend_enabled'] ?? FALSE;
+ $params['is_approval_needed'] ??= FALSE;
+ $params['is_tellfriend_enabled'] ??= FALSE;
CRM_PCP_BAO_PCPBlock::writeRecord($params);
}
}
}
- $form->_priceSet['id'] = $form->_priceSet['id'] ?? $priceSetId;
+ $form->_priceSet['id'] ??= $priceSetId;
$form->assign('priceSet', $form->_priceSet);
if ($className == 'CRM_Contribute_Form_Contribution_Main') {
$params['option_amount'][$key] = CRM_Utils_Rule::cleanMoney($amount);
}
- $params['is_display_amounts'] = $params['is_display_amounts'] ?? FALSE;
- $params['is_required'] = $params['is_required'] ?? FALSE;
- $params['is_active'] = $params['is_active'] ?? FALSE;
- $params['financial_type_id'] = $params['financial_type_id'] ?? FALSE;
- $params['visibility_id'] = $params['visibility_id'] ?? FALSE;
- $params['count'] = $params['count'] ?? FALSE;
+ $params['is_display_amounts'] ??= FALSE;
+ $params['is_required'] ??= FALSE;
+ $params['is_active'] ??= FALSE;
+ $params['financial_type_id'] ??= FALSE;
+ $params['visibility_id'] ??= FALSE;
+ $params['count'] ??= FALSE;
// need the FKEY - price set id
$params['price_set_id'] = $this->_sid;
if (isset($params['option_name'])) {
$params['option_value'] = $params['option_name'];
}
- $params['is_enter_qty'] = $params['is_enter_qty'] ?? FALSE;
+ $params['is_enter_qty'] ??= FALSE;
if ($params['html_type'] === 'Text') {
// if html type is Text, force is_enter_qty on
$params[$field] = CRM_Utils_Rule::cleanMoney(trim($params[$field]));
}
$params['price_field_id'] = $this->_fid;
- $params['is_default'] = $params['is_default'] ?? FALSE;
- $params['is_active'] = $params['is_active'] ?? FALSE;
- $params['visibility_id'] = $params['visibility_id'] ?? FALSE;
+ $params['is_default'] ??= FALSE;
+ $params['is_active'] ??= FALSE;
+ $params['visibility_id'] ??= FALSE;
$ids = [];
if ($this->_oid) {
$params['id'] = $this->_oid;
// get the submitted form values.
$params = $this->controller->exportValues('Set');
$nameLength = CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceSet', 'name');
- $params['is_active'] = $params['is_active'] ?? FALSE;
- $params['financial_type_id'] = $params['financial_type_id'] ?? FALSE;
+ $params['is_active'] ??= FALSE;
+ $params['financial_type_id'] ??= FALSE;
$compIds = [];
$extends = $params['extends'] ?? NULL;
}
}
$customOption[$id]['order'] = $customOption[$id]['weight'];
- $customOption[$id]['help_pre'] = $customOption[$id]['help_pre'] ?? NULL;
- $customOption[$id]['help_post'] = $customOption[$id]['help_post'] ?? NULL;
+ $customOption[$id]['help_pre'] ??= NULL;
+ $customOption[$id]['help_post'] ??= NULL;
$customOption[$id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action,
[
'oid' => $id,
}
if (!$instanceID || !isset($params['id'])) {
- $params['is_reserved'] = $params['is_reserved'] ?? FALSE;
- $params['domain_id'] = CRM_Utils_Array::value('domain_id', $params, CRM_Core_Config::domainID());
+ $params['is_reserved'] ??= FALSE;
+ $params['domain_id'] ??= CRM_Core_Config::domainID();
// CRM-17256 set created_id on report creation.
- $params['created_id'] = $params['created_id'] ?? CRM_Core_Session::getLoggedInContactID();
+ $params['created_id'] ??= CRM_Core_Session::getLoggedInContactID();
}
if ($instanceID) {
if (empty($field['operatorType'])) {
$field['operatorType'] = '';
}
- $field['no_display'] = $field['no_display'] ?? FALSE;
+ $field['no_display'] ??= FALSE;
$filterGroups[$groupingKey]['tables'][$table][$fieldName] = $field;
// Filters is deprecated in favour of filterGroups.
$filters[$table][$fieldName] = $field;
* @return array
*/
public function limit($rowCount = NULL) {
- $rowCount = $rowCount ?? $this->getRowCount();
+ $rowCount ??= $this->getRowCount();
// lets do the pager if in html mode
$this->_limit = NULL;
* @param int|null $rowCount
*/
public function setPager($rowCount = NULL) {
- $rowCount = $rowCount ?? $this->getRowCount();
+ $rowCount ??= $this->getRowCount();
// CRM-14115, over-ride row count if rowCount is specified in URL
if ($this->_dashBoardRowCount) {
$rowCount = $this->_dashBoardRowCount;
* @param int|null $rowCount
*/
public function setPager($rowCount = NULL) {
- $rowCount = $rowCount ?? $this->getRowCount();
+ $rowCount ??= $this->getRowCount();
$this->_rowsFound = $this->totalRows;
parent::setPager($rowCount);
}
* @param int|null $rowCount
*/
public function limit($rowCount = NULL) {
- $rowCount = $rowCount ?? $this->getRowCount();
+ $rowCount ??= $this->getRowCount();
parent::limit($rowCount);
}
* @param int|null $rowCount
*/
public function setPager($rowCount = NULL): void {
- $rowCount = $rowCount ?? $this->getRowCount();
+ $rowCount ??= $this->getRowCount();
parent::setPager($rowCount);
}
* @param int|null $rowCount
*/
public function limit($rowCount = NULL) {
- $rowCount = $rowCount ?? $this->getRowCount();
+ $rowCount ??= $this->getRowCount();
$this->_limit = NULL;
}
* @return array
*/
public function limit($rowCount = NULL) {
- $rowCount = $rowCount ?? $this->getRowCount();
+ $rowCount ??= $this->getRowCount();
return parent::limit($rowCount);
}
* @param int|null $rowCount
*/
public function setPager($rowCount = NULL) {
- $rowCount = $rowCount ?? $this->getRowCount();
+ $rowCount ??= $this->getRowCount();
parent::setPager($rowCount);
}
* @param int $rowCount
*/
public function limit($rowCount = NULL) {
- $rowCount = $rowCount ?? $this->getRowCount();
+ $rowCount ??= $this->getRowCount();
// lets do the pager if in html mode
$this->_limit = NULL;
* @inheritDoc
*/
public function limit($rowCount = NULL) {
- $rowCount = $rowCount ?? $this->getRowCount();
+ $rowCount ??= $this->getRowCount();
parent::limit($rowCount);
// Modify limit.
* @param int|null $rowCount
*/
public function setPager($rowCount = NULL) {
- $rowCount = $rowCount ?? $this->getRowCount();
+ $rowCount ??= $this->getRowCount();
$params = [
'total' => $this->_rowsFound,
'rowCount' => $rowCount,
if ($instanceID) {
// this is already retrieved via Form.php
- $defaults['description'] = $defaults['description'] ?? NULL;
+ $defaults['description'] ??= NULL;
if (!empty($defaults['header'])) {
$defaults['report_header'] = $defaults['header'];
}
}
$recData = $values = $this->controller->exportValues($this->_name);
- $recData['is_active'] = $recData['is_active'] ?? 0;
- $recData['is_default'] = $recData['is_default'] ?? 0;
+ $recData['is_active'] ??= 0;
+ $recData['is_default'] ??= 0;
if ($this->_action && (CRM_Core_Action::UPDATE || CRM_Core_Action::ADD)) {
if ($this->_id) {
CRM_Core_BAO_UFField::retrieve($params, $defaults);
// set it to null if so (avoids crappy E_NOTICE errors below
- $defaults['location_type_id'] = $defaults['location_type_id'] ?? NULL;
+ $defaults['location_type_id'] ??= NULL;
//CRM-20861 - Include custom fields defined for address to set its default location type to 0.
$specialFields = array_merge(CRM_Core_BAO_UFGroup::getLocationFields(), $addressCustomFields);
public static function selectWhereClause($entity, array &$clauses, int $userId = NULL, array $conditions = []): void {
$entityName = is_object($entity) ? CRM_Core_DAO_AllCoreTables::getBriefName(get_class($entity)) : $entity;
$null = NULL;
- $userId = $userId ?? (int) CRM_Core_Session::getLoggedInContactID();
+ $userId ??= (int) CRM_Core_Session::getLoggedInContactID();
self::singleton()->invoke(['entity', 'clauses', 'userId', 'conditions'],
$entityName, $clauses, $userId, $conditions,
$null, $null,
* @throws \Brick\Money\Exception\UnknownCurrencyException
*/
protected static function formatLocaleNumeric(string $amount, $locale = NULL, $currency = NULL, $numberOfPlaces = 2): string {
- $currency = $currency ?? CRM_Core_Config::singleton()->defaultCurrency;
+ $currency ??= CRM_Core_Config::singleton()->defaultCurrency;
$currencyObject = self::getCurrencyObject($currency);
$money = Money::of($amount, $currencyObject, new CustomContext($numberOfPlaces), RoundingMode::HALF_UP);
$formatter = new \NumberFormatter($locale ?? CRM_Core_I18n::getLocale(), NumberFormatter::DECIMAL);
return [];
}
}
- $params['title'] = $params['title'] ?? self::getTitle($params['entity_type'], $params['entity_id']);
- $params['view_url'] = $params['view_url'] ?? self::getUrl($params['entity_type'], $params['entity_id'], 'view');
- $params['edit_url'] = $params['edit_url'] ?? self::getUrl($params['entity_type'], $params['entity_id'], 'update');
- $params['delete_url'] = $params['delete_url'] ?? (empty($params['is_deleted']) ? self::getUrl($params['entity_type'], $params['entity_id'], 'delete') : NULL);
+ $params['title'] ??= self::getTitle($params['entity_type'], $params['entity_id']);
+ $params['view_url'] ??= self::getUrl($params['entity_type'], $params['entity_id'], 'view');
+ $params['edit_url'] ??= self::getUrl($params['entity_type'], $params['entity_id'], 'update');
+ $params['delete_url'] ??= (empty($params['is_deleted']) ? self::getUrl($params['entity_type'], $params['entity_id'], 'delete') : NULL);
self::add($params['title'], $params['view_url'], $params['entity_id'], $params['entity_type'], $params['contact_id'] ?? NULL, NULL, $params);
return $params;
}
$forceBackend = FALSE
) {
// handle legacy null params
- $path = $path ?? '';
- $query = $query ?? '';
+ $path ??= '';
+ $query ??= '';
$query = self::makeQueryString($query);
&& (empty($apiRequest['params']['check_permissions']) || \CRM_Core_Permission::check('view debug output'))
) {
if (is_a($result, '\Civi\Api4\Generic\Result')) {
- $result->debug = $result->debug ?? [];
+ $result->debug ??= [];
$debug =& $result->debug;
}
// result would not be an array for api3 getvalue
elseif (is_array($result)) {
- $result['xdebug'] = $result['xdebug'] ?? [];
+ $result['xdebug'] ??= [];
$debug =& $result['xdebug'];
}
else {
if (!$initialSearchById && !empty($this->display['settings']['columns'][0]['rewrite'])) {
$searchFields = array_merge($searchFields, $this->getTokens($this->display['settings']['columns'][0]['rewrite']));
}
- $this->display['settings']['limit'] = $this->display['settings']['limit'] ?? \Civi::settings()->get('search_autocomplete_count');
+ $this->display['settings']['limit'] ??= \Civi::settings()->get('search_autocomplete_count');
$this->display['settings']['pager'] = [];
$return = 'scroll:' . $this->page;
// SearchKit treats comma-separated fieldnames as OR clauses
], $fieldDefaults);
$field += $defaults + $fieldDefaults;
if (array_key_exists('label', $fieldDefaults)) {
- $field['label'] = $field['label'] ?? $field['title'] ?? $field['name'];
+ $field['label'] ??= $field['title'] ?? $field['name'];
}
if (isset($field['options']) && is_array($field['options']) && empty($field['suffixes']) && array_key_exists('suffixes', $field)) {
$this->setFieldSuffixes($field);
}
- $count = $count ?? "$tableName.event_queue_id";
+ $count ??= "$tableName.event_queue_id";
$query = "(
SELECT COUNT($count)
FROM $tableName
* @throws \CRM_Core_Exception
*/
public static function checkAccessRecord(AbstractAction $apiRequest, array $record, int $userID = NULL): ?bool {
- $userID = $userID ?? \CRM_Core_Session::getLoggedInContactID() ?? 0;
+ $userID ??= \CRM_Core_Session::getLoggedInContactID() ?? 0;
$idField = self::getIdFieldName($apiRequest->getEntityName());
// Super-admins always have access to everything
public function offsetExists ($offset): bool {
$prop = $this->handleLegacyPropNames($offset, TRUE);
// If there's no prop, assume it's a custom property.
- $prop = $prop ?? $offset;
+ $prop ??= $offset;
return array_key_exists($prop, $this->props['default']);
}
throw new CRM_Core_Exception(ts('Contribution already completed'), 'contribution_completed');
}
- $params['trxn_id'] = $params['trxn_id'] ?? $contribution->trxn_id;
+ $params['trxn_id'] ??= $contribution->trxn_id;
$passThroughParams = [
'fee_amount',
$subentity = $apiRequest['params']['contact_type'] ?? NULL;
$action = $apiRequest['params']['action'] ?? NULL;
$sequential = empty($apiRequest['params']['sequential']) ? 0 : 1;
- $apiRequest['params']['options'] = $apiRequest['params']['options'] ?? [];
+ $apiRequest['params']['options'] ??= [];
$optionsToResolve = (array) ($apiRequest['params']['options']['get_options'] ?? []);
if (!$action || $action == 'getvalue' || $action == 'getcount') {
}
// Bother calling the api.
else {
- $info['contact_id'] = $info['contact_id'] ?? 'null';
+ $info['contact_id'] ??= 'null';
$result = civicrm_api3($item, 'create', $info);
$entities[$key] = $result['values'][$result['id']];
$params[$key . '_id'] = $result['id'];
if (isset($params['approval_date'])) {
$updateParams['approval_date'] = $params['approval_date'];
$updateParams['approver_id'] = CRM_Core_Session::getLoggedInContactID();
- $updateParams['approval_status_id'] = $updateParams['approval_status_id'] ?? CRM_Core_OptionGroup::getDefaultValue('mail_approval_status');
+ $updateParams['approval_status_id'] ??= CRM_Core_OptionGroup::getDefaultValue('mail_approval_status');
}
if (isset($params['approval_note'])) {
$updateParams['approval_note'] = $params['approval_note'];
&& (!CRM_Event_BAO_ParticipantStatusType::getIsValidStatusForClass($entityParams['participant_status_id'], 'Pending'))) {
throw new CRM_Core_Exception('Creating a participant via the Order API with a non "pending" status is not supported');
}
- $entityParams['participant_status_id'] = $entityParams['participant_status_id'] ?? 'Pending from incomplete transaction';
+ $entityParams['participant_status_id'] ??= 'Pending from incomplete transaction';
$entityParams['status_id'] = $entityParams['participant_status_id'];
$entityParams['skipLineItem'] = TRUE;
$entityResult = civicrm_api3('Participant', 'create', $entityParams);
*/
}
}
- $profileFields[$profileID] = $profileFields[$profileID] ?? [];
+ $profileFields[$profileID] ??= [];
uasort($profileFields[$profileID], "_civicrm_api3_order_by_weight");
return $profileFields[$profileID];
}
if (!empty($entity['data'])) {
// If no submitted values but data exists, fill the minimum number of records
for ($index = 0; $index < $entity['min']; $index++) {
- $entityValues[$entityName][$index] = $entityValues[$entityName][$index] ?? ['fields' => []];
+ $entityValues[$entityName][$index] ??= ['fields' => []];
}
// Predetermined values override submitted values
foreach ($entityValues[$entityName] as $index => $vals) {
// If Afform specifies a contact type, lookup the contact and compare
if (!empty($afform['summary_contact_type'])) {
// Contact.get only needs to happen once
- $contact = $contact ?? civicrm_api4('Contact', 'get', [
+ $contact ??= civicrm_api4('Contact', 'get', [
'select' => ['contact_type', 'contact_sub_type'],
'where' => [['id', '=', $cid]],
])->first();
* @return mixed
*/
protected function prefill($params) {
- $params['name'] = $params['name'] ?? $this->getFormName();
+ $params['name'] ??= $this->getFormName();
return $this->callApi4AjaxSuccess('Afform', 'prefill', $params);
}
* @return mixed
*/
protected function prefillError($params) {
- $params['name'] = $params['name'] ?? $this->getFormName();
+ $params['name'] ??= $this->getFormName();
return $this->callApi4AjaxError('Afform', 'prefill', $params);
}
* @return mixed
*/
protected function submit($params) {
- $params['name'] = $params['name'] ?? $this->getFormName();
+ $params['name'] ??= $this->getFormName();
return $this->callApi4AjaxSuccess('Afform', 'submit', $params);
}
* @return mixed
*/
protected function submitError($params) {
- $params['name'] = $params['name'] ?? $this->getFormName();
+ $params['name'] ??= $this->getFormName();
return $this->callApi4AjaxError('Afform', 'submit', $params);
}
*/
public function setPrincipal($args) {
if (!empty($args['user'])) {
- $args['userId'] = $args['userId'] ?? \CRM_Core_Config::singleton()->userSystem->getUfId($args['user']);
+ $args['userId'] ??= \CRM_Core_Config::singleton()->userSystem->getUfId($args['user']);
if ($args['userId']) {
unset($args['user']);
}
$clientDef['options'] ?? [],
$localOptions
);
- $options['redirectUri'] = $options['redirectUri'] ?? \CRM_OAuth_BAO_OAuthClient::getRedirectUri();
+ $options['redirectUri'] ??= \CRM_OAuth_BAO_OAuthClient::getRedirectUri();
return [$class, $options];
}
* @see \League\OAuth2\Client\Provider\AbstractProvider::getAccessToken()
*/
public function init($options): array {
- $options['storage'] = $options['storage'] ?? 'OAuthSysToken';
+ $options['storage'] ??= 'OAuthSysToken';
if (!preg_match(self::STORAGE_TYPES, $options['storage'])) {
throw new \CRM_Core_Exception("Invalid token storage ({$options['storage']})");
}
}
$this->_apiParams['checkPermissions'] = $this->savedSearch['api_params']['checkPermissions'] = empty($this->display['acl_bypass']);
- $this->display['settings']['columns'] = $this->display['settings']['columns'] ?? [];
+ $this->display['settings']['columns'] ??= [];
$this->processResult($result);
}
$iconClass = \CRM_Utils_Array::first(array_filter((array) $data[$iconField]));
}
}
- $iconClass = $iconClass ?? $icon['icon'];
+ $iconClass ??= $icon['icon'];
if ($iconClass && !empty($icon['if'])) {
$condition = $this->getRuleCondition($icon['if'], $isMulti);
if (!is_null($condition[0]) && !(self::filterCompare($data, $condition, $isMulti ? $index : NULL))) {
}
// NULL means the current logged-in user
- $userID = $userID ?? $this->getLoggedInUfID() ?? 0;
+ $userID ??= $this->getLoggedInUfID() ?? 0;
if (!isset(\Civi::$statics[__METHOD__][$userID])) {
public static $counts = [];
public function install() {
- self::$counts['install'] = self::$counts['install'] ?? 0;
+ self::$counts['install'] ??= 0;
self::$counts['install'] = 1 + (int) self::$counts['install'];
}
public function uninstall() {
- self::$counts['uninstall'] = self::$counts['uninstall'] ?? 0;
+ self::$counts['uninstall'] ??= 0;
self::$counts['uninstall'] = 1 + (int) self::$counts['uninstall'];
}
public function disable() {
- self::$counts['disable'] = self::$counts['disable'] ?? 0;
+ self::$counts['disable'] ??= 0;
self::$counts['disable'] = 1 + (int) self::$counts['disable'];
}
public function enable() {
- self::$counts['enable'] = self::$counts['enable'] ?? 0;
+ self::$counts['enable'] ??= 0;
self::$counts['enable'] = 1 + (int) self::$counts['enable'];
}
// init in case it's not defined
foreach ($locParams as $field) {
- $eventData[$field] = $eventData[$field] ?? '';
+ $eventData[$field] ??= '';
}
// differencing the data in original content for each locales
*/
private function setupMembership($modifiedID = NULL): array {
$contactID = $this->individualCreate();
- $modifiedID = $modifiedID ?? $contactID;
+ $modifiedID ??= $contactID;
$params = [
'contact_id' => $contactID,
* @return string
*/
protected function renderText(array $rowContext, string $text, array $context = [], $isHtml = TRUE): string {
- $context['schema'] = $context['schema'] ?? [];
+ $context['schema'] ??= [];
foreach (array_keys($rowContext) as $key) {
$context['schema'][] = $key;
}
'httpx' => $_SERVER['HTTP_X_REQUESTED_WITH'] ?? NULL,
];
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
- $_SERVER['HTTP_REFERER'] = $_SERVER['HTTP_REFERER'] ?? NULL;
+ $_SERVER['HTTP_REFERER'] ??= NULL;
http_response_code(200);
}
$phpCode = $this->getSourceCode($mixin);
$mixinSpec = $this->parseString($phpCode);
- $mixinSpec['mixinName'] = $mixinSpec['mixinName'] ?? preg_replace(';@.*$;', '', $mixin);
+ $mixinSpec['mixinName'] ??= preg_replace(';@.*$;', '', $mixin);
$parts = explode('@', $mixin);
$effectiveVersion = !empty($mixinSpec['mixinVersion']) ? $mixinSpec['mixinVersion'] : ($parts[1] ?? '');