From c0c4acb8e95708d39e4eb6ab2ff3490d21d1f088 Mon Sep 17 00:00:00 2001 From: marina Date: Fri, 24 Jan 2025 12:59:24 +0300 Subject: [PATCH] =?utf8?q?ERP-282=20=D0=9D=D1=83=D0=B6=D0=BD=D0=BE=20?= =?utf8?q?=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D1=82=D1=8C=20=D0=B8=D0=BD=D1=82?= =?utf8?q?=D0=B5=D1=80=D1=84=D0=B5=D0=B9=D1=81=20=D0=BD=D0=B0=D1=81=D1=82?= =?utf8?q?=D1=80=D0=BE=D0=B9=D0=BA=D0=B8=20=D0=BC=D0=B0=D0=B3=D0=B0=D0=B7?= =?utf8?q?=D0=B8=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../controllers/CityStoreParamsController.php | 27 ++++--------------- erp24/records/CityStoreParams.php | 4 +++ erp24/views/city-store-params/view.php | 6 +++++ 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/erp24/controllers/CityStoreParamsController.php b/erp24/controllers/CityStoreParamsController.php index 51050cd9..a0ed126c 100644 --- a/erp24/controllers/CityStoreParamsController.php +++ b/erp24/controllers/CityStoreParamsController.php @@ -61,30 +61,13 @@ class CityStoreParamsController extends Controller ? $this->findModel(Yii::$app->request->post()['CityStoreParams']['id']) : new CityStoreParams(); - if ($model->load(Yii::$app->request->post())) { $model->matrix_type = is_array($model->matrix_type) ? implode(',', $model->matrix_type) : $model->matrix_type; -// $oldStoreDynamic = StoreDynamic::findOne(['store_id' => $model->store_id, 'category' => 1, 'active' => 1]) ?? null; -// if ($oldStoreDynamic != $model->bush_id) { -// $newStoreDynamic = new StoreDynamic(); -// $newStoreDynamic->setAttributes([ -// 'store_id' => $model->store_id, -// 'value_type' => 'int', -// 'value_int' => $model->bush_id, -// 'date_from' => new Expression('now()'), -// 'date_to' => '2100-01-01 00:00:00', -// 'active' => 1, -// 'category' => 1 -// ]); -// $oldStoreDynamic->update(['date_to' => new Expression('now()'), 'active' => 0], ['store_id' => $model->store_id, 'category' => 1, 'active' => 1]); -// } -// -//// $oldBushChefFlorist = - - if ($model->validate()) { - $model->save(); - return $this->redirect(['view', 'id' => $model->id]); - } + } + + if ($model->validate()) { + $model->save(); + return $this->redirect(['view', 'id' => $model->id]); } return $this->render('index'); diff --git a/erp24/records/CityStoreParams.php b/erp24/records/CityStoreParams.php index 56d1b377..3c991112 100644 --- a/erp24/records/CityStoreParams.php +++ b/erp24/records/CityStoreParams.php @@ -138,4 +138,8 @@ class CityStoreParams extends ActiveRecord public function getAddressCity() { return $this->hasOne(StoreCityList::class, ['id' => 'address_city']); } + + public function getBush() { + return $this->hasOne(ClusterAdmin::class, ['id' => 'bush_id']); + } } diff --git a/erp24/views/city-store-params/view.php b/erp24/views/city-store-params/view.php index 0fe79ce2..f3a4d648 100644 --- a/erp24/views/city-store-params/view.php +++ b/erp24/views/city-store-params/view.php @@ -61,6 +61,12 @@ $this->params['breadcrumbs'][] = $this->title; return $data->territorialManager->name_full ?? ''; } ], + [ + 'attribute' => 'bushId', + 'value' => function ($data) { + return $data->bush->name ?? ''; + } + ], [ 'attribute' => 'bush_chef_florist', 'value' => function ($data) { -- 2.39.5