$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);
    $db = eZDB::instance();
    $db->begin();
    foreach ($selectedObjectIDArray as $objectID) {
        if (!in_array($objectID, $userIDArray)) {
            $userRule = eZUserDiscountRule::create($discountGroupID, $objectID);
            $userRule->store();
        }
    }
    $db->commit();
    // because we changed users, we have to remove content cache
    eZContentCacheManager::clearAllContentCache();
}
if ($http->hasPostVariable("RemoveCustomerButton")) {
    if ($http->hasPostVariable("CustomerIDArray")) {
        $customerIDArray = $http->postVariable("CustomerIDArray");
        $db = eZDB::instance();
        $db->begin();
        foreach ($customerIDArray as $customerID) {
            eZUserDiscountRule::removeUser($customerID);
        }