$cartype->check(-1, 'w', $_POST);
    if ($newID = $cartype->add($_POST)) {
        Event::log($newID, "cartridges", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][20] . " " . $_POST["name"] . ".");
    }
    glpi_header($_SERVER['HTTP_REFERER']);
} else {
    if (isset($_POST["delete"])) {
        $cartype->check($_POST["id"], 'w');
        if ($cartype->delete($_POST)) {
            Event::log($_POST["id"], "cartridges", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][22]);
        }
        $cartype->redirectToList();
    } else {
        if (isset($_POST["restore"])) {
            $cartype->check($_POST["id"], 'w');
            if ($cartype->restore($_POST)) {
                Event::log($_POST["id"], "cartridges", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][23]);
            }
            $cartype->redirectToList();
        } else {
            if (isset($_POST["purge"])) {
                $cartype->check($_POST["id"], 'w');
                if ($cartype->delete($_POST, 1)) {
                    Event::log($_POST["id"], "cartridges", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][24]);
                }
                $cartype->redirectToList();
            } else {
                if (isset($_POST["update"])) {
                    $cartype->check($_POST["id"], 'w');
                    if ($cartype->update($_POST)) {
                        Event::log($_POST["id"], "cartridges", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][21]);