blob: 07855cb6b4746f69f3650defd1d3d74700c7ceb0 [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 ["incidents", security::PARAM_ISARRAY]
7])) {
8 security::go("incidents.php?msg=empty");
9}
10
11$allOk = true;
12foreach ($_POST["incidents"] as $id) {
13 $incident = incidents::get($id, true);
14 if ($incident === false) security::go($returnURL."msg=unexpected");
15
16 $istatus = incidents::getStatus($incident);
17
18 if (in_array($istatus, incidents::$canRemoveStates)) {
19 if (!incidents::remove($id)) $allOk = false;
20 } elseif (in_array($istatus, incidents::$canInvalidateStates)) {
21 if (!incidents::invalidate($id)) $allOk = false;
22 } else $allOk = false;
23}
24
25security::go("incidents.php?msg=deleteincidentsbulk".($allOk ? "success" : "partialsuccess"));