CommonDBTM::restoreInDB PHP Method

restoreInDB() public method

Restore item = set deleted flag to 0
public restoreInDB ( ) : true
return true if succeed else false
    function restoreInDB()
    {
        global $DB, $CFG_GLPI;
        if ($this->maybeDeleted()) {
            // Auto set date_mod if exsist
            $toadd = '';
            if (isset($this->fields['date_mod'])) {
                $toadd = ", `date_mod` ='" . $_SESSION["glpi_currenttime"] . "' ";
            }
            $query = "UPDATE `" . $this->getTable() . "`\n                   SET `is_deleted`='0' {$toadd}\n                   WHERE `id` = '" . $this->fields['id'] . "'";
            if ($result = $DB->query($query)) {
                return true;
            }
        }
        return false;
    }
CommonDBTM