]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-275 Добавление колонки для сохранения type в товаре из каталога
authormarina <m.zozirova@gmail.com>
Fri, 27 Dec 2024 09:44:41 +0000 (12:44 +0300)
committermarina <m.zozirova@gmail.com>
Fri, 27 Dec 2024 09:44:41 +0000 (12:44 +0300)
erp24/api2/controllers/DataController.php
erp24/migrations/m241227_093337_add_type_column_on_products_1c.php [new file with mode: 0644]
erp24/records/Products1c.php

index 92fbd85097782b6e179fe54fcab3fb6acf41a355..f9425c9c6ed82fcded1f55031871381fb37aefc7 100644 (file)
@@ -868,6 +868,7 @@ class DataController extends BaseController
                     if (!$products1c6) {
                         $products1c6 = new Products1c;
                         $products1c6->id = $arr["id"];
+                        $products1c6->type = $arr["type"];
                         $products1c6->tip = 'products';
                     }
                     $products1c6->name = $arr["name"];
diff --git a/erp24/migrations/m241227_093337_add_type_column_on_products_1c.php b/erp24/migrations/m241227_093337_add_type_column_on_products_1c.php
new file mode 100644 (file)
index 0000000..9483296
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+
+use yii\db\Migration;
+
+class m241227_093337_add_type_column_on_products_1c extends Migration
+{
+
+    const TABLE_NAME = 'erp24.products_1c';
+
+    public function safeUp()
+    {
+        $this->addColumn(
+            self::TABLE_NAME,
+            'type',
+            $this->string(255)
+                ->null()
+                ->comment('Тип товара в системе 1С')
+        );
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown()
+    {
+        $this->dropColumn(self::TABLE_NAME, 'type');
+
+    }
+}
index 5662bd7c2d9142ea0d89cf04afa1934f8a223e2b..4a723841d46444d029a3af052a24114f5303c1c3 100644 (file)
@@ -39,7 +39,7 @@ class Products1c extends \yii\db\ActiveRecord
             [['view'], 'integer'],
             [['id', 'parent_id', 'code', 'articule'], 'string', 'max' => 36],
             [['tip'], 'string', 'max' => 25],
-            [['name'], 'string', 'max' => 255],
+            [['name', 'type'], 'string', 'max' => 255],
             [['id'], 'unique'],
             [['components'], 'string'],
         ];
@@ -58,6 +58,7 @@ class Products1c extends \yii\db\ActiveRecord
             'name' => 'Name',
             'articule' => 'Articule',
             'view' => 'View',
+            'type' => 'Type',
             'components' => 'Components',
         ];
     }