Project import generated by Copybara.
GitOrigin-RevId: 63746295f1a5ab5a619056791995793d65529e62
diff --git a/src/dodeleteschedule.php b/src/dodeleteschedule.php
new file mode 100644
index 0000000..358a8d7
--- /dev/null
+++ b/src/dodeleteschedule.php
@@ -0,0 +1,29 @@
+<?php
+require_once("core.php");
+security::checkType(security::ADMIN);
+
+if (!security::checkParams("POST", [
+ ["id", security::PARAM_NEMPTY]
+])) {
+ security::go("users.php?msg=unexpected");
+}
+
+$id = (int)$_POST["id"];
+
+$s = schedules::get($id);
+
+if ($s === false) {
+ security::go("users.php?msg=unexpected");
+}
+
+$w = workers::get($s["worker"]);
+
+if ($w === false) {
+ security::go("users.php?msg=unexpected");
+}
+
+if (schedules::remove($id)) {
+ security::go("userschedule.php?id=".(int)$w["person"]."&msg=deleted");
+} else {
+ security::go("userschedule.php?id=".(int)$w["person"]."&msg=unexpected");
+}