Beispiel #1
0
You should have received a copy of the GNU General Public License
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkRight("contact_enterprise", "r");
if (!isset($_GET["id"])) {
    $_GET["id"] = -1;
}
$ent = new Supplier();
if (isset($_POST["add"])) {
    $ent->check(-1, 'w', $_POST);
    if ($newID = $ent->add($_POST)) {
        Event::log($newID, "suppliers", 4, "financial", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
    }
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $ent->check($_POST["id"], 'd');
        $ent->delete($_POST);
        Event::log($_POST["id"], "suppliers", 4, "financial", sprintf(__('%s deletes an item'), $_SESSION["glpiname"]));
        $ent->redirectToList();
    } else {
        if (isset($_POST["restore"])) {
            $ent->check($_POST["id"], 'd');
            $ent->restore($_POST);
            Event::log($_POST["id"], "suppliers", 4, "financial", sprintf(__('%s restores an item'), $_SESSION["glpiname"]));
Beispiel #2
0
You should have received a copy of the GNU General Public License
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkRight("contact_enterprise", READ);
if (!isset($_GET["id"])) {
    $_GET["id"] = -1;
}
$ent = new Supplier();
if (isset($_POST["add"])) {
    $ent->check(-1, CREATE, $_POST);
    if ($newID = $ent->add($_POST)) {
        Event::log($newID, "suppliers", 4, "financial", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
        if ($_SESSION['glpibackcreated']) {
            Html::redirect($ent->getFormURL() . "?id=" . $newID);
        }
    }
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $ent->check($_POST["id"], DELETE);
        $ent->delete($_POST);
        Event::log($_POST["id"], "suppliers", 4, "financial", sprintf(__('%s deletes an item'), $_SESSION["glpiname"]));
        $ent->redirectToList();
    } else {
        if (isset($_POST["restore"])) {