public function delete()
 {
     if (!Phone::delete($_POST['id'])) {
         $_SESSION['ERROR'] = "Unable to delete phone number.";
     }
     // THIS IS STUPID
     header("LOCATION: " . $_POST['path']);
 }
Beispiel #2
0
printf("\r%u / %u", $i, $total);
if ($skipped != 0) {
    printf("\n%u addresses skipped.\n", $skipped);
}
if ($fixed != 0) {
    printf("\n%u addresses fixed.\n", $fixed);
}
print "\nAddress formating done.\n\n";
print "Formats non formated phones. (3/4)\n";
$it = XDB::rawIterator("SELECT  search_tel AS search, display_tel AS display, comment, link_id,\n                                tel_type AS type, link_type, tel_id AS id, pid, pub\n                          FROM  profile_phones\n                         WHERE  search_tel = '' OR search_tel IS NULL\n                      ORDER BY  pid, link_id, tel_id");
$total = $it->total();
$i = 0;
$j = 0;
while ($item = $it->next()) {
    $phone = new Phone($item);
    $phone->delete();
    $phone->save();
    ++$i;
    ++$j;
    if ($j == 100) {
        $j = 0;
        printf("\r%u / %u", $i, $total);
    }
}
printf("\r%u / %u", $i, $total);
print "\nFormating done.\n\n";
print "Deletes duplicated phones. (4/4)\n";
$pids = XDB::rawFetchColumn("SELECT  DISTINCT(pid)\n                               FROM  profile_phones AS p1\n                              WHERE  link_type = 'user' AND EXISTS (SELECT  *\n                                                                      FROM  profile_phones AS p2\n                                                                     WHERE  p2.link_type = 'user' AND p2.pid = p1.pid AND p2.tel_id != p1.tel_id)\n                           ORDER BY  pid");
$total = count($pids);
$done = 0;
$aux = 0;
Beispiel #3
0
if (!isset($_GET["order"])) {
    $_GET["order"] = "";
}
if (!isset($_GET["withtemplate"])) {
    $_GET["withtemplate"] = "";
}
$phone = new Phone();
if (isset($_POST["add"])) {
    $phone->check(-1, 'w', $_POST);
    $newID = $phone->add($_POST);
    Event::log($newID, "phones", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][20] . " " . $_POST["name"] . ".");
    glpi_header($_SERVER['HTTP_REFERER']);
} else {
    if (isset($_POST["delete"])) {
        $phone->check($_POST["id"], 'd');
        $phone->delete($_POST);
        Event::log($_POST["id"], "phones", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][22]);
        $phone->redirectToList();
    } else {
        if (isset($_POST["restore"])) {
            $phone->check($_POST["id"], 'd');
            $phone->restore($_POST);
            Event::log($_POST["id"], "phones", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][23]);
            $phone->redirectToList();
        } else {
            if (isset($_REQUEST["purge"])) {
                $phone->check($_REQUEST["id"], 'd');
                $phone->delete($_REQUEST, 1);
                Event::log($_REQUEST["id"], "phones", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][24]);
                $phone->redirectToList();
            } else {
Beispiel #4
0
    $_GET["withtemplate"] = "";
}
$phone = new Phone();
if (isset($_POST["add"])) {
    $phone->check(-1, CREATE, $_POST);
    if ($newID = $phone->add($_POST)) {
        Event::log($newID, "phones", 4, "inventory", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
        if ($_SESSION['glpibackcreated']) {
            Html::redirect($phone->getFormURL() . "?id=" . $newID);
        }
    }
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $phone->check($_POST["id"], DELETE);
        $phone->delete($_POST);
        Event::log($_POST["id"], "phones", 4, "inventory", sprintf(__('%s deletes an item'), $_SESSION["glpiname"]));
        $phone->redirectToList();
    } else {
        if (isset($_POST["restore"])) {
            $phone->check($_POST["id"], DELETE);
            $phone->restore($_POST);
            Event::log($_POST["id"], "phones", 4, "inventory", sprintf(__('%s restores an item'), $_SESSION["glpiname"]));
            $phone->redirectToList();
        } else {
            if (isset($_POST["purge"])) {
                $phone->check($_POST["id"], PURGE);
                $phone->delete($_POST, 1);
                Event::log($_POST["id"], "phones", 4, "inventory", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
                $phone->redirectToList();
            } else {