Project import generated by Copybara.

GitOrigin-RevId: 63746295f1a5ab5a619056791995793d65529e62
diff --git a/src/doeditworkhistoryitem.php b/src/doeditworkhistoryitem.php
new file mode 100644
index 0000000..042f528
--- /dev/null
+++ b/src/doeditworkhistoryitem.php
@@ -0,0 +1,22 @@
+<?php
+require_once("core.php");
+security::checkType(security::ADMIN);
+
+if (!security::checkParams("POST", [
+  ["id", security::PARAM_NEMPTY],
+  ["day", security::PARAM_ISSET],
+  ["status", security::PARAM_ISSET]
+])) {
+  security::go("workers.php?msg=empty");
+}
+
+$id = $_POST["id"];
+$date = new DateTime($_POST["day"]);
+$day = $date->getTimestamp();
+$status = $_POST["status"];
+
+$item = workers::getWorkHistoryItem($id);
+if ($item === false) return false;
+
+if (workers::editWorkHistoryItem($id, $day, $status)) security::go("workers.php?openWorkerHistory=".(int)$item["worker"]);
+else security::go("workers.php?msg=unexpected");