Revert "fixes to setdefaults, CRM-12970"
authorPradeep Nayak <pradeep@pradeep.(none)>
Sun, 15 Sep 2013 12:17:54 +0000 (17:47 +0530)
committerPradeep Nayak <pradeep@pradeep.(none)>
Sun, 15 Sep 2013 12:17:54 +0000 (17:47 +0530)
This reverts commit 66094995512afa0a8c37f0a0b5304ce394ec6bb1.

CRM/Event/Form/ManageEvent/Fee.php

index d5f56a6af16350b449cd9bc7ad502eb947fab9b5..eade71ead36de79f33d59b84b284c9829d5d4d26 100644 (file)
@@ -147,16 +147,14 @@ 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'][$colCount] = $discountFieldsval['label'];
-          $defaults['discounted_value'][$colCount][$rowCount] =
+          $defaults['discounted_label'][$discountFieldsval['weight']] = $discountFieldsval['label'];
+          $defaults['discounted_value'][$discountFieldsval['weight']][$rowCount] =
             CRM_Utils_Money::format($discountFieldsval['amount'], NULL, '%a');
-          $defaults['discount_option_id'][$colCount][$rowCount]= $discountFieldsval['id'];
+          $defaults['discount_option_id'][$rowCount][$discountFieldsval['weight']]= $discountFieldsval['id'];
           if (CRM_Utils_Array::value('is_default', $discountFieldsval)) {
             $defaults['discounted_default'] = $discountFieldsval['weight'];
           }
-          $colCount++;
         }
         $rowCount++;
       }
@@ -544,6 +542,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
    * @access public
    */
   public function postProcess() {
+    $params     = array();
     $eventTitle = '';
     $params     = $this->exportValues();