}
$discountGroup = eZDiscountRule::fetch($discountGroupID);
if ($discountGroup === null) {
    return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
$http = eZHTTPTool::instance();
if ($http->hasPostVariable("AddRuleButton")) {
    return $module->redirectTo($module->functionURI('discountruleedit') . '/' . $discountGroupID);
}
if ($http->hasPostVariable("RemoveRuleButton")) {
    $discountRuleIDList = $http->postVariable("removeRuleList");
    $db = eZDB::instance();
    $db->begin();
    foreach ($discountRuleIDList as $discountRuleID) {
        eZDiscountSubRuleValue::removeBySubRuleID($discountRuleID);
        eZDiscountSubRule::remove($discountRuleID);
    }
    $db->commit();
    // we changed prices => remove content cache
    eZContentCacheManager::clearAllContentCache();
    $module->redirectTo($module->functionURI("discountgroupview") . "/" . $discountGroupID);
    return;
}
if ($http->hasPostVariable("AddCustomerButton")) {
    eZContentBrowse::browse(array('action_name' => 'AddCustomer', 'description_template' => 'design:shop/browse_discountcustomer.tpl', 'keys' => array('discountgroup_id' => $discountGroupID), 'content' => array('discountgroup_id' => $discountGroupID), 'from_page' => "/shop/discountgroupview/{$discountGroupID}"), $module);
    return;
}
// Add customer or customer group to this rule
if ($module->isCurrentAction('AddCustomer')) {
    $selectedObjectIDArray = eZContentBrowse::result('AddCustomer');
    $userIDArray = eZUserDiscountRule::fetchUserID($discountGroupID);