From: Vladimir Fomichev Date: Tue, 5 Aug 2025 13:55:13 +0000 (+0300) Subject: Получение статусов X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=51ec27b8fe5f443ec8e675f683e5140d167f6ecd;p=erp24_rep%2Fyii-erp24%2F.git Получение статусов --- 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; + } }