From 2e9aa0d374e14fd2c755997b75089e022d951e99 Mon Sep 17 00:00:00 2001 From: marina Date: Thu, 8 Aug 2024 08:24:19 +0300 Subject: [PATCH] =?utf8?q?ERP-85=20=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7?= =?utf8?q?=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D0=BE=D0=B1=D0=BC=D0=B5=D0=BD?= =?utf8?q?=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D1=81=201=D0=A1=20?= =?utf8?q?=D0=91=D1=83=D1=85=D0=B3=D0=B0=D0=BB=D1=82=D0=B5=D1=80=D0=B8?= =?utf8?q?=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/actions/timetable/StartShiftStepTwoAction.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/erp24/actions/timetable/StartShiftStepTwoAction.php b/erp24/actions/timetable/StartShiftStepTwoAction.php index 88ae3e19..eac6ffa7 100755 --- a/erp24/actions/timetable/StartShiftStepTwoAction.php +++ b/erp24/actions/timetable/StartShiftStepTwoAction.php @@ -4,6 +4,7 @@ declare(strict_types = 1); namespace yii_app\actions\timetable; use yii_app\records\AdminGroup; +use yii_app\records\Shift; use yii_app\records\Timetable; use yii_app\records\TimetableFactModel; use Yii; @@ -140,6 +141,12 @@ class StartShiftStepTwoAction extends Action $model->load($this->controller->request->post()); $model->photo = UploadedFile::getInstance($model, 'photo'); $validate = $model->validate(); + $maxShiftDuration = max(ArrayHelper::getColumn(Shift::all(), 'duration')); + var_dump(AdminCheckin::find() + ->andWhere(['admin_id' => $this->admin_id]) + ->andWhere(['>', 'time', date('Y-m-d H:i:s', strtotime("-$maxShiftDuration hour"))]) + ->orderBy(['time' => SORT_DESC]) + ->limit(1)->createCommand()->getRawSql()); var_dump($model->getErrors(), $model);die(); if ($validate) { $model->save(); -- 2.39.5