From 51ec27b8fe5f443ec8e675f683e5140d167f6ecd Mon Sep 17 00:00:00 2001 From: Vladimir Fomichev Date: Tue, 5 Aug 2025 16:55:13 +0300 Subject: [PATCH] =?utf8?q?=D0=9F=D0=BE=D0=BB=D1=83=D1=87=D0=B5=D0=BD=D0=B8?= =?utf8?q?=D0=B5=20=D1=81=D1=82=D0=B0=D1=82=D1=83=D1=81=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/records/MarketplaceOrders.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/erp24/records/MarketplaceOrders.php b/erp24/records/MarketplaceOrders.php index 5452066b..e371b003 100644 --- a/erp24/records/MarketplaceOrders.php +++ b/erp24/records/MarketplaceOrders.php @@ -5,6 +5,7 @@ namespace yii_app\records; use Yii; use yii\behaviors\TimestampBehavior; use yii\db\Expression; +use yii\helpers\ArrayHelper; /** * This is the model class for table "marketplace_orders". @@ -233,11 +234,19 @@ class MarketplaceOrders extends \yii\db\ActiveRecord public static function buildStatusesToCode(): array { - return - array_fill_keys(['1000', '1001', '1002', '1007', '1008', '1009'], ['PROCESSING', 'STARTED']) + - array_fill_keys(['1003', '1010'], ['PROCESSING', 'READY_TO_SHIP']) + - array_fill_keys(['1004', '1011'], ['DELIVERY', 'COURIER_RECEIVED']) + - array_fill_keys(['1005', '1012'], ['DELIVERED', 'DELIVERY_SERVICE_DELIVERED']) + - array_fill_keys(['1006', '1013'], ['CANCELLED', 'SHOP_FAILED']); + $statuses = MarketplaceOrder1cStatuses::find() + ->select(['status_id', 'order_status_id', 'order_substatus_id']) + ->with(['orderStatus', 'orderSubstatus']) + ->all(); + + $result = []; + foreach ($statuses as $item) { + $result[$item->status_id] = [ + $item->orderStatus->code ?? null, + $item->orderSubstatus->code ?? null + ]; + } + return $result; + } } -- 2.39.5