diff --git a/CRM/Price/BAO/PriceField.php b/CRM/Price/BAO/PriceField.php index 5e5981906a9b..5ae349b305e4 100644 --- a/CRM/Price/BAO/PriceField.php +++ b/CRM/Price/BAO/PriceField.php @@ -376,26 +376,30 @@ public static function addQuickFormElement( $taxAmount = CRM_Utils_Array::value('tax_amount', $opt); if ($field->is_display_amounts) { $opt['label'] = !empty($opt['label']) ? $opt['label'] . ' - ' : ''; - $pre_help = isset($opt['help_pre']) ? - '' . $opt['help_pre'] . ': ' : ''; - $post_help = isset($opt['help_post']) ? - ': ' . $opt['help_post'] . '' : ''; + $preHelpText = $postHelpText = ''; + if (isset($opt['help_pre'])) { + $preHelpText = '' . $opt['help_pre'] . ': '; + } + if (isset($opt['help_post'])) { + $postHelpText = ': ' . $opt['help_post'] . ''; + } if (isset($taxAmount) && $invoicing) { if ($displayOpt == 'Do_not_show') { - $opt['label'] = $pre_help . '' . $opt['label'] . '' . '' . CRM_Utils_Money::format($opt[$valueFieldName] + $taxAmount) . '' . $post_help; + $opt['label'] = '' . $opt['label'] . '' . '' . CRM_Utils_Money::format($opt[$valueFieldName] + $taxAmount) . ''; } elseif ($displayOpt == 'Inclusive') { - $opt['label'] = $pre_help . '' . $opt['label'] . '' . '' . CRM_Utils_Money::format($opt[$valueFieldName] + $taxAmount) . ''; - $opt['label'] .= ' (includes ' . $taxTerm . ' of ' . CRM_Utils_Money::format($opt['tax_amount']) . ')' . $post_help; + $opt['label'] = '' . $opt['label'] . '' . '' . CRM_Utils_Money::format($opt[$valueFieldName] + $taxAmount) . ''; + $opt['label'] .= ' (includes ' . $taxTerm . ' of ' . CRM_Utils_Money::format($opt['tax_amount']) . ')'; } else { - $opt['label'] = $pre_help . '' . $opt['label'] . '' . '' . CRM_Utils_Money::format($opt[$valueFieldName]) . ''; - $opt['label'] .= ' + ' . CRM_Utils_Money::format($opt['tax_amount']) . ' ' . $taxTerm . '' . $post_help; + $opt['label'] = '' . $opt['label'] . '' . '' . CRM_Utils_Money::format($opt[$valueFieldName]) . ''; + $opt['label'] .= ' + ' . CRM_Utils_Money::format($opt['tax_amount']) . ' ' . $taxTerm . ''; } } else { - $opt['label'] = $pre_help . '' . $opt['label'] . '' . '' . CRM_Utils_Money::format($opt[$valueFieldName]) . '' . $post_help; + $opt['label'] = '' . $opt['label'] . '' . '' . CRM_Utils_Money::format($opt[$valueFieldName]) . ''; } + $opt['label'] = $preHelpText . $opt['label'] . $postHelpText; } $count = CRM_Utils_Array::value('count', $opt, ''); $max_value = CRM_Utils_Array::value('max_value', $opt, ''); @@ -530,17 +534,21 @@ public static function addQuickFormElement( $max_value = CRM_Utils_Array::value('max_value', $opt, ''); if ($field->is_display_amounts) { - $pre_help = isset($opt['help_pre']) ? - '' . $opt['help_pre'] . ': ' : ''; - $post_help = isset($opt['help_post']) ? - ': ' . $opt['help_post'] . '' : ''; + $preHelpText = $postHelpText = ''; + if (isset($opt['help_pre'])) { + $preHelpText = '' . $opt['help_pre'] . ': '; + } + if (isset($opt['help_post'])) { + $postHelpText = ': ' . $opt['help_post'] . ''; + } $opt['label'] = '' . $opt['label'] . ' - '; if (isset($taxAmount) && $invoicing) { - $opt['label'] .= $pre_help . self::getTaxLabel($opt, $valueFieldName, $displayOpt, $taxTerm) . $post_help; + $opt['label'] .= self::getTaxLabel($opt, $valueFieldName, $displayOpt, $taxTerm); } else { - $opt['label'] .= $pre_help . CRM_Utils_Money::format($opt[$valueFieldName]) . $post_help; + $opt['label'] .= CRM_Utils_Money::format($opt[$valueFieldName]); } + $opt['label'] = $preHelpText . $opt['label'] . $postHelpText; } $priceVal = implode($seperator, array($opt[$valueFieldName] + $taxAmount, $count, $max_value)); $check[$opId] = &$qf->createElement('checkbox', $opt['id'], NULL, $opt['label'], diff --git a/CRM/Price/Form/Option.php b/CRM/Price/Form/Option.php index 645a436ddc31..a29cf32631ca 100644 --- a/CRM/Price/Form/Option.php +++ b/CRM/Price/Form/Option.php @@ -216,8 +216,8 @@ public function buildQuickForm() { $this->addRule('amount', ts('Please enter a monetary value for this field.'), 'money'); $this->add('textarea', 'description', ts('Description')); - $this->add('textarea', 'help_pre', ts('Pre Option Help'), NULL, TRUE); - $this->add('textarea', 'help_post', ts('Post Option Help'), NULL, TRUE); + $this->add('textarea', 'help_pre', ts('Pre Option Help')); + $this->add('textarea', 'help_post', ts('Post Option Help')); // weight $this->add('text', 'weight', ts('Order'), NULL, TRUE);