Skip to content
Snippets Groups Projects
Commit a6ed8e27 authored by Dave Greenberg's avatar Dave Greenberg
Browse files

Merge pull request #1363 from kurund/CRM-12970

CRM-12970, fixes to setdefaults discount fees
parents afce0fb5 a8ec0901
No related branches found
No related tags found
No related merge requests found
......@@ -147,14 +147,16 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
$discountFields = current($val);
$discountFields = current($discountFields['fields']);
$colCount = 1;
foreach ($discountFields['options'] as $discountFieldsval) {
$defaults['discounted_label'][$discountFieldsval['weight']] = $discountFieldsval['label'];
$defaults['discounted_value'][$discountFieldsval['weight']][$rowCount] =
$defaults['discounted_label'][$colCount] = $discountFieldsval['label'];
$defaults['discounted_value'][$colCount][$rowCount] =
CRM_Utils_Money::format($discountFieldsval['amount'], NULL, '%a');
$defaults['discount_option_id'][$rowCount][$discountFieldsval['weight']]= $discountFieldsval['id'];
$defaults['discount_option_id'][$rowCount][$colCount] = $discountFieldsval['id'];
if (CRM_Utils_Array::value('is_default', $discountFieldsval)) {
$defaults['discounted_default'] = $discountFieldsval['weight'];
}
$colCount++;
}
$rowCount++;
}
......@@ -363,14 +365,6 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
);
$this->add('hidden', "discount_price_set[$i]", '', array('id' => "discount_price_set[$i]"));
// add a rule to ensure that discount name is not more than 24 characters to prevent overflow
// in option group name, CRM-7915
// 24 characters will make the option group name less than 64 characters
$this->addRule("discount_name[$i]",
ts('Discount Name cannot be more than 24 characters'),
'maxlength',
24
);
//discount start date
$this->addDate('discount_start_date[' . $i . ']', ts('Discount Start Date'), FALSE, array('formatType' => 'activityDate'));
......@@ -550,7 +544,6 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
* @access public
*/
public function postProcess() {
$params = array();
$eventTitle = '';
$params = $this->exportValues();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment