$sortValue = $characteristicsValues['сорт'];
}
+ $typeValue = null;
+ if (isset($characteristicsValues['type']) && !empty($characteristicsValues['type'])) {
+ $typeValue = $characteristicsValues['type'];
+ }
+ if (isset($characteristicsValues['тип']) && !empty($characteristicsValues['тип'])) {
+ $typeValue = $characteristicsValues['тип'];
+ }
+
$measureValue = null;
if (isset($characteristicsValues['measure']) && !empty($characteristicsValues['measure'])) {
$measureValue = $characteristicsValues['measure'];
$product1cNomenclature->species = $speciesValue;
$product1cNomenclature->sort = $sortValue;
+ $product1cNomenclature->type = $typeValue;
$product1cNomenclature->size = $sizeValue;
$product1cNomenclature->measure = $measureValue;
$product1cNomenclature->color = $colorValue;
--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Class m250217_114306_add_column_type_to_products_1c_nomenclature_table
+ */
+class m250217_114306_add_column_type_to_products_1c_nomenclature_table extends Migration
+{
+ const TABLE_NAME = 'erp24.products_1c_nomenclature';
+ /**
+ * {@inheritdoc}
+ */
+ public function safeUp()
+ {
+ if ($this->db->schema->getTableSchema(self::TABLE_NAME) === null) {
+ return;
+ }
+
+ if ($this->db->schema->getTableSchema(self::TABLE_NAME)->getColumn('type') === null) {
+ $this->addColumn(
+ self::TABLE_NAME,
+ 'type',
+ $this->string()->null()->comment('Тип'),
+ );
+ }
+
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeDown()
+ {
+ if ($this->db->schema->getTableSchema(self::TABLE_NAME) === null) {
+ return;
+ }
+
+ if ($this->db->schema->getTableSchema(self::TABLE_NAME)->getColumn('type') !== null) {
+ $this->dropColumn(self::TABLE_NAME, 'type');
+ }
+ }
+
+ /*
+ // Use up()/down() to run migration code without a transaction.
+ public function up()
+ {
+
+ }
+
+ public function down()
+ {
+ echo "m250217_114306_add_column_type_to_products_1c_nomenclature_table cannot be reverted.\n";
+
+ return false;
+ }
+ */
+}
*/
class Products1c extends \yii\db\ActiveRecord
{
-
- const PRODUCT1C_FIELDS = ['id', 'parent_id', 'tip', 'code', 'name', 'articule', 'view', 'components', 'AdditionCharacteristics'];
+ const PRODUCT1C_FIELDS = ['id', 'parent_id', 'tip', 'type', 'code', 'name', 'articule', 'view', 'components', 'AdditionCharacteristics'];
/**
* {@inheritdoc}
* @property string|null $subcategory Подкатегория
* @property string|null $species Вид
* @property string|null $sort Сорт
+ * @property string|null $type Тип
* @property int|null $size Размер
* @property string|null $measure Единица измерения
* @property string|null $color Цвет
{
return [
[['id', 'location', 'name', 'type_num', 'category'], 'required'],
- [['size', 'species', 'subcategory', 'sort', 'measure', 'color'], 'default', 'value' => null],
+ [['size', 'species', 'subcategory', 'sort', 'measure', 'color', 'type'], 'default', 'value' => null],
[['size'], 'integer'],
- [['id', 'location', 'name', 'type_num', 'category', 'subcategory', 'species', 'sort', 'measure', 'color'], 'string', 'max' => 255],
+ [['id', 'location', 'name', 'type_num',
+ 'category', 'subcategory', 'species', 'sort', 'measure', 'color', 'type'], 'string', 'max' => 255],
[['id'], 'unique'],
];
}
'subcategory' => 'Подкатегория',
'species' => 'Вид',
'sort' => 'Сорт',
+ 'type' => 'Тип',
'size' => 'Размер',
'measure' => 'Единица измерения',
'color' => 'Цвет',