From 1537c309fcb391248dbcdde860e463de565133a1 Mon Sep 17 00:00:00 2001 From: Dave Greenberg Date: Fri, 12 Dec 2014 16:11:06 -0800 Subject: [PATCH] CRM-14696 - tweaks to styling for Sold Out indicator ---------------------------------------- * CRM-14696: https://issues.civicrm.org/jira/browse/CRM-14696 --- CRM/Price/BAO/PriceField.php | 20 ++++++++++---------- css/civicrm.css | 3 +-- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/CRM/Price/BAO/PriceField.php b/CRM/Price/BAO/PriceField.php index 628dea67a2..29e06a6020 100644 --- a/CRM/Price/BAO/PriceField.php +++ b/CRM/Price/BAO/PriceField.php @@ -222,7 +222,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { * @param string $label label for custom field * * @param null $fieldOptions - * @param array $feezeOptions + * @param array $freezeOptions * * @return null * @internal param bool $search true if used for search else false @@ -236,7 +236,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { $useRequired = TRUE, $label = NULL, $fieldOptions = NULL, - $feezeOptions = array() + $freezeOptions = array() ) { $field = new CRM_Price_DAO_PriceField(); @@ -329,7 +329,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { } // CRM-6902 - Add "max" option for a price set field - if (in_array($optionKey, $feezeOptions)) { + if (in_array($optionKey, $freezeOptions)) { $element->freeze(); // CRM-14696 - Improve display for sold out price set options $element->setLabel($label . ' ' . ts('Sold out') . ''); @@ -401,10 +401,10 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { } // CRM-6902 - Add "max" option for a price set field - if (in_array($opId, $feezeOptions)) { + if (in_array($opId, $freezeOptions)) { $choice[$opId]->freeze(); // CRM-14696 - Improve display for sold out price set options - $choice[$opId]->setText(' ' . ts('Sold out') . ' ' . $choice[$opId]->getText()); + $choice[$opId]->setText($choice[$opId]->getText() . '  (' . ts('Sold out') . ')'); } } if (!empty($qf->_membershipBlock) && $field->name == 'contribution_amount') { @@ -466,12 +466,12 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { $selectOption[$opt['id']] = $opt['label']; $priceVal[$opt['id']] = implode($seperator, array($opt[$valueFieldName] + $taxAmount, $count, $max_value)); - if (!in_array($opt['id'], $feezeOptions)) { + if (!in_array($opt['id'], $freezeOptions)) { $allowedOptions[] = $opt['id']; } // CRM-14696 - Improve display for sold out price set options else { - $opt['label'] = ts('Sold out') . ' - ' . $opt['label']; + $opt['label'] = $opt['label'] . ' - ' . ts('Sold out'); } $selectOption[$opt['id']] = $opt['label']; @@ -490,7 +490,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { // CRM-6902 - Add "max" option for a price set field $button = substr($qf->controller->getButtonName(), -4); - if (!empty($feezeOptions) && $button != 'skip') { + if (!empty($freezeOptions) && $button != 'skip') { $qf->addRule($elementName, ts('Sorry, this option is currently sold out.'), 'regex', "/" . implode('|', $allowedOptions) . "/"); } break; @@ -524,10 +524,10 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { $qf->addGroup($txtcheck, 'txt-'.$elementName, $label); } // CRM-6902 - Add "max" option for a price set field - if (in_array($opId, $feezeOptions)) { + if (in_array($opId, $freezeOptions)) { $check[$opId]->freeze(); // CRM-14696 - Improve display for sold out price set options - $check[$opId]->setText(' ' . ts('Sold out') . ' ' . $check[$opId]->getText()); + $check[$opId]->setText($check[$opId]->getText() . ' (' . ts('Sold out') . ')'); } } $element = &$qf->addGroup($check, $elementName, $label); diff --git a/css/civicrm.css b/css/civicrm.css index 8b41b54fe4..5897a2c3b9 100644 --- a/css/civicrm.css +++ b/css/civicrm.css @@ -4466,8 +4466,7 @@ span.crm-status-icon { display: none; } -#crm-container.crm-public .price_set-section .sold-out-option { - font-weight: bold; +#crm-container .price_set-section .sold-out-option { font-style: italic; } #crm-container .crm-extensions-upgrade { -- 2.25.1