Ejemplo n.º 1
0
*/
/** @file
* @brief
* @since version 0.84
*/
include '../inc/includes.php';
Session::checkCentralAccess();
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["contracts_id"])) {
    $_GET["contracts_id"] = "";
}
$cost = new ContractCost();
if (isset($_POST["add"])) {
    $cost->check(-1, CREATE, $_POST);
    if ($newID = $cost->add($_POST)) {
        Event::log($_POST['contracts_id'], "contracts", 4, "financial", sprintf(__('%s adds a cost'), $_SESSION["glpiname"]));
    }
    Html::back();
} else {
    if (isset($_POST["purge"])) {
        $cost->check($_POST["id"], PURGE);
        if ($cost->delete($_POST, 1)) {
            Event::log($cost->fields['contracts_id'], "contracts", 4, "financial", sprintf(__('%s purges a cost'), $_SESSION["glpiname"]));
        }
        $contract = new Contract();
        $contract->getFromDB($cost->fields['contracts_id']);
        Html::redirect(Toolbox::getItemTypeFormURL('Contract') . '?id=' . $cost->fields['contracts_id'] . ($contract->fields['is_template'] ? "&withtemplate=1" : ""));
    } else {
        if (isset($_POST["update"])) {
Ejemplo n.º 2
0
*/
/** @file
* @brief
* @since version 0.84
*/
include '../inc/includes.php';
Session::checkCentralAccess();
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["contracts_id"])) {
    $_GET["contracts_id"] = "";
}
$cost = new ContractCost();
if (isset($_POST["add"])) {
    $cost->check(-1, 'w', $_POST);
    if ($newID = $cost->add($_POST)) {
        Event::log($_POST['contracts_id'], "contracts", 4, "financial", sprintf(__('%s adds a cost'), $_SESSION["glpiname"]));
    }
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $cost->check($_POST["id"], 'd');
        if ($cost->delete($_POST)) {
            Event::log($cost->fields['contracts_id'], "contracts", 4, "financial", sprintf(__('%s deletes a cost'), $_SESSION["glpiname"]));
        }
        $contract = new Contract();
        $contract->getFromDB($cost->fields['contracts_id']);
        Html::redirect(Toolbox::getItemTypeFormURL('Contract') . '?id=' . $cost->fields['contracts_id'] . ($contract->fields['is_template'] ? "&withtemplate=1" : ""));
    } else {
        if (isset($_POST["update"])) {