From f0557e16ebda080947ee3b6341f405d6d4fbbe3d Mon Sep 17 00:00:00 2001 From: Vladimir Fomichev Date: Tue, 23 Sep 2025 18:50:24 +0300 Subject: [PATCH] =?utf8?q?=D0=9D=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B9=D0=BA?= =?utf8?q?=D0=B0=20=D0=B4=D0=BB=D1=8F=20=D1=83=D0=BF=D1=80=D0=B0=D0=B2?= =?utf8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B0=D0=BA=D1=82=D0=B8=D0=B2?= =?utf8?q?=D0=BD=D0=BE=D1=81=D1=82=D1=8C=D1=8E=20=D1=84=D0=B8=D0=B4=D0=BE?= =?utf8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/commands/MarketplaceController.php | 2 +- ...feed_active_to_marketplace_store_table.php | 39 +++++++++++++++++++ erp24/records/MarketplaceStore.php | 8 +++- erp24/views/marketplace-store/_form.php | 1 + erp24/views/marketplace-store/index.php | 7 ++++ 5 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 erp24/migrations/m250923_153148_add_is_feed_active_to_marketplace_store_table.php diff --git a/erp24/commands/MarketplaceController.php b/erp24/commands/MarketplaceController.php index 10e89c39..22ca1d46 100644 --- a/erp24/commands/MarketplaceController.php +++ b/erp24/commands/MarketplaceController.php @@ -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 index 00000000..dd504268 --- /dev/null +++ b/erp24/migrations/m250923_153148_add_is_feed_active_to_marketplace_store_table.php @@ -0,0 +1,39 @@ +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'); + } + } + + + +} diff --git a/erp24/records/MarketplaceStore.php b/erp24/records/MarketplaceStore.php index 756b4175..a231d385 100644 --- a/erp24/records/MarketplaceStore.php +++ b/erp24/records/MarketplaceStore.php @@ -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' => 'Активность фида' ]; } diff --git a/erp24/views/marketplace-store/_form.php b/erp24/views/marketplace-store/_form.php index 91e3a012..caa74dc1 100644 --- a/erp24/views/marketplace-store/_form.php +++ b/erp24/views/marketplace-store/_form.php @@ -30,6 +30,7 @@ use yii\widgets\ActiveForm; field($model, 'warehouse_guid')->textInput(['type' => 'integer']) ?> field($model, 'account_email')->textInput() ?> + field($model, 'is_feed_active')->checkbox() ?> field($model, 'firm')->dropDownList($firms, ['prompt' => 'Выберите юр лицо']) ?>
diff --git a/erp24/views/marketplace-store/index.php b/erp24/views/marketplace-store/index.php index 55f28de2..df18e363 100644 --- a/erp24/views/marketplace-store/index.php +++ b/erp24/views/marketplace-store/index.php @@ -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', -- 2.39.5