$errors['sms_text_message'] = ts('The SMS message is a required field.');
}
- if (empty($self->getContext()) && CRM_Utils_System::isNull(CRM_Utils_Array::value(1, $fields['entity']))) {
+ if (empty($self->getContext()) && CRM_Utils_System::isNull($fields['entity'][1] ?? NULL)) {
$errors['entity'] = ts('Please select entity value');
}
if (!empty($formattedRow['participant_image'])) {
$imageAlign = 0;
- switch (CRM_Utils_Array::value('alignment_participant_image', $formattedRow)) {
+ switch ($formattedRow['alignment_participant_image'] ?? NULL) {
case 'R':
$imageAlign = 68;
break;
}
//set parent id if its edit mode
- if ($parentId = CRM_Utils_Array::value('parent_id', $this->_defaults)) {
+ if ($parentId = $this->_defaults['parent_id'] ?? NULL) {
$params['parent_id'] = $parentId;
}
$form->assign('contribution_recur_pane_open', FALSE);
foreach (self::getRecurringFields() as $key) {
if ($key === 'contribution_recur_payment_made' && !empty($form->_formValues) &&
- !CRM_Utils_System::isNull(CRM_Utils_Array::value($key, $form->_formValues))
+ !CRM_Utils_System::isNull($form->_formValues[$key] ?? NULL)
) {
$form->assign('contribution_recur_pane_open', TRUE);
break;
if (CRM_Contribute_BAO_Contribution::isContributionStatusNegative($params['contribution_status_id'])
) {
- if (CRM_Utils_System::isNull(CRM_Utils_Array::value('cancel_date', $params))) {
+ if (CRM_Utils_System::isNull($params['cancel_date'] ?? NULL)) {
$params['cancel_date'] = date('YmdHis');
}
}
}
if (!empty($entityColumnValue[$typeId]) ||
- CRM_Utils_System::isNull(CRM_Utils_Array::value($typeId, $entityColumnValue))
+ CRM_Utils_System::isNull($entityColumnValue[$typeId] ?? NULL)
) {
CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, $contributionId);
}
*/
public static function dataExists($blockFields, &$params) {
foreach ($blockFields as $field) {
- if (CRM_Utils_System::isNull(CRM_Utils_Array::value($field, $params))) {
+ if (CRM_Utils_System::isNull($params[$field] ?? NULL)) {
return FALSE;
}
}
// if in some cases (eg. email used in Online Conribution Page, Profiles, etc.) id is not set
// lets try to add using the previous method to avoid any false creation of existing data.
foreach ($blockIds as $blockId => $blockValue) {
- if (empty($value['id']) && $blockValue['locationTypeId'] == CRM_Utils_Array::value('location_type_id', $value) && !$isIdSet) {
+ if (empty($value['id']) && $blockValue['locationTypeId'] == ($value['location_type_id'] ?? NULL) && !$isIdSet) {
$valueId = FALSE;
if ($blockName == 'phone') {
$phoneTypeBlockValue = $blockValue['phoneTypeId'] ?? NULL;
$op = empty($params['id']) ? 'create' : 'edit';
- CRM_Utils_Hook::pre($op, 'File', CRM_Utils_Array::value('id', $params), $params);
+ CRM_Utils_Hook::pre($op, 'File', $params['id'] ?? NULL, $params);
$fileDAO->copyValues($params);
*/
public static function validateMandatoryFields($fields, $values, &$errors) {
foreach ($fields as $name => $fld) {
- if (!empty($fld['is_required']) && CRM_Utils_System::isNull(CRM_Utils_Array::value($name, $values))) {
+ if (!empty($fld['is_required']) && CRM_Utils_System::isNull($values[$name] ?? NULL)) {
$errors[$name] = ts('%1 is a required field.', [1 => $fld['title']]);
}
}
$discountOptions = [];
for ($i = 1; $i < self::NUM_OPTION; $i++) {
if (!empty($labels[$i]) &&
- !CRM_Utils_System::isNull(CRM_Utils_Array::value($j, $values[$i]))
+ !CRM_Utils_System::isNull($values[$i][$j] ?? NULL)
) {
$discountOptions[] = [
'label' => trim($labels[$i]),
CRM_Event_Form_Registration_Register::buildAmount($form, TRUE, $form->_discountId);
$lineItem = [];
$totalTaxAmount = 0;
- if (!CRM_Utils_System::isNull(CRM_Utils_Array::value('line_items', $form->_values))) {
+ if (!CRM_Utils_System::isNull($form->_values['line_items'] ?? NULL)) {
$lineItem[] = $form->_values['line_items'];
foreach ($form->_values['line_items'] as $key => $value) {
$totalTaxAmount = $value['tax_amount'] + $totalTaxAmount;
CRM_Event_Form_Registration::initEventFee($this, $event['id'], $this->_action !== CRM_Core_Action::UPDATE);
CRM_Event_Form_Registration_Register::buildAmount($this, TRUE);
- if (!CRM_Utils_System::isNull(CRM_Utils_Array::value('line_items', $this->_values))) {
+ if (!CRM_Utils_System::isNull($this->_values['line_items'] ?? NULL)) {
$lineItem[] = $this->_values['line_items'];
}
$this->assign('lineItem', empty($lineItem) ? FALSE : $lineItem);
if ($fieldGrp == 'filters') {
// fill operator types
if (!array_key_exists('operatorType', $this->_columns[$tableName][$fieldGrp][$fieldName])) {
- switch (CRM_Utils_Array::value('type', $this->_columns[$tableName][$fieldGrp][$fieldName])) {
+ switch ($this->_columns[$tableName][$fieldGrp][$fieldName]['type'] ?? NULL) {
case CRM_Utils_Type::T_MONEY:
case CRM_Utils_Type::T_FLOAT:
$this->_columns[$tableName][$fieldGrp][$fieldName]['operatorType'] = CRM_Report_Form::OP_FLOAT;
!empty($this->_params['group_bys'][$fieldName]) &&
!empty($this->_params['group_bys_freq'])
) {
- switch (CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])) {
+ switch ($this->_params['group_bys_freq'][$fieldName] ?? NULL) {
case 'YEARWEEK':
$select[] = "DATE_SUB({$field['dbAlias']}, INTERVAL WEEKDAY({$field['dbAlias']}) DAY) AS {$tableName}_{$fieldName}_start";
$select[] = "YEARWEEK({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
if (array_key_exists('group_bys', $table)) {
foreach ($table['group_bys'] as $fieldName => $field) {
if (!empty($this->_params['group_bys'][$fieldName])) {
- switch (CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])) {
+ switch ($this->_params['group_bys_freq'][$fieldName] ?? NULL) {
case 'YEARWEEK':
$select[] = "DATE_SUB({$field['dbAlias']}, INTERVAL WEEKDAY({$field['dbAlias']}) DAY) AS {$tableName}_{$fieldName}_start";
$select[] = "YEARWEEK({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
if (array_key_exists('group_bys', $table)) {
foreach ($table['group_bys'] as $fieldName => $field) {
if (!empty($this->_params['group_bys'][$fieldName])) {
- switch (CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])) {
+ switch ($this->_params['group_bys_freq'][$fieldName] ?? NULL) {
case 'YEARWEEK':
$select[] = "DATE_SUB({$field['dbAlias']}, INTERVAL WEEKDAY({$field['dbAlias']}) DAY) AS {$tableName}_{$fieldName}_start";
$select[] = "YEARWEEK({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
$statistics = parent::statistics($rows);
$softCredit = $this->_params['fields']['soft_amount'] ?? NULL;
- $onlySoftCredit = $softCredit && !CRM_Utils_Array::value('total_amount', $this->_params['fields']);
+ $onlySoftCredit = $softCredit && empty($this->_params['fields']['total_amount']);
if (!isset($this->_groupByArray['civicrm_contribution_currency'])) {
$this->_groupByArray['civicrm_contribution_currency'] = 'currency';
}
foreach ($table['group_bys'] as $fieldName => $field) {
if (!empty($this->_params['group_bys'][$fieldName])) {
- switch (CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])) {
+ switch ($this->_params['group_bys_freq'][$fieldName] ?? NULL) {
case 'YEARWEEK':
$select[] = "DATE_SUB({$field['dbAlias']}, INTERVAL WEEKDAY({$field['dbAlias']}) DAY) AS {$tableName}_{$fieldName}_start";
// process only filters for now
foreach ($fieldGrp as $tableName => $fields) {
foreach ($fields as $fieldName => $field) {
- switch (CRM_Utils_Array::value('type', $field)) {
+ switch ($field['type'] ?? NULL) {
case CRM_Utils_Type::T_INT:
case CRM_Utils_Type::T_FLOAT:
case CRM_Utils_Type::T_MONEY:
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));
+ _civicrm_api3_custom_data_get($relationships[$relationshipId], $params['check_permissions'] ?? 0, 'Relationship', $relationshipId, NULL, $values['relationship_type_id'] ?? NULL);
}
return civicrm_api3_create_success($relationships, $params);
}
* @throws Exception
*/
function _civicrm_api3_validate_switch_cases($fieldName, $fieldInfo, $entity, $params, $action) {
- switch (CRM_Utils_Array::value('type', $fieldInfo)) {
+ switch ($fieldInfo['type'] ?? NULL) {
case CRM_Utils_Type::T_INT:
_civicrm_api3_validate_integer($params, $fieldName, $fieldInfo, $entity);
break;
$fields = array_merge($fields, $chainApiParams);
}
foreach ($fields as $fieldName => $fieldInfo) {
- switch (CRM_Utils_Array::value('type', $fieldInfo)) {
+ switch ($fieldInfo['type'] ?? NULL) {
case CRM_Utils_Type::T_INT:
//field is of type integer
_civicrm_api3_validate_integer($params, $fieldName, $fieldInfo, $entity);