From: marina Date: Thu, 19 Sep 2024 09:29:09 +0000 (+0300) Subject: фильтрация смен X-Git-Tag: 1.5~15^2~1 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=c278870c928457c09147101bab3caafe03ff2bc8;p=erp24_rep%2Fyii-erp24%2F.git фильтрация смен --- diff --git a/erp24/api3/modules/v1/controllers/timetable/PlanController.php b/erp24/api3/modules/v1/controllers/timetable/PlanController.php index 4508a23d..b308e583 100644 --- a/erp24/api3/modules/v1/controllers/timetable/PlanController.php +++ b/erp24/api3/modules/v1/controllers/timetable/PlanController.php @@ -37,6 +37,14 @@ class PlanController extends \yii_app\api3\controllers\ActiveController 'searchModel' => $this->modelClass, ]; + $actions['index']['prepareSearchQuery'] = function ($query, $requestParams) { + $plans = TimetableFactModel::find() + ->andWhere(['admin_id' => $requestParams['filter']['admin_id']]) + ->select('plan_id') + ->column(); + return $query->andFilterWhere(['not in', 'id', $plans]); + }; + unset($actions['delete']); return $actions;