]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-282 Нужно сделать интерфейс настройки магазина
authormarina <m.zozirova@gmail.com>
Fri, 24 Jan 2025 07:28:14 +0000 (10:28 +0300)
committermarina <m.zozirova@gmail.com>
Fri, 24 Jan 2025 07:28:14 +0000 (10:28 +0300)
erp24/controllers/CityStoreParamsController.php

index 7971652d5053dca66ed573d65d569c55ac386ba9..e8995e5c020a2ba3b4dfd80aea1f5c026d90e622 100644 (file)
@@ -4,6 +4,7 @@ namespace app\controllers;
 
 use Yii;
 use yii\data\ActiveDataProvider;
+use yii\db\Expression;
 use yii\helpers\ArrayHelper;
 use yii\web\Controller;
 use yii\web\NotFoundHttpException;
@@ -63,6 +64,23 @@ class CityStoreParamsController extends Controller
 
         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]);