]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
fix(timetable): guard admin_checkin query against empty bigint fields origin/feature_filippov_20260304_fix_start_shift_step3_bigint
authorAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Wed, 4 Mar 2026 17:37:33 +0000 (20:37 +0300)
committerAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Wed, 4 Mar 2026 17:37:33 +0000 (20:37 +0300)
Prevent PDO exception when StartForm fields are empty strings — add null
check before querying admin_checkin to avoid PostgreSQL bigint cast error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
erp24/actions/timetable/StartShiftStepThreeAction.php

index 6c42d6a86bdc136851f9ea9436c928e9f5e3a143..524d8c099df1b0527b8509a467ae95aa7b5dc3aa 100755 (executable)
@@ -32,12 +32,15 @@ class StartShiftStepThreeAction extends Action
             $model->load($request->post(null,'StartForm'));
         }
 
-        $currentCheckin = AdminCheckin::find()
-            ->andWhere(['admin_id' => $model->admin_id])
-            ->andWhere(['store_id' => $model->store_id])
-            ->andWhere(['type_id' => $model->type_id])
-            ->andWhere(['id' => $model->checkin_id])
-            ->one();
+        $currentCheckin = null;
+        if ($model->admin_id && $model->store_id && $model->type_id && $model->checkin_id) {
+            $currentCheckin = AdminCheckin::find()
+                ->andWhere(['admin_id' => $model->admin_id])
+                ->andWhere(['store_id' => $model->store_id])
+                ->andWhere(['type_id' => $model->type_id])
+                ->andWhere(['id' => $model->checkin_id])
+                ->one();
+        }
 
         //отрабатывает только для открытия
         $fact = TimetableFactModel::getLast($userModel->id, date('Y-m-d'));