From: Marina Zozirova Date: Thu, 19 Sep 2024 08:26:09 +0000 (+0000) Subject: Bug zozirova erp 175 fixes for tg bot X-Git-Tag: 1.5~16^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=f964add8d5ca5450fb9e81cb966f5fc1167babae;p=erp24_rep%2Fyii-erp24%2F.git Bug zozirova erp 175 fixes for tg bot --- diff --git a/erp24/api3/modules/v1/models/timetable/Timetable.php b/erp24/api3/modules/v1/models/timetable/Timetable.php index c9681b24..55157669 100644 --- a/erp24/api3/modules/v1/models/timetable/Timetable.php +++ b/erp24/api3/modules/v1/models/timetable/Timetable.php @@ -10,6 +10,8 @@ use yii_app\records\AdminGroup; use yii_app\records\CityStore; use yii_app\records\GradePrice; use yii_app\records\Shift; +use yii_app\records\TimetableFact; +use yii_app\records\TimetableFactModel; class Timetable extends \yii_app\records\TimetableV3 { @@ -151,7 +153,10 @@ class Timetable extends \yii_app\records\TimetableV3 'time_end', 'work_time', 'status', - 'checkInCount' + 'checkInCount', + 'can_open' => fn($x) => !TimetableFactModel::find() + ->andWhere(['is_close' => false]) + ->andWhere(['plan_id' => $x->id])->exists() && ($x->date >= date('Y-m-d')) ]; return $fields; @@ -174,7 +179,7 @@ class Timetable extends \yii_app\records\TimetableV3 'name' => $x->store->name, 'name_full' => $x->store->name_full, ], - 'checkIns' + 'checkIns', ]; }