'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
$data[] = [
'id' => $marketplaceGuid,
'name' => $marketplaceName,
+ 'is_marketplace' => 1,
'statuses' => $statusesData
];
}
--- /dev/null
+<?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;
+ }
+ */
+}
* @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
{
[['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],
];
'posit' => 'Порядок статусов',
'order_status_id' => 'Ссылка на статус заказа в МП',
'order_substatus_id' => 'Ссылка на субстатус заказа в МП',
+ 'is_marketplace' => 'Метка заказа из маркетплейса',
+ 'allowed_editing' => 'Разрешено редактирование'
];
}
'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,
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) {