From: Marina Zozirova Date: Fri, 14 Jun 2024 05:25:46 +0000 (+0000) Subject: Fix erp 5 X-Git-Tag: 1.3~61^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=1d0b53c23f6f5a70b37865d83af995dfe39e2f87;p=erp24_rep%2Fyii-erp24%2F.git Fix erp 5 --- diff --git a/erp24/actions/timetable/StartShiftStepOneAction.php b/erp24/actions/timetable/StartShiftStepOneAction.php index 716aff22..3dbf471b 100755 --- a/erp24/actions/timetable/StartShiftStepOneAction.php +++ b/erp24/actions/timetable/StartShiftStepOneAction.php @@ -11,6 +11,7 @@ use yii_app\records\AdminCheckin; use yii_app\records\AdminDesktop; use yii_app\records\CityStore; use yii_app\records\Shift; +use yii_app\records\Timetable; class StartShiftStepOneAction extends Action { @@ -51,7 +52,15 @@ class StartShiftStepOneAction extends Action if ($modelTypeId == AdminCheckin::TYPE_END) { $adminStores = CityStore::getNames([$lastCheckin->store_id]); $lastCheckinFact = TimetableFactModel::findOne(['checkin_start_id' => $lastCheckin->id]); - $shiftArray = $lastCheckinFact ? ['id' => $lastCheckinFact->shift_id, 'name' => $lastCheckinFact->shift->name] : []; + if(!empty($lastCheckinFact)) { + $shiftArray = array('id' => $lastCheckinFact->shift_id, 'name' => $lastCheckinFact->shift->name); + } else { + $plan = Timetable::find() + ->andWhere(['store_id' => $lastCheckin->store_id]) + ->andWhere(['date' => $lastCheckin->date]) + ->one(); + $shiftArray = array('id' => $plan->shift->id, 'name' => $plan->shift->name); + } } else { $adminStores = ArrayHelper::map($userModel->getStores(), 'id', 'name'); $shiftArray = ArrayHelper::map(Shift::find()->andWhere(['not in', 'id', [3, 4, 6, 7]])->all(), 'id', 'name');