$statusesData [] = [
'index_number' => $status->posit,
'status_name' => $status->status,
+ 'allowed_reserve' => $status->allowed_reserve,
+ 'allowed_closing' => $status->allowed_closing,
'hint' => $status->status_instruction,
'status_id' => $status->status_id,
'allowed_statuses' => $relationsToSend
--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+class m250702_140510_add_allowed_fields_to_marketplace_order_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('allowed_reserve')) {
+ $this->addColumn(
+ self::TABLE_NAME,
+ 'allowed_reserve',
+ $this->integer()->defaultValue(0)->comment('Разрешено резервирование'),
+ );
+ }
+ if (!$this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('allowed_closing')) {
+ $this->addColumn(
+ self::TABLE_NAME,
+ 'allowed_closing',
+ $this->integer()->defaultValue(0)->comment('Разрешено закрытие'),
+ );
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeDown()
+ {
+ if ($this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('allowed_reserve')) {
+ $this->dropColumn(self::TABLE_NAME, 'allowed_reserve');
+ }
+ if ($this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('allowed_closing')) {
+ $this->dropColumn(self::TABLE_NAME, 'allowed_closing');
+ }
+ }
+
+ /*
+ // Use up()/down() to run migration code without a transaction.
+ public function up()
+ {
+
+ }
+
+ public function down()
+ {
+ echo "m250702_140510_add_allowed_fields_to_marketplace_order_1c_statuses_table cannot be reverted.\n";
+
+ return false;
+ }
+ */
+}
*
* @property int $id
* @property int $marketplace_id Маркетплейс
+ * @property int $allowed_reserve Разрешено резервирование
+ * @property int $allowed_closing Разрешено закрытие
* @property string $status_id артикул
* @property string $status Статус
* @property string $status_instruction Инструкция к статусу
return [
[['marketplace_id', 'status_id', 'status', 'status_instruction'], 'required'],
[['marketplace_id'], 'default', 'value' => null],
- [['posit'], 'default', 'value' => 0],
- [['marketplace_id', 'posit'], 'integer'],
+ [['posit', 'allowed_reserve', 'allowed_closing'], 'default', 'value' => 0],
+ [['marketplace_id', 'posit', 'allowed_reserve', 'allowed_closing'], 'integer'],
[['status_instruction', 'status_id'], 'string'],
[['status_id', 'status'], 'string', 'max' => 100],
];
'id' => 'ID',
'marketplace_id' => 'Маркетплейс ID',
'status_id' => 'артикул',
+ 'allowed_reserve' => 'Разрешено резервирование',
+ 'allowed_closing' => 'Разрешено закрытие',
'status' => 'Статус',
'status_instruction' => 'Инструкция к статусу',
'posit' => 'Порядок статусов',
<?= $form->field($model, 'status')->textInput(['maxlength' => true]) ?>
+ <?= $form->field($model, 'allowed_reserve')
+ ->dropDownList(
+ [0 => 'Нет', 1 => 'Да'],
+ [
+ 'prompt' => 'Выберите разрешено ли резервирование',
+ 'id' => 'marketplace-order1cstatuses-allowed_reserve',
+ ]
+ ) ?>
+
+ <?= $form->field($model, 'allowed_closing')
+ ->dropDownList(
+ [0 => 'Нет', 1 => 'Да'],
+ [
+ 'prompt' => 'Выберите разрешено ли закрытие',
+ 'id' => 'marketplace-order1cstatuses-allowed_closing',
+ ]
+ ) ?>
+
<?= $form->field($model, 'status_instruction')->textarea(['rows' => 4]) ?>
<div class="form-group">
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
}
],
'status',
+ [
+ 'attribute' => 'allowed_reserve',
+ 'value' => function ($model) {
+ return $model->allowed_reserve === 0 ? 'Нет' : 'Да';
+ }
+ ],
+ [
+ 'attribute' => 'allowed_closing',
+ 'value' => function ($model) {
+ return $model->allowed_closing === 0 ? 'Нет' : 'Да';
+ }
+ ],
'status_instruction:ntext',
[
'class' => ActionColumn::class,
}
],
'status',
+ [
+ 'attribute' => 'allowed_reserve',
+ 'value' => function ($model) {
+ return $model->allowed_reserve === 0 ? 'Нет' : 'Да';
+ }
+ ],
+ [
+ 'attribute' => 'allowed_closing',
+ 'value' => function ($model) {
+ return $model->allowed_closing === 0 ? 'Нет' : 'Да';
+ }
+ ],
'status_instruction:ntext',
[
'label' => 'Связанные статусы',