]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
добавление allowed_editing
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Thu, 17 Jul 2025 08:22:13 +0000 (11:22 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Thu, 17 Jul 2025 08:22:13 +0000 (11:22 +0300)
erp24/commands/CronController.php
erp24/migrations/m250717_080913_add_is_marketplace_allowed_editing_fields_to_marketplace_orders_1c_statuses_table.php [new file with mode: 0644]
erp24/records/MarketplaceOrder1cStatuses.php
erp24/views/crud/marketplace-order1c-statuses/_form.php
erp24/views/crud/marketplace-order1c-statuses/view.php

index 688dcc3c3dd715c4825025f4ee67ead56b07f370..c56c34de2b3af38e29c89b7650cfdb9643e14ae8 100644 (file)
@@ -129,6 +129,7 @@ class CronController extends Controller
                     'status_name' => $status->status,
                     'allowed_reserve' => $status->allowed_reserve,
                     'allowed_closing' => $status->allowed_closing,
+                    'allowed_editing' => $status->allowed_editing,
                     'hint' => $status->status_instruction,
                     'status_id' => $status->status_id,
                     'allowed_statuses' => $relationsToSend
@@ -137,6 +138,7 @@ class CronController extends Controller
             $data[] = [
                 'id' => $marketplaceGuid,
                 'name' => $marketplaceName,
+                'is_marketplace' => 1,
                 'statuses' => $statusesData
             ];
         }
diff --git a/erp24/migrations/m250717_080913_add_is_marketplace_allowed_editing_fields_to_marketplace_orders_1c_statuses_table.php b/erp24/migrations/m250717_080913_add_is_marketplace_allowed_editing_fields_to_marketplace_orders_1c_statuses_table.php
new file mode 100644 (file)
index 0000000..c895684
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+
+use yii\db\Migration;
+
+class m250717_080913_add_is_marketplace_allowed_editing_fields_to_marketplace_orders_1c_statuses_table extends Migration
+{
+    const TABLE_NAME = 'erp24.marketplace_order_1c_statuses';
+    /**
+     * {@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_marketplace')) {
+            $this->addColumn(
+                self::TABLE_NAME,
+                'is_marketplace',
+                $this->integer()->defaultValue(1)->comment('Метка заказа из маркетплейса'),
+            );
+        }
+        if (!$this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('allowed_editing')) {
+            $this->addColumn(
+                self::TABLE_NAME,
+                'allowed_editing',
+                $this->integer()->defaultValue(1)->comment('Разрешено редактирование'),
+            );
+        }
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown()
+    {
+        if ($this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('is_marketplace')) {
+            $this->dropColumn(self::TABLE_NAME, 'is_marketplace');
+        }
+        if ($this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('allowed_editing')) {
+            $this->dropColumn(self::TABLE_NAME, 'allowed_editing');
+        }
+    }
+
+    /*
+    // Use up()/down() to run migration code without a transaction.
+    public function up()
+    {
+
+    }
+
+    public function down()
+    {
+        echo "m250717_080913_add_is_marketplace_allowed_editing_fields_to_marketplace_orders_1c_statuses_table cannot be reverted.\n";
+
+        return false;
+    }
+    */
+}
index f6c674f82efb468a47ba78b41d541e077df5dedd..4794d46214acf687cc68b594a07bc70697c748cd 100644 (file)
@@ -18,6 +18,8 @@ use yii\db\ActiveQuery;
  * @property int $posit Порядок статусов
  * @property int|null $order_status_id Ссылка на статус заказа в МП
  * @property int|null $order_substatus_id Ссылка на субстатус заказа в МП
+ * @property int $is_marketplace Метка заказа из маркетплейса
+ * @property int allowed_editing Разрешено редактирование
  */
 class MarketplaceOrder1cStatuses extends \yii\db\ActiveRecord
 {
@@ -55,7 +57,15 @@ class MarketplaceOrder1cStatuses extends \yii\db\ActiveRecord
             [['marketplace_id', 'status_id', 'status', 'status_instruction'], 'required'],
             [['marketplace_id'], 'default', 'value' => null],
             [['posit', 'allowed_reserve', 'allowed_closing'], 'default', 'value' => 0],
-            [['marketplace_id', 'posit', 'allowed_reserve', 'allowed_closing', 'order_status_id', 'order_substatus_id'], 'integer'],
+            [['marketplace_id',
+                'posit',
+                'allowed_reserve',
+                'allowed_closing',
+                'order_status_id',
+                'order_substatus_id',
+                'is_marketplace',
+                'allowed_editing'
+                ], 'integer'],
             [['status_instruction', 'status_id'], 'string'],
             [['status_id', 'status'], 'string', 'max' => 100],
         ];
@@ -77,6 +87,8 @@ class MarketplaceOrder1cStatuses extends \yii\db\ActiveRecord
             'posit' => 'Порядок статусов',
             'order_status_id' => 'Ссылка на статус заказа в МП',
             'order_substatus_id' => 'Ссылка на субстатус заказа в МП',
+            'is_marketplace' => 'Метка заказа из маркетплейса',
+            'allowed_editing' => 'Разрешено редактирование'
         ];
     }
 
index 0650665d3acdc8a75f38c3cd5b69aaae695d9243..0ef41817eeac903006cedf4efd2f692f461978bc 100644 (file)
@@ -66,6 +66,14 @@ $this->registerJsFile(
                 'id' => 'marketplace-order1cstatuses-allowed_closing',
             ]
         ) ?>
+    <?= $form->field($model, 'allowed_editing')
+        ->dropDownList(
+            [0 => 'Нет', 1 => 'Да'],
+            [
+                'prompt' => 'Выберите разрешено ли редактирование',
+                'id' => 'marketplace-order1cstatuses-allowed_editing',
+            ]
+        ) ?>
     <?= $form->field($model, 'order_status_id')
         ->dropDownList(
             $orderStatusTypes,
index e73e694960994a9f72657af581644874a8b8a93f..3428fc3704b7ebf19e1faaa0189f4c19b6e0eec3 100644 (file)
@@ -55,6 +55,18 @@ $this->params['breadcrumbs'][] = $this->title;
                     return $model->allowed_closing === 0 ? 'Нет' : 'Да';
                 }
             ],
+            [
+                'attribute' => 'allowed_editing',
+                'value' => function ($model) {
+                    return $model->allowed_editing === 0 ? 'Нет' : 'Да';
+                }
+            ],
+            [
+                'attribute' => 'is_marketplace',
+                'value' => function ($model) {
+                    return $model->is_marketplace === 0 ? 'Нет' : 'Да';
+                }
+            ],
             [
                 'attribute' => 'order_status_id',
                 'value' => function ($model) {