]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
fix(ERP-254): throw 404 when no open shift found on close origin/feature_filippov_ERP-254_fix_close_shift_null_fact
authorAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Sat, 7 Mar 2026 17:48:54 +0000 (20:48 +0300)
committerAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Sat, 7 Mar 2026 17:48:54 +0000 (20:48 +0300)
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.

erp24/api3/core/services/TimetableService.php

index 953d6748cd3700eb75187c6f9c185dc6f308f16f..615857618c9ed2c70d1c63fd49737553b0690e7a 100644 (file)
@@ -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;