Fix adding onclick for other_amount in pricesets
authorlarssandergreen <lars@wildsight.ca>
Wed, 23 Aug 2023 18:23:36 +0000 (12:23 -0600)
committerlarssandergreen <lars@wildsight.ca>
Wed, 23 Aug 2023 19:49:59 +0000 (13:49 -0600)
CRM/Price/BAO/PriceField.php

index 50edda0ca24a34c6e7949d1a98cd531663139c65..ba1b636649c12728fd328153c5145fc69c9c7a14 100644 (file)
@@ -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,