]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Настройка для управления активностью фидов feature_fomichev_erp-467_flowwow_feed_to_files origin/feature_fomichev_erp-467_flowwow_feed_to_files
authorVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Tue, 23 Sep 2025 15:50:24 +0000 (18:50 +0300)
committerVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Tue, 23 Sep 2025 15:50:24 +0000 (18:50 +0300)
erp24/commands/MarketplaceController.php
erp24/migrations/m250923_153148_add_is_feed_active_to_marketplace_store_table.php [new file with mode: 0644]
erp24/records/MarketplaceStore.php
erp24/views/marketplace-store/_form.php
erp24/views/marketplace-store/index.php

index 10e89c395c252983cd3338c713776fd79102f1f0..22ca1d46fc61306738b3eac8c199bab3724544de 100644 (file)
@@ -213,7 +213,7 @@ class MarketplaceController extends Controller
     public function actionFlowwowFeedFile() {
         $marketplaceStoreIds = MarketplaceStore::find()
             ->select('warehouse_guid')
-            ->where(['warehouse_id' => MarketplaceStore::FLOWWOW_WAREHOUSE_ID])
+            ->where(['warehouse_id' => MarketplaceStore::FLOWWOW_WAREHOUSE_ID, 'is_feed_active' => 1])
             ->column();
         foreach ($marketplaceStoreIds as $key => $id) {
             $balanceInfo = MarketplaceService::infoForMarketplace(1);
diff --git a/erp24/migrations/m250923_153148_add_is_feed_active_to_marketplace_store_table.php b/erp24/migrations/m250923_153148_add_is_feed_active_to_marketplace_store_table.php
new file mode 100644 (file)
index 0000000..dd50426
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+
+use yii\db\Migration;
+
+class m250923_153148_add_is_feed_active_to_marketplace_store_table extends Migration
+{
+    const TABLE_NAME = 'erp24.marketplace_store';
+    /**
+     * {@inheritdoc}
+     */
+    public function safeUp()
+    {
+        $table = $this->db->schema->getTableSchema(self::TABLE_NAME);
+        if ($table === null) {
+            return;
+        }
+
+        if (!$this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('is_feed_active')) {
+            $this->addColumn(
+                self::TABLE_NAME,
+                'is_feed_active',
+                $this->tinyInteger()->notNull()->defaultValue(1)->comment('активность фида')
+            );
+        }
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown()
+    {
+        if ($this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('is_feed_active')) {
+            $this->dropColumn(self::TABLE_NAME, 'is_feed_active');
+        }
+    }
+
+
+
+}
index 756b4175f32194ec97d3402518669f4956cb2a01..a231d38592eb412ef8492c6d0d28b35a3d189bc6 100644 (file)
@@ -21,11 +21,13 @@ use yii\db\Expression;
  * @property int $updated_at
  * @property int $updated_by
  * @property string $account_email Почта привязанная к магазину
+ * @property int $is_feed_active
  */
 class MarketplaceStore extends \yii\db\ActiveRecord
 {
     const FLOWWOW_WAREHOUSE_ID = 1;
     const YANDEX_WAREHOUSE_ID = 2;
+
     /**
      * {@inheritdoc}
      */
@@ -44,9 +46,10 @@ class MarketplaceStore extends \yii\db\ActiveRecord
             [['store_id'], 'exist', 'targetClass' => CityStore::class, 'targetAttribute' => 'id'],
             [['name', 'guid', 'firm', 'warehouse_guid', 'account_email'], 'string'],
             [['created_at', 'updated_at'], 'datetime', 'format' => 'php:Y-m-d H:i:s'],
-            [['store_id', 'created_by', 'updated_by', 'warehouse_id',], 'integer'],
+            [['store_id', 'created_by', 'is_feed_active', 'updated_by', 'warehouse_id',], 'integer'],
             ['account_email', 'unique', 'message' => 'Этот email уже используется.'],
 
+
         ];
     }
 
@@ -84,7 +87,8 @@ class MarketplaceStore extends \yii\db\ActiveRecord
             'created_by' => 'Автор создания записи',
             'updated_at' => 'Дата изменения записи',
             'updated_by' => 'Автор изменения записи',
-            'account_email' => 'Почта привязанная к магазину'
+            'account_email' => 'Почта привязанная к магазину',
+            'is_feed_active' => 'Активность фида'
         ];
     }
 
index 91e3a012b76597fcb90e081aef7c9667c50b1db1..caa74dc1d22ff720fd05aab804d329070d815148 100644 (file)
@@ -30,6 +30,7 @@ use yii\widgets\ActiveForm;
     </div>
     <?= $form->field($model, 'warehouse_guid')->textInput(['type' => 'integer']) ?>
     <?= $form->field($model, 'account_email')->textInput() ?>
+    <?= $form->field($model, 'is_feed_active')->checkbox() ?>
     <?= $form->field($model, 'firm')->dropDownList($firms, ['prompt' => 'Выберите юр лицо']) ?>
 
     <div class="form-group">
index 55f28de2e3c9edf4ec0376b640f10e3693970121..df18e363442ade794bd7499698bda9c2edf3a173 100644 (file)
@@ -43,6 +43,13 @@ $this->params['breadcrumbs'][] = $this->title;
                     return Firms::getInn()[$model->firm];
                 }
             ],
+            [
+                'attribute' => 'is_feed_active',
+                'label' => 'Активный фид',
+                'value' => function ($model) {
+                    return $model->is_feed_active ? 'Да' : 'Нет';
+                }
+            ],
             'created_at',
             'updated_at',