$qty = (float) $qty;
$price = (float) ($amount_override === NULL ? $options[$oid]['amount'] : $amount_override);
- $participantsPerField = (int) CRM_Utils_Array::value('count', $options[$oid], 0);
+ $participantsPerField = (int) ($options[$oid]['count'] ?? 0);
$values[$oid] = [
'price_field_id' => $fid,
'auto_renew' => $options[$oid]['auto_renew'] ?? NULL,
'html_type' => $fields['html_type'],
'financial_type_id' => $options[$oid]['financial_type_id'] ?? NULL,
- 'tax_amount' => CRM_Utils_Array::value('tax_amount', $options[$oid], 0),
+ 'tax_amount' => $options[$oid]['tax_amount'] ?? 0,
'non_deductible_amount' => $options[$oid]['non_deductible_amount'] ?? NULL,
];
// now we have all selected amount in hand.
$totalAmount = array_sum($selectedAmounts);
// The form offers a field to enter the amount paid. This may differ from the amount that is due to complete the purchase
- $totalPaymentAmountEnteredOnForm = CRM_Utils_Array::value('total_amount', $fields);
+ $totalPaymentAmountEnteredOnForm = $fields['total_amount'] ?? NULL;
if ($totalAmount < 0) {
$error['_qf_default'] = ts('%1 amount can not be less than zero. Please select the options accordingly.', [1 => $componentName]);
}
if (!empty($form->_priceSet['fields'])) {
foreach ($form->_priceSet['fields'] as $field) {
foreach ($field['options'] as $option) {
- $count = CRM_Utils_Array::value('count', $option, 0);
+ $count = $option['count'] ?? 0;
$optionsCountDetails['fields'][$field['id']]['options'][$option['id']] = $count;
}
}
if (!empty($form->_priceSet['fields'])) {
foreach ($form->_priceSet['fields'] as $field) {
foreach ($field['options'] as $option) {
- $maxVal = CRM_Utils_Array::value('max_value', $option, 0);
+ $maxVal = $option['max_value'] ?? 0;
$optionsMaxValueDetails['fields'][$field['id']]['options'][$option['id']] = $maxVal;
$optionsMaxValueTotal += $maxVal;
}
'price_' . $field['id'],
$field['id'],
FALSE,
- CRM_Utils_Array::value('is_required', $field, FALSE),
+ $field['is_required'] ?? FALSE,
NULL,
$options
);
$amount_override = NULL;
if ($priceSetID && count(self::filterPriceFieldsFromParams($priceSetID, $params)) === 1) {
- $amount_override = CRM_Utils_Array::value('total_amount', $params);
+ $amount_override = $params['total_amount'] ?? NULL;
}
CRM_Price_BAO_LineItem::format($id, $params, $field, $lineItem, $amount_override);
if (!empty($field['options'][$optionValueId]['tax_rate'])) {
$params['option_amount'][$key] = CRM_Utils_Rule::cleanMoney($amount);
}
- $params['is_display_amounts'] = CRM_Utils_Array::value('is_display_amounts', $params, FALSE);
- $params['is_required'] = CRM_Utils_Array::value('is_required', $params, FALSE);
- $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
- $params['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $params, FALSE);
- $params['visibility_id'] = CRM_Utils_Array::value('visibility_id', $params, FALSE);
- $params['count'] = CRM_Utils_Array::value('count', $params, FALSE);
+ $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;
// 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'] = CRM_Utils_Array::value('is_enter_qty', $params, FALSE);
+ $params['is_enter_qty'] = $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'] = CRM_Utils_Array::value('is_default', $params, FALSE);
- $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
- $params['visibility_id'] = CRM_Utils_Array::value('visibility_id', $params, FALSE);
+ $params['is_default'] = $params['is_default'] ?? FALSE;
+ $params['is_active'] = $params['is_active'] ?? FALSE;
+ $params['visibility_id'] = $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'] = CRM_Utils_Array::value('is_active', $params, FALSE);
- $params['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $params, FALSE);
+ $params['is_active'] = $params['is_active'] ?? FALSE;
+ $params['financial_type_id'] = $params['financial_type_id'] ?? FALSE;
$compIds = [];
$extends = $params['extends'] ?? NULL;