From: fomichev Date: Thu, 17 Jul 2025 08:22:13 +0000 (+0300) Subject: добавление allowed_editing X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=6ca87ae55f7842faf43f05a38804c1c5b6df3c4d;p=erp24_rep%2Fyii-erp24%2F.git добавление allowed_editing --- diff --git a/erp24/commands/CronController.php b/erp24/commands/CronController.php index 688dcc3c..c56c34de 100644 --- a/erp24/commands/CronController.php +++ b/erp24/commands/CronController.php @@ -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 index 00000000..c8956845 --- /dev/null +++ b/erp24/migrations/m250717_080913_add_is_marketplace_allowed_editing_fields_to_marketplace_orders_1c_statuses_table.php @@ -0,0 +1,61 @@ +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; + } + */ +} diff --git a/erp24/records/MarketplaceOrder1cStatuses.php b/erp24/records/MarketplaceOrder1cStatuses.php index f6c674f8..4794d462 100644 --- a/erp24/records/MarketplaceOrder1cStatuses.php +++ b/erp24/records/MarketplaceOrder1cStatuses.php @@ -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' => 'Разрешено редактирование' ]; } diff --git a/erp24/views/crud/marketplace-order1c-statuses/_form.php b/erp24/views/crud/marketplace-order1c-statuses/_form.php index 0650665d..0ef41817 100644 --- a/erp24/views/crud/marketplace-order1c-statuses/_form.php +++ b/erp24/views/crud/marketplace-order1c-statuses/_form.php @@ -66,6 +66,14 @@ $this->registerJsFile( 'id' => 'marketplace-order1cstatuses-allowed_closing', ] ) ?> + field($model, 'allowed_editing') + ->dropDownList( + [0 => 'Нет', 1 => 'Да'], + [ + 'prompt' => 'Выберите разрешено ли редактирование', + 'id' => 'marketplace-order1cstatuses-allowed_editing', + ] + ) ?> field($model, 'order_status_id') ->dropDownList( $orderStatusTypes, diff --git a/erp24/views/crud/marketplace-order1c-statuses/view.php b/erp24/views/crud/marketplace-order1c-statuses/view.php index e73e6949..3428fc37 100644 --- a/erp24/views/crud/marketplace-order1c-statuses/view.php +++ b/erp24/views/crud/marketplace-order1c-statuses/view.php @@ -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) {