From: larssandergreen Date: Wed, 23 Aug 2023 18:23:36 +0000 (-0600) Subject: Fix adding onclick for other_amount in pricesets X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=8806c373041d60d710c50d67feb5c41dad3b0295;p=civicrm-core.git Fix adding onclick for other_amount in pricesets --- diff --git a/CRM/Price/BAO/PriceField.php b/CRM/Price/BAO/PriceField.php index 50edda0ca2..ba1b636649 100644 --- a/CRM/Price/BAO/PriceField.php +++ b/CRM/Price/BAO/PriceField.php @@ -311,20 +311,20 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { ]); $extra = []; - if (!empty($qf->_membershipBlock) && $isQuickConfig && $field->name == 'other_amount') { - $useRequired = 0; - } - elseif (!empty($fieldOptions[$optionKey]['label'])) { + if (!empty($fieldOptions[$optionKey]['label'])) { //check for label. $label = $fieldOptions[$optionKey]['label']; - if ($isQuickConfig && $field->name === 'contribution_amount' && strtolower($fieldOptions[$optionKey]['name']) == 'other_amount') { - $label .= ' ' . $currencySymbol; - $qf->assign('priceset', $elementName); - $extra = [ - 'onclick' => 'useAmountOther();', - 'autocomplete' => 'off', - ]; + } + if ($isQuickConfig && $field->name === 'other_amount') { + if (!empty($qf->_membershipBlock)) { + $useRequired = 0; } + $label .= ' ' . $currencySymbol; + $qf->assign('priceset', $elementName); + $extra = [ + 'onclick' => 'useAmountOther();', + 'autocomplete' => 'off', + ]; } $element = &$qf->add('text', $elementName, $label,