From 5e4b4477c6a6f7b20abe4edbd7827867de6d90e3 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Sun, 15 Sep 2013 17:58:54 +0530 Subject: [PATCH] --CRM-12970, fixed for more than one event discount set ---------------------------------------- * CRM-12970: civicrm_price_field_value not removed for discount price set http://issues.civicrm.org/jira/browse/CRM-12970 --- CRM/Event/Form/ManageEvent/Fee.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/CRM/Event/Form/ManageEvent/Fee.php b/CRM/Event/Form/ManageEvent/Fee.php index eade71ead3..fb659420c2 100644 --- a/CRM/Event/Form/ManageEvent/Fee.php +++ b/CRM/Event/Form/ManageEvent/Fee.php @@ -158,6 +158,24 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { } $rowCount++; } + //CRM-12970 + ksort($defaults['discounted_value']); + $rowCount = 1; + foreach ($defaults['discounted_label'] as $key => $value) { + if ($key != $rowCount) { + $defaults['discounted_label'][$rowCount] = $value; + $defaults['discounted_value'][$rowCount] = $defaults['discounted_value'][$key]; + unset($defaults['discounted_value'][$key]); + unset($defaults['discounted_label'][$key]); + foreach ($defaults['discount_option_id'] as &$optionIds) { + if (array_key_exists($key, $optionIds)) { + $optionIds[$rowCount] = $optionIds[$key]; + unset($optionIds[$key]); + } + } + } + $rowCount++; + } $this->set('discountSection', 1); $this->buildQuickForm(); @@ -542,7 +560,6 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { * @access public */ public function postProcess() { - $params = array(); $eventTitle = ''; $params = $this->exportValues(); -- 2.25.1