$defaults['total_amount'] = CRM_Utils_Money::format($total_value, NULL, '%a');
if (!empty($defaults['tax_amount'])) {
$componentDetails = CRM_Contribute_BAO_Contribution::getComponentDetails($this->_id);
- if (!(CRM_Utils_Array::value('membership', $componentDetails) || CRM_Utils_Array::value('participant', $componentDetails))) {
+ if (empty($componentDetails['membership']) && empty($componentDetails['participant'])) {
$defaults['total_amount'] = CRM_Utils_Money::format($total_value - $defaults['tax_amount'], NULL, '%a');
}
}
// FIXME: This probably needs to be done in preprocess
if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()
&& $this->_action & CRM_Core_Action::UPDATE
- && CRM_Utils_Array::value('financial_type_id', $this->_values)
+ && !empty($this->_values['financial_type_id'])
) {
$financialTypeID = CRM_Contribute_PseudoConstant::financialType($this->_values['financial_type_id']);
CRM_Financial_BAO_FinancialType::checkPermissionedLineItems($this->_id, 'edit');
$paymentInstrument = FALSE;
if (!$this->_mode) {
// payment_instrument isn't required in edit and will not be present when payment block is enabled.
- $required = $this->_id ? FALSE : TRUE;
+ $required = !$this->_id;
$checkPaymentID = array_search('Check', CRM_Contribute_PseudoConstant::paymentInstrument('name'));
$paymentInstrument = $this->add('select', 'payment_instrument_id',
ts('Payment Method'),
$totalAmount = $this->addMoney('total_amount',
ts('Total Amount'),
- ($hasPriceSets) ? FALSE : TRUE,
+ !$hasPriceSets,
$attributes['total_amount'],
TRUE, 'currency', NULL, $currencyFreeze
);
// See if we need to include this paneName in the current form.
if ($this->_formType == $type || !empty($_POST["hidden_{$type}"]) ||
- CRM_Utils_Array::value("hidden_{$type}", $defaults)
+ !empty($defaults["hidden_{$type}"])
) {
$this->assign('showAdditionalInfo', TRUE);
$pane['open'] = 'true';
if ($this->_priceSetId && CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config')) {
//CRM-16833: Ensure tax is applied only once for membership conribution, when status changed.(e.g Pending to Completed).
$componentDetails = CRM_Contribute_BAO_Contribution::getComponentDetails($this->_id);
- if (!(CRM_Utils_Array::value('membership', $componentDetails) || CRM_Utils_Array::value('participant', $componentDetails))) {
+ if (empty($componentDetails['membership']) && empty($componentDetails['participant'])) {
if (!($this->_action & CRM_Core_Action::UPDATE && (($this->_defaults['contribution_status_id'] != $submittedValues['contribution_status_id'])))) {
$lineItems[$itemId]['unit_price'] = $lineItems[$itemId]['line_total'] = CRM_Utils_Rule::cleanMoney(CRM_Utils_Array::value('total_amount', $submittedValues));
}
// NOTE that this IS still a legitimate use of 'quick-config' for contributions under the current DB but
// we should look at having a price field per contribution type & then there would be little reason
// for the back-office contribution form postProcess to know if it is a quick-config form.
- if ($isQuickConfig && !empty($submittedValues['financial_type_id']) && CRM_Utils_Array::value($this->_priceSetId, $lineItem)
+ if ($isQuickConfig && !empty($submittedValues['financial_type_id']) && !empty($lineItem[$this->_priceSetId])
) {
foreach ($lineItem[$this->_priceSetId] as &$values) {
$values['financial_type_id'] = $submittedValues['financial_type_id'];
$action,
$pledgePaymentID,
$contribution->id,
- (CRM_Utils_Array::value('option_type', $formValues) == 2) ? TRUE : FALSE,
+ ($formValues['option_type'] ?? 0) == 2,
$formValues['total_amount'],
CRM_Utils_Array::value('total_amount', $this->_defaults),
$formValues['contribution_status_id'],