]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Передача ключей на успех и отмену feature_fomichev_erp-442_add_allowed_editing_field_marketplace_order_1c_statuses
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Thu, 17 Jul 2025 14:01:05 +0000 (17:01 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Thu, 17 Jul 2025 14:01:05 +0000 (17:01 +0300)
erp24/commands/CronController.php
erp24/migrations/m250717_134217_add_successfull_order_cancelled_order_fields_to_marketplace_orders_1c_statuses_table.php [new file with mode: 0644]
erp24/records/MarketplaceOrder1cStatuses.php
erp24/views/crud/marketplace-order1c-statuses/_form.php
erp24/views/crud/marketplace-order1c-statuses/index.php
erp24/views/crud/marketplace-order1c-statuses/view.php

index c56c34de2b3af38e29c89b7650cfdb9643e14ae8..4fb58019fa5f670c4b52989b47dde6f7c3d385b1 100644 (file)
@@ -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 (file)
index 0000000..e714b21
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+
+use yii\db\Migration;
+
+class m250717_134217_add_successfull_order_cancelled_order_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('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;
+    }
+    */
+}
index 436e108a28e36f5d40edefe3ca25553de0931809..b013fe5d77beb73f4bd9dd3cce4f837428f6ba63 100644 (file)
@@ -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' => 'Ключ отмененного заказа'
         ];
     }
 
index 0ef41817eeac903006cedf4efd2f692f461978bc..8124795d4c986c3186db37c4760c394fd9482f33 100644 (file)
@@ -74,6 +74,22 @@ $this->registerJsFile(
                 'id' => 'marketplace-order1cstatuses-allowed_editing',
             ]
         ) ?>
+    <?= $form->field($model, 'successful_order')
+        ->dropDownList(
+            [0 => 'Нет', 1 => 'Да'],
+            [
+                'prompt' => 'Выберите завершен ли заказ успешно',
+                'id' => 'marketplace-order1cstatuses-successful_order',
+            ]
+        ) ?>
+    <?= $form->field($model, 'cancelled_order')
+        ->dropDownList(
+            [0 => 'Нет', 1 => 'Да'],
+            [
+                'prompt' => 'Выберите завершен ли заказ отменой',
+                'id' => 'marketplace-order1cstatuses-cancelled_order',
+            ]
+        ) ?>
     <?= $form->field($model, 'order_status_id')
         ->dropDownList(
             $orderStatusTypes,
index 29ca2e85762aa62c5bbb0aeb83b978cbbe564ea5..723360f67b03a3591178b30bcf403287395c4931 100644 (file)
@@ -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 = '<div class="d-flex flex-column justify-content-between">';
                     $html .= '<div class="d-flex justify-content-between" >' . '<div>Резервирование:</div><strong > ' . $reserve . '</strong></div>';
                     $html .= '<div class="d-flex justify-content-between" >' . '<div>Закрытие:</div><strong > ' . $closing . '</strong></div>';
                     $html .= '<div class="d-flex justify-content-between" >' . '<div>Редактирование:</div><strong > ' . $editing . '</strong></div>';
+                    $html .= '<div class="d-flex justify-content-between" >' . '<div>Успех:</div><strong > ' . $success . '</strong></div>';
+                    $html .= '<div class="d-flex justify-content-between" >' . '<div>Отказ:</div><strong > ' . $cancel . '</strong></div>';
                     $html .= '</div>';
                     return $html;
                 }
index 9910c926af59f5d21c5b269c09aa7f38be69b61c..8eeac76ff3d71b87086f3ca0778f86586eba41bb 100644 (file)
@@ -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) {