}
// record line items and financial items
if (empty($params['skipLineItem'])) {
- CRM_Price_BAO_LineItem::processPriceSet($entityId, CRM_Utils_Array::value('line_item', $params), $params['contribution'], $entityTable, $isUpdate);
+ CRM_Price_BAO_LineItem::processPriceSet($entityId, $params['line_item'] ?? NULL, $params['contribution'], $entityTable, $isUpdate);
}
// create batch entry if batch_id is passed and
'version' => 3,
'id' => ($props['contribution_page_id']),
]);
- $types = (array) CRM_Utils_Array::value('payment_processor', $page, 0);
+ $types = (array) $page['payment_processor'] ?? 0;
$params['condition'] = 'id IN (' . implode(',', $types) . ')';
}
break;
// if we are still empty see if we can use anything from a contribution page.
if (!empty($pageValues['receipt_from_email'])) {
return [
- CRM_Utils_Array::value('receipt_from_name', $pageValues),
+ $pageValues['receipt_from_name'] ?? NULL,
$pageValues['receipt_from_email'],
];
}
if ($gId) {
$email = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $gId, 'notify');
if ($email) {
- $val = CRM_Core_BAO_UFGroup::checkFieldsEmptyValues($gId, $contactID, CRM_Utils_Array::value($key, $params), TRUE);
+ $val = CRM_Core_BAO_UFGroup::checkFieldsEmptyValues($gId, $contactID, $params[$key] ?? NULL, TRUE);
CRM_Core_BAO_UFGroup::commonSendMail($contactID, $val);
}
}
*/
public static function add(&$params) {
$hook = empty($params['id']) ? 'create' : 'edit';
- CRM_Utils_Hook::pre($hook, 'ContributionSoft', CRM_Utils_Array::value('id', $params), $params);
+ CRM_Utils_Hook::pre($hook, 'ContributionSoft', $params['id'] ?? NULL, $params);
$contributionSoft = new CRM_Contribute_DAO_ContributionSoft();
$contributionSoft->copyValues($params);
if ($params['contribution']->currency) {
$currency = $params['contribution']->currency;
}
- $previousLineItemTotal = CRM_Utils_Array::value('line_total', CRM_Utils_Array::value($fieldValueId, $previousLineItems), 0);
+ $previousLineItemTotal = CRM_Utils_Array::value('line_total', $previousLineItems[$fieldValueId] ?? NULL, 0);
$itemParams = [
'transaction_date' => $receiveDate,
'contact_id' => $params['prevContribution']->contact_id,
$taxAmount = (float) $lineItemDetails['tax_amount'];
if ($context === 'changeFinancialType' && $lineItemDetails['tax_amount'] === 'null') {
// reverse the Sale Tax amount if there is no tax rate associated with new Financial Type
- $taxAmount = CRM_Utils_Array::value('tax_amount', CRM_Utils_Array::value($fieldValueId, $previousLineItems), 0);
+ $taxAmount = CRM_Utils_Array::value('tax_amount', $previousLineItems[$fieldValueId] ?? NULL, 0);
}
elseif ($previousLineItemTotal != $lineItemDetails['line_total']) {
- $taxAmount -= CRM_Utils_Array::value('tax_amount', CRM_Utils_Array::value($fieldValueId, $previousLineItems), 0);
+ $taxAmount -= CRM_Utils_Array::value('tax_amount', $previousLineItems[$fieldValueId] ?? NULL, 0);
}
if ($taxAmount != 0) {
$itemParams['amount'] = CRM_Contribute_BAO_FinancialProcessor::getMultiplier($params['contribution']->contribution_status_id, $context) * $taxAmount;
}
$tplParams['credit_card_exp_date'] = isset($params['credit_card_exp_date']) ? CRM_Utils_Date::mysqlToIso(CRM_Utils_Date::format($params['credit_card_exp_date'])) : NULL;
- $tplParams['credit_card_type'] = CRM_Utils_Array::value('credit_card_type', $params);
+ $tplParams['credit_card_type'] = $params['credit_card_type'] ?? NULL;
$tplParams['credit_card_number'] = CRM_Utils_System::mungeCreditCard(CRM_Utils_Array::value('credit_card_number', $params));
return $tplParams;
}
$contributionParams,
$financialType,
$this->_bltID,
- CRM_Utils_Array::value('is_recur', $this->_params)
+ $this->_params['is_recur'] ?? NULL
);
$paymentParams['contributionID'] = $contribution->id;
if ($this->getPriceSetID() && $action & CRM_Core_Action::UPDATE) {
$line = CRM_Price_BAO_LineItem::getLineItems($this->_id, 'contribution');
$lineID = key($line);
- $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', CRM_Utils_Array::value('price_field_id', $line[$lineID]), 'price_set_id');
+ $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $line[$lineID]['price_field_id'] ?? NULL, 'price_set_id');
$quickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config');
// Why do we do this? Seems like a like a wrapper for old functionality - but single line price sets & quick
// config should be treated the same.
$submittedValues['total_amount'] = $this->_values['total_amount'] ?? NULL;
// Avoid tax amount deduction on edit form and keep it original, because this will lead to error described in CRM-20676
if (!$this->_id) {
- $submittedValues['total_amount'] -= CRM_Utils_Array::value('tax_amount', $this->_values, 0);
+ $submittedValues['total_amount'] -= $this->_values['tax_amount'] ?? 0;
}
}
$this->assign('lineItem', !empty($lineItem) && !$isQuickConfig ? $lineItem : FALSE);
$contribution->id,
($formValues['option_type'] ?? 0) == 2,
$formValues['total_amount'],
- CRM_Utils_Array::value('total_amount', $this->_defaults),
+ $this->_defaults['total_amount'] ?? NULL,
$formValues['contribution_status_id'],
- CRM_Utils_Array::value('contribution_status_id', $this->_defaults)
+ $this->_defaults['contribution_status_id'] ?? NULL
);
return $contribution;
}
foreach ($lineItem as $key => $value) {
foreach ($value as $v) {
if (isset($taxRate[(string) CRM_Utils_Array::value('tax_rate', $v)])) {
- $taxRate[(string) $v['tax_rate']] = $taxRate[(string) $v['tax_rate']] + CRM_Utils_Array::value('tax_amount', $v);
+ $taxRate[(string) $v['tax_rate']] = $taxRate[(string) $v['tax_rate']] + ($v['tax_amount'] ?? 0);
}
else {
if (isset($v['tax_rate'])) {
//assign cancelSubscription URL to templates
$this->assign('cancelSubscriptionUrl',
- CRM_Utils_Array::value('cancelSubscriptionUrl', $this->_values)
+ $this->_values['cancelSubscriptionUrl'] ?? NULL
);
$title = $this->_values['frontend_title'];
$abbrMonthNames = CRM_Utils_Date::getAbbrMonthNames();
foreach ($abbrMonthNames as $monthKey => $monthName) {
- $val = CRM_Utils_Array::value($monthKey, $chartInfoMonthly['By Month'], 0);
+ $val = $chartInfoMonthly['By Month'][$monthKey] ?? 0;
// don't include zero value month.
if (!$val && ($chartType != 'bvg')) {
if (array_key_exists(CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessor', 'AuthNet',
'id', 'payment_processor_type_id'
),
- CRM_Utils_Array::value('payment_processor', $params)
+ ($params['payment_processor'] ?? NULL)
)) {
CRM_Core_Session::setStatus(ts(' Please note that the Authorize.net payment processor only allows recurring contributions and auto-renew memberships with payment intervals from 7-365 days or 1-12 months (i.e. not greater than 1 year).'), '', 'alert');
}
$params['recur_frequency_unit'] = implode(CRM_Core_DAO::VALUE_SEPARATOR,
array_keys($params['recur_frequency_unit'])
);
- $params['is_recur_interval'] = CRM_Utils_Array::value('is_recur_interval', $params, FALSE);
- $params['is_recur_installments'] = CRM_Utils_Array::value('is_recur_installments', $params, FALSE);
+ $params['is_recur_interval'] = $params['is_recur_interval'] ?? FALSE;
+ $params['is_recur_installments'] = $params['is_recur_installments'] ?? FALSE;
}
if (!empty($params['adjust_recur_start_date'])) {
}
if ($deleteAmountBlk) {
- $priceField = !empty($params['price_field_id']) ? $params['price_field_id'] : CRM_Utils_Array::value('price_field_other', $params);
+ $priceField = !empty($params['price_field_id']) ? $params['price_field_id'] : $params['price_field_other'] ?? NULL;
if ($priceField) {
$priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $priceField, 'price_set_id');
CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID, 0);
$params['id'] = $premiumID;
}
- $params['premiums_active'] = CRM_Utils_Array::value('premiums_active', $params, FALSE);
- $params['premiums_display_min_contribution'] = CRM_Utils_Array::value('premiums_display_min_contribution', $params, FALSE);
+ $params['premiums_active'] = $params['premiums_active'] ?? FALSE;
+ $params['premiums_display_min_contribution'] = $params['premiums_display_min_contribution'] ?? FALSE;
$params['entity_table'] = 'civicrm_contribution_page';
$params['entity_id'] = $this->_id;
$defaults['honoree_profile'] = $ufGroupDAO->id;
}
$defaults['soft_credit_types'] = [
- CRM_Utils_Array::value('in_honor_of', $soft_credit_types),
- CRM_Utils_Array::value('in_memory_of', $soft_credit_types),
+ $soft_credit_types['in_honor_of'] ?? NULL,
+ $soft_credit_types['in_memory_of'] ?? NULL,
];
}
else {
$defaults['honoree_profile'] = $ufGroupDAO->id;
}
$defaults['soft_credit_types'] = [
- CRM_Utils_Array::value('in_honor_of', $soft_credit_types),
- CRM_Utils_Array::value('in_memory_of', $soft_credit_types),
+ $soft_credit_types['in_honor_of'] ?? NULL,
+ $soft_credit_types['in_memory_of'] ?? NULL,
];
}
$params['currency'] = $config->defaultCurrency;
}
- $params['is_confirm_enabled'] = CRM_Utils_Array::value('is_confirm_enabled', $params, FALSE);
- $params['is_share'] = CRM_Utils_Array::value('is_share', $params, FALSE);
- $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
- $params['is_credit_card_only'] = CRM_Utils_Array::value('is_credit_card_only', $params, FALSE);
- $params['honor_block_is_active'] = CRM_Utils_Array::value('honor_block_is_active', $params, FALSE);
+ $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_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'] = CRM_Utils_Array::value('is_email_receipt', $params, FALSE);
+ $params['is_email_receipt'] = $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'] = CRM_Utils_Array::value('is_active', $params, FALSE);
+ $params['is_active'] = $params['is_active'] ?? FALSE;
$params['url_homepage'] = 'null';
$widget = new CRM_Contribute_DAO_Widget();
$values['contribution_page_title'] = '';
if (!empty($values['contribution_page_id'])) {
$contribPages = CRM_Contribute_PseudoConstant::contributionPage(NULL, TRUE);
- $values['contribution_page_title'] = CRM_Utils_Array::value(CRM_Utils_Array::value('contribution_page_id', $values), $contribPages);
+ $values['contribution_page_title'] = $contribPages[$values['contribution_page_id']] ?? '';
}
// get received into i.e to_financial_account_id from last trxn
$lineItem = CRM_Price_BAO_LineItem::getLineItemsByContributionID($contributionID);
foreach ($lineItem as $taxRate) {
if (isset($dataArray[(string) $taxRate['tax_rate']])) {
- $dataArray[(string) $taxRate['tax_rate']] = $dataArray[(string) $taxRate['tax_rate']] + CRM_Utils_Array::value('tax_amount', $taxRate);
+ $dataArray[(string) $taxRate['tax_rate']] = $dataArray[(string) $taxRate['tax_rate']] + ($taxRate['tax_amount'] ?? 0);
}
else {
$dataArray[(string) $taxRate['tax_rate']] = $taxRate['tax_amount'] ?? NULL;
}
- $subTotal += CRM_Utils_Array::value('subTotal', $taxRate);
+ $subTotal += $taxRate['subTotal'] ?? 0;
}
// to email the invoice
$contactIds = array_keys($contacts);
// CRM-16725 Skip creation of activities if user is previewing their PDF letter(s)
if ($this->isLiveMode()) {
- $this->createActivities($html_message, $contactIds, CRM_Utils_Array::value('subject', $formValues, ts('Thank you letter')), CRM_Utils_Array::value('campaign_id', $formValues), $contactHtml);
+ $this->createActivities($html_message, $contactIds, CRM_Utils_Array::value('subject', $formValues, ts('Thank you letter')), $formValues['campaign_id'] ?? NULL, $contactHtml);
}
$html = array_diff_key($html, $emailedHtml);
}
$contributionRecur['payment_processor'] = CRM_Financial_BAO_PaymentProcessor::getPaymentProcessorName(
- CRM_Utils_Array::value('payment_processor_id', $contributionRecur)
+ $contributionRecur['payment_processor_id'] ?? NULL
);
$idFields = ['contribution_status_id', 'campaign_id', 'financial_type_id'];
foreach ($idFields as $idField) {
}
//for contribution tabular View
- $buildTabularView = CRM_Utils_Array::value('showtable', $_GET, FALSE);
+ $buildTabularView = $_GET['showtable'] ?? FALSE;
$this->assign('buildTabularView', $buildTabularView);
if ($buildTabularView) {
return;
// change status to refunded.
self::updateContributionStatus($contribution['id'], 'Refunded');
}
- CRM_Contribute_BAO_Contribution::recordPaymentActivity($params['contribution_id'], CRM_Utils_Array::value('participant_id', $params), $params['total_amount'], $trxn->currency, $trxn->trxn_date);
+ CRM_Contribute_BAO_Contribution::recordPaymentActivity($params['contribution_id'], $params['participant_id'] ?? NULL, $params['total_amount'], $trxn->currency, $trxn->trxn_date);
return $trxn;
}
public function preProcess() {
// This reuses some styles from search forms
CRM_Core_Resources::singleton()->addStyleFile('civicrm', 'css/searchForm.css', 1, 'html-header');
- self::$_entityID = CRM_Utils_Request::retrieve('bid', 'Positive') ? CRM_Utils_Request::retrieve('bid', 'Positive') : CRM_Utils_Array::value('batch_id', $_POST);
+ self::$_entityID = CRM_Utils_Request::retrieve('bid', 'Positive') ?: $_POST['batch_id'] ?? NULL;
$this->assign('entityID', self::$_entityID);
if (isset(self::$_entityID)) {
$this->_batchStatusId = CRM_Core_DAO::getFieldValue('CRM_Batch_BAO_Batch', self::$_entityID, 'status_id');
'is_tax',
'is_default',
] as $field) {
- $params[$field] = CRM_Utils_Array::value($field, $params, FALSE);
+ $params[$field] = $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');
'is_reserved',
'is_deductible',
] as $field) {
- $params[$field] = CRM_Utils_Array::value($field, $params, FALSE);
+ $params[$field] = $params[$field] ?? FALSE;
}
$financialType = civicrm_api3('FinancialType', 'create', $params);
if ($this->_action & CRM_Core_Action::UPDATE) {