]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-256 Сделать отправку документов Пересортица в 1с
authormarina <m.zozirova@gmail.com>
Wed, 18 Dec 2024 11:24:34 +0000 (14:24 +0300)
committermarina <m.zozirova@gmail.com>
Wed, 18 Dec 2024 11:24:34 +0000 (14:24 +0300)
erp24/actions/timetable/StartShiftStepTwoAction.php

index 06e35690207884392cd23f0ba6fb51e4a53d0a98..c944f35dbe87b85e8c61f5474a57c81066fba0d6 100755 (executable)
@@ -1,5 +1,5 @@
 <?php
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace yii_app\actions\timetable;
 
@@ -61,7 +61,7 @@ class StartShiftStepTwoAction extends Action
         $firstRun = false;
         if ($request->getIsPost()) {
             if (!empty($request->getBodyParam('store_id'))) {
-                $adminStoreId = (int) $request->getBodyParam('store_id');
+                $adminStoreId = (int)$request->getBodyParam('store_id');
                 $firstRun = true;
             }
         }
@@ -79,7 +79,7 @@ class StartShiftStepTwoAction extends Action
             if ($fact) {
                 return AdminCheckin::TYPE_END;
             }
-             return AdminCheckin::TYPE_START;
+            return AdminCheckin::TYPE_START;
         })();
 
         $model->shift_id = $request->getBodyParam('shift_id');
@@ -140,7 +140,9 @@ class StartShiftStepTwoAction extends Action
             $model->load($this->controller->request->post());
             $model->photo = UploadedFile::getInstance($model, 'photo');
             $validate = $model->validate();
-            if ($validate) {
+            $twoMinutes = empty($fact->time_start) || !((strtotime(date('Y/m/d H:i:s')) - strtotime($fact->date_start . $fact->time_start)) < 120);
+
+            if ($validate && $twoMinutes) {
                 $model->save();
                 $model->checkin_id = $model->checkinModel->id;
                 $model->id = $model->checkinModel->id;
@@ -156,7 +158,6 @@ class StartShiftStepTwoAction extends Action
                     ];
                 }
 
-
                 return $this->controller->render('/timetable/start_shift_step_three.php', [
                     'userModel' => $userModel,
                     'model' => $model,