blob: fdef00595c31450ba9818366a2ec9b1f7e497681 [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001<?php
2require_once("core.php");
3security::checkType(security::ADMIN);
4
5if (!security::checkParams("POST", [
6 ["name", security::PARAM_NEMPTY]
7])) {
8 security::go("incidenttypes.php?msg=empty");
9}
10
11$name = $_POST["name"];
12$present = ((isset($_POST["present"]) && $_POST["present"] == 1) ? 1 : 0);
13$paid = ((isset($_POST["paid"]) && $_POST["paid"] == 1) ? 1 : 0);
14$workerfill = ((isset($_POST["workerfill"]) && $_POST["workerfill"] == 1) ? 1 : 0);
15$notifies = ((isset($_POST["notifies"]) && $_POST["notifies"] == 1) ? 1 : 0);
16$autovalidates = ((isset($_POST["autovalidates"]) && $_POST["autovalidates"] == 1) ? 1 : 0);
17$hidden = ((isset($_POST["hidden"]) && $_POST["hidden"] == 1) ? 1 : 0);
18
19if (incidents::addType($name, $present, $paid, $workerfill, $notifies, $autovalidates, $hidden)) {
20 security::go("incidenttypes.php?msg=added");
21} else {
22 security::go("incidenttypes.php?msg=unexpected");
23}