Esempio n. 1
0
    $_REQUEST["withtemplate"] = "";
}
$license = new SoftwareLicense();
if (isset($_POST["add"])) {
    $license->check(-1, CREATE, $_POST);
    if ($newID = $license->add($_POST)) {
        Event::log($_POST['softwares_id'], "software", 4, "inventory", sprintf(__('%1$s adds the license %2$s'), $_SESSION["glpiname"], $newID));
        if ($_SESSION['glpibackcreated']) {
            Html::redirect($license->getFormURL() . "?id=" . $newID);
        }
    }
    Html::back();
} else {
    if (isset($_POST["restore"])) {
        $license->check($_POST['id'], DELETE);
        if ($license->restore($_POST)) {
            Event::log($_POST["id"], "software", 4, "inventory", sprintf(__('%s restores an item'), $_SESSION["glpiname"]));
        }
        $license->redirectToList();
    } else {
        if (isset($_POST["delete"])) {
            $license->check($_POST['id'], DELETE);
            $license->delete($_POST, 0);
            Event::log($license->fields['softwares_id'], "software", 4, "inventory", sprintf(__('%1$s deletes the license %2$s'), $_SESSION["glpiname"], $_POST["id"]));
            $license->redirectToList();
        } else {
            if (isset($_POST["purge"])) {
                $license->check($_POST['id'], PURGE);
                $license->delete($_POST, 1);
                Event::log($license->fields['softwares_id'], "software", 4, "inventory", sprintf(__('%1$s purges the license %2$s'), $_SESSION["glpiname"], $_POST["id"]));
                $license->redirectToList();