--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+class m250717_142552_add_cancelled_order_sent_field_to_marketplace_orders_table extends Migration
+{
+ const TABLE_NAME = 'erp24.marketplace_orders';
+ /**
+ * {@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('cancelled_order_sent')) {
+ $this->addColumn(
+ self::TABLE_NAME,
+ 'cancelled_order_sent',
+ $this->integer()->defaultValue(0)->comment('Флаг отправки отмененного заказа в 1С')
+ );
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeDown()
+ {
+ if ($this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('cancelled_order_sent')) {
+ $this->dropColumn(self::TABLE_NAME, 'cancelled_order_sent');
+ }
+ }
+ /*
+ // Use up()/down() to run migration code without a transaction.
+ public function up()
+ {
+
+ }
+
+ public function down()
+ {
+ echo "m250717_142552_add_cancelled_order_sent_field_to_marketplace_orders_table cannot be reverted.\n";
+
+ return false;
+ }
+ */
+}
* @property string|null $manager_link Ссылка на панели менеджера заказов
* @property string|null $sent_1c_at Время отправки заказа в 1С
* @property int|null $attempts_number Количество попыток отправки заказа в 1С
+ * @property int $cancelled_order_sent Флаг отправки отмененного заказа в 1С
*/
class MarketplaceOrders extends \yii\db\ActiveRecord
{
const STATUSES_1C_CREATED_IN_ERP = 1;
const STATUSES_1C_SENDED_TO_1C = 2;
const STATUSES_1C_CREATED_IN_1C = 3;
+ const STATUSES_1C_CANCELLED_ORDER_SENT_IN_1C = 1;
+ const STATUSES_1C_CANCELLED_ORDER_NOT_SENT_IN_1C = 0;
const STATUSES_1C = [
self::STATUSES_1C_CREATED_IN_ERP => 'Создан в ЕРП',
[['marketplace_order_id', 'marketplace_id', 'marketplace_name', 'status_id', 'substatus_id', 'creation_date', 'updated_at', 'total', 'delivery_total', 'buyer_total_before_discount', 'tax_system', 'payment_type', 'payment_method'], 'required'],
[['store_id', 'status_id', 'substatus_id', 'fake', 'cancel_requested', 'status_1c', 'status_processing_1c', 'order_link', 'delivery_to', 'order_photo'], 'default', 'value' => null],
[[ 'fake'], 'default', 'value' => 0],
- [['store_id', 'status_id', 'substatus_id', 'fake', 'cancel_requested', 'status_1c', 'marketplace_id', 'status_telegram', 'status_processing_1c', 'readyto_1c', 'attempts_number'], 'integer'],
+ [['store_id', 'status_id', 'substatus_id', 'fake', 'cancel_requested', 'status_1c', 'marketplace_id', 'status_telegram', 'status_processing_1c', 'readyto_1c', 'attempts_number', 'cancelled_order_sent'], 'integer'],
[['creation_date', 'updated_at', 'returned_at', 'sent_1c_at'], 'safe'],
[['return_data', 'raw_data', 'marketplace_name', 'telegram_error', 'order_link', 'delivery_to', 'order_photo', 'manager_link'], 'string'],
[['total', 'delivery_total', 'buyer_total_before_discount'], 'number'],
'check_guid' => 'GUID чека заказа МП',
'sent_1c_at' => 'Время отправки заказа в 1С',
'attempts_number' => 'Количество попыток отправки заказа в 1С',
+ 'cancelled_order_sent' => 'Флаг отправки отмененного заказа в 1С',
];
}