From: Aleksey Filippov Date: Sat, 7 Mar 2026 17:48:54 +0000 (+0300) Subject: fix(ERP-254): throw 404 when no open shift found on close X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=b00e5d5b191e9e9b1378ba4859afce5489efb316;p=erp24_rep%2Fyii-erp24%2F.git fix(ERP-254): throw 404 when no open shift found on close TimetableFactModel::getLast() returns null if no open fact exists for the admin on the current/previous date. Accessing checkin_start_id on null caused PHP Warning and 500 response. Now returns proper 404. --- diff --git a/erp24/api3/core/services/TimetableService.php b/erp24/api3/core/services/TimetableService.php index 953d6748..61585761 100644 --- a/erp24/api3/core/services/TimetableService.php +++ b/erp24/api3/core/services/TimetableService.php @@ -132,6 +132,10 @@ class TimetableService $fact = TimetableFactModel::getLast($data->admin_id, date('Y-m-d')); + if ($fact === null) { + throw new NotFoundHttpException("Открытая смена не найдена"); + } + $currentDate = date('Y-m-d H:i:s'); $admin_id = $data->admin_id;