+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
* $Id$
*
*/
));
$extra = array();
- if (!empty($qf->_quickConfig) && !empty($qf->_contributionAmount)) {
- foreach ($fieldOptions as &$fieldOption) {
- if ($fieldOption['name'] == 'other_amount') {
- $fieldOption['label'] = $fieldOption['label'] . ' ' . $currencySymbol;
- }
- }
- $qf->assign('priceset', $elementName);
- $extra = array('onclick' => 'useAmountOther();');
- }
-
if (!empty($qf->_membershipBlock) && !empty($qf->_quickConfig) && $field->name == 'other_amount' && empty($qf->_contributionAmount)) {
$useRequired = 0;
}
elseif (!empty($fieldOptions[$optionKey]['label'])) {
//check for label.
$label = $fieldOptions[$optionKey]['label'];
+ if (!empty($qf->_quickConfig) && !empty($qf->_contributionAmount) && strtolower($fieldOptions[$optionKey]['name']) == 'other_amount') {
+ $label .= ' ' . $currencySymbol;
+ $qf->assign('priceset', $elementName);
+ $extra = array('onclick' => 'useAmountOther();');
+ }
}
$element = &$qf->add('text', $elementName, $label,
// CRM-6902 - Add "max" option for a price set field
if (in_array($optionKey, $freezeOptions)) {
- self::freezeIfEnabled($element, $freezeOptions);
+ self::freezeIfEnabled($element, $fieldOptions[$optionKey]);
// CRM-14696 - Improve display for sold out price set options
$element->setLabel($label . ' <span class="sold-out-option">' . ts('Sold out') . '</span>');
}
'price' => json_encode(array($elementName, $priceVal)),
'data-amount' => $opt[$valueFieldName],
'data-currency' => $currencyName,
+ 'data-price-field-values' => json_encode($customOption),
);
if (!empty($qf->_quickConfig) && $field->name == 'contribution_amount') {
$extra += array('onclick' => 'clearAmountOther();');
}
}
- $selectOption[$opt['id']] = $opt['label'];
$priceVal[$opt['id']] = implode($seperator, array($opt[$valueFieldName] + $taxAmount, $count, $max_value));
if (!in_array($opt['id'], $freezeOptions)) {
}
// CRM-14696 - Improve display for sold out price set options
else {
+ $opt['id'] = 'crm_disabled_opt-' . $opt['id'];
$opt['label'] = $opt['label'] . ' (' . ts('Sold out') . ')';
}
'' => ts('- select -'),
) + $selectOption,
$useRequired && $field->is_required,
- array('price' => json_encode($priceVal))
+ array('price' => json_encode($priceVal), 'class' => 'crm-select2', 'data-price-field-values' => json_encode($customOption))
);
// CRM-6902 - Add "max" option for a price set field
if (isset($priceFieldValues['financial_type_id']) && array_key_exists($priceFieldValues['financial_type_id'], $taxRates)) {
$options[$fieldId][$priceFieldId]['tax_rate'] = $taxRates[$priceFieldValues['financial_type_id']];
$taxAmount = CRM_Contribute_BAO_Contribution_Utils::calculateTaxAmount($priceFieldValues['amount'], $options[$fieldId][$priceFieldId]['tax_rate']);
- $options[$fieldId][$priceFieldId]['tax_amount'] = round($taxAmount['tax_amount'], 2);
+ $options[$fieldId][$priceFieldId]['tax_amount'] = $taxAmount['tax_amount'];
}
}
}