From ade74879c079cd164c4d46d80f44795e2b74d578 Mon Sep 17 00:00:00 2001 From: fomichev Date: Thu, 17 Jul 2025 17:01:05 +0300 Subject: [PATCH] =?utf8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B4=D0=B0=D1=87=D0=B0?= =?utf8?q?=20=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=B9=20=D0=BD=D0=B0=20=D1=83?= =?utf8?q?=D1=81=D0=BF=D0=B5=D1=85=20=D0=B8=20=D0=BE=D1=82=D0=BC=D0=B5?= =?utf8?q?=D0=BD=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/commands/CronController.php | 2 + ...o_marketplace_orders_1c_statuses_table.php | 61 +++++++++++++++++++ erp24/records/MarketplaceOrder1cStatuses.php | 10 ++- .../marketplace-order1c-statuses/_form.php | 16 +++++ .../marketplace-order1c-statuses/index.php | 4 ++ .../marketplace-order1c-statuses/view.php | 12 ++++ 6 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 erp24/migrations/m250717_134217_add_successfull_order_cancelled_order_fields_to_marketplace_orders_1c_statuses_table.php diff --git a/erp24/commands/CronController.php b/erp24/commands/CronController.php index c56c34de..4fb58019 100644 --- a/erp24/commands/CronController.php +++ b/erp24/commands/CronController.php @@ -130,6 +130,8 @@ class CronController extends Controller 'allowed_reserve' => $status->allowed_reserve, 'allowed_closing' => $status->allowed_closing, 'allowed_editing' => $status->allowed_editing, + 'successful_order' => $status->successful_order, + 'cancelled_order' => $status->cancelled_order, 'hint' => $status->status_instruction, 'status_id' => $status->status_id, 'allowed_statuses' => $relationsToSend diff --git a/erp24/migrations/m250717_134217_add_successfull_order_cancelled_order_fields_to_marketplace_orders_1c_statuses_table.php b/erp24/migrations/m250717_134217_add_successfull_order_cancelled_order_fields_to_marketplace_orders_1c_statuses_table.php new file mode 100644 index 00000000..e714b210 --- /dev/null +++ b/erp24/migrations/m250717_134217_add_successfull_order_cancelled_order_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('successful_order')) { + $this->addColumn( + self::TABLE_NAME, + 'successful_order', + $this->integer()->defaultValue(0)->comment('Ключ успешного завершения заказа'), + ); + } + if (!$this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('cancelled_order')) { + $this->addColumn( + self::TABLE_NAME, + 'cancelled_order', + $this->integer()->defaultValue(0)->comment('Ключ отмененного заказа'), + ); + } + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + if ($this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('successful_order')) { + $this->dropColumn(self::TABLE_NAME, 'successful_order'); + } + if ($this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('cancelled_order')) { + $this->dropColumn(self::TABLE_NAME, 'cancelled_order'); + } + } + + /* + // Use up()/down() to run migration code without a transaction. + public function up() + { + + } + + public function down() + { + echo "m250717_134217_add_successfull_order_cancelled_order_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 436e108a..b013fe5d 100644 --- a/erp24/records/MarketplaceOrder1cStatuses.php +++ b/erp24/records/MarketplaceOrder1cStatuses.php @@ -12,6 +12,8 @@ use yii\db\ActiveQuery; * @property int $marketplace_id Маркетплейс * @property int $allowed_reserve Разрешено резервирование * @property int $allowed_closing Разрешено закрытие + * @property int $cancelled_order Ключ отмененного заказа + * @property int $successful_order Ключ успешного завершения заказа * @property string $status_id артикул * @property string $status Статус * @property string $status_instruction Инструкция к статусу @@ -62,7 +64,9 @@ class MarketplaceOrder1cStatuses extends \yii\db\ActiveRecord 'allowed_closing', 'order_status_id', 'order_substatus_id', - 'allowed_editing' + 'allowed_editing', + 'successful_order', + 'cancelled_order' ], 'integer'], [['status_instruction', 'status_id'], 'string'], [['status_id', 'status'], 'string', 'max' => 100], @@ -85,7 +89,9 @@ class MarketplaceOrder1cStatuses extends \yii\db\ActiveRecord 'posit' => 'Порядок статусов', 'order_status_id' => 'Ссылка на статус заказа в МП', 'order_substatus_id' => 'Ссылка на субстатус заказа в МП', - 'allowed_editing' => 'Разрешено редактирование' + 'allowed_editing' => 'Разрешено редактирование', + 'successful_order' => 'Ключ успешного завершения заказа', + 'cancelled_order' => 'Ключ отмененного заказа' ]; } diff --git a/erp24/views/crud/marketplace-order1c-statuses/_form.php b/erp24/views/crud/marketplace-order1c-statuses/_form.php index 0ef41817..8124795d 100644 --- a/erp24/views/crud/marketplace-order1c-statuses/_form.php +++ b/erp24/views/crud/marketplace-order1c-statuses/_form.php @@ -74,6 +74,22 @@ $this->registerJsFile( 'id' => 'marketplace-order1cstatuses-allowed_editing', ] ) ?> + field($model, 'successful_order') + ->dropDownList( + [0 => 'Нет', 1 => 'Да'], + [ + 'prompt' => 'Выберите завершен ли заказ успешно', + 'id' => 'marketplace-order1cstatuses-successful_order', + ] + ) ?> + field($model, 'cancelled_order') + ->dropDownList( + [0 => 'Нет', 1 => 'Да'], + [ + 'prompt' => 'Выберите завершен ли заказ отменой', + 'id' => 'marketplace-order1cstatuses-cancelled_order', + ] + ) ?> field($model, 'order_status_id') ->dropDownList( $orderStatusTypes, diff --git a/erp24/views/crud/marketplace-order1c-statuses/index.php b/erp24/views/crud/marketplace-order1c-statuses/index.php index 29ca2e85..723360f6 100644 --- a/erp24/views/crud/marketplace-order1c-statuses/index.php +++ b/erp24/views/crud/marketplace-order1c-statuses/index.php @@ -55,10 +55,14 @@ $this->params['breadcrumbs'][] = $this->title; $reserve = $model->allowed_reserve === 0 ? 'Нет' : 'Да'; $closing = $model->allowed_closing === 0 ? 'Нет' : 'Да'; $editing = $model->allowed_editing === 0 ? 'Нет' : 'Да'; + $success = $model->successful_order === 0 ? 'Нет' : 'Да'; + $cancel = $model->cancelled_order === 0 ? 'Нет' : 'Да'; $html = '
'; $html .= '
' . '
Резервирование:
' . $reserve . '
'; $html .= '
' . '
Закрытие:
' . $closing . '
'; $html .= '
' . '
Редактирование:
' . $editing . '
'; + $html .= '
' . '
Успех:
' . $success . '
'; + $html .= '
' . '
Отказ:
' . $cancel . '
'; $html .= '
'; return $html; } diff --git a/erp24/views/crud/marketplace-order1c-statuses/view.php b/erp24/views/crud/marketplace-order1c-statuses/view.php index 9910c926..8eeac76f 100644 --- a/erp24/views/crud/marketplace-order1c-statuses/view.php +++ b/erp24/views/crud/marketplace-order1c-statuses/view.php @@ -61,6 +61,18 @@ $this->params['breadcrumbs'][] = $this->title; return $model->allowed_editing === 0 ? 'Нет' : 'Да'; } ], + [ + 'attribute' => 'successful_order', + 'value' => function ($model) { + return $model->successful_order === 0 ? 'Нет' : 'Да'; + } + ], + [ + 'attribute' => 'cancelled_order', + 'value' => function ($model) { + return $model->cancelled_order === 0 ? 'Нет' : 'Да'; + } + ], [ 'attribute' => 'order_status_id', 'value' => function ($model) { -- 2.39.5