From: Marina Zozirova Date: Thu, 19 Sep 2024 11:37:58 +0000 (+0000) Subject: Bug zozirova erp 175 fixes for tg bot X-Git-Tag: 1.5~13^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=1e0b934e14c34d58de7660eb2e5abde89d5bd319;p=erp24_rep%2Fyii-erp24%2F.git Bug zozirova erp 175 fixes for tg bot --- diff --git a/erp24/api3/core/services/IncomeService.php b/erp24/api3/core/services/IncomeService.php index 659ce00f..4aa4211e 100644 --- a/erp24/api3/core/services/IncomeService.php +++ b/erp24/api3/core/services/IncomeService.php @@ -36,7 +36,7 @@ class IncomeService 'shift_id' => $fact->shift_id, 'salary_shift' => $fact->salary_shift, 'price' => $fact->shift_id == 1 ? 125 : 145, - 'work_hours' => $fact->work_time, + 'work_hours' => $fact->work_time, 'in_shift' => count($fact->checkIns) == 1, ]; } diff --git a/erp24/api3/modules/v1/controllers/timetable/FactController.php b/erp24/api3/modules/v1/controllers/timetable/FactController.php index 261addf9..e149cee2 100644 --- a/erp24/api3/modules/v1/controllers/timetable/FactController.php +++ b/erp24/api3/modules/v1/controllers/timetable/FactController.php @@ -33,10 +33,12 @@ class FactController extends ActiveController 'class' => \yii\data\ActiveDataFilter::class, 'searchModel' => $timetableClass, ]; -// -// $actions['index']['prepareSearchQuery'] = function ($query, $requestParams) { -// return $query->andFilterWhere(['tabel' => 1]); -// }; + + $actions['index']['prepareSearchQuery'] = function ($query, $requestParams) { + $query->andFilterWhere(['is_close' => false]) + ->andFilterWhere(['is_opening' => true]); + return $query; + }; unset($actions['create'], $actions['delete']); diff --git a/erp24/api3/modules/v1/controllers/timetable/PlanController.php b/erp24/api3/modules/v1/controllers/timetable/PlanController.php index 208d7f9c..2d1595d6 100644 --- a/erp24/api3/modules/v1/controllers/timetable/PlanController.php +++ b/erp24/api3/modules/v1/controllers/timetable/PlanController.php @@ -38,13 +38,16 @@ class PlanController extends \yii_app\api3\controllers\ActiveController ]; $actions['index']['prepareSearchQuery'] = function ($query, $requestParams) { - $plans = TimetableFactModel::find() - ->andWhere(['admin_id' => $requestParams['filter']['admin_id']]) - ->select('plan_id') - ->column(); + if ($requestParams['is_get_plan']) { + $plans = TimetableFactModel::find() + ->andWhere(['admin_id' => $requestParams['filter']['admin_id']]) + ->select('plan_id') + ->column(); - $query->andFilterWhere(['not in', 'id', $plans]); - $query->andFilterWhere(['tabel' => 0]); + $query->andFilterWhere(['not in', 'id', $plans]); + $query->andFilterWhere(['tabel' => 0]); + return $query; + } return $query; };