From 18a2faa5bdf1d0b12e1ce7ba6a977bf0c7eb286c Mon Sep 17 00:00:00 2001 From: marina Date: Mon, 23 Jun 2025 14:25:39 +0300 Subject: [PATCH] =?utf8?q?ERP-427=20=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?utf8?q?=D1=82=D0=BA=D0=B0=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD=D1=82?= =?utf8?q?=D0=B0=D1=80=D0=B8=D1=8F=20=D0=BF=D1=80=D0=B8=20=D0=BE=D1=82?= =?utf8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B5=20=D0=B7=D0=B0=D0=BA=D0=B0?= =?utf8?q?=D0=B7=D0=B0=20=D0=B8=D0=B7=20=D0=BC=D0=B0=D1=80=D0=BA=D0=B5?= =?utf8?q?=D1=82=D0=BF=D0=BB=D0=B5=D0=B9=D1=81=20=D1=81=201=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/api2/controllers/DataController.php | 10 +++++++++- erp24/records/MarketplaceOrders.php | 17 +++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/erp24/api2/controllers/DataController.php b/erp24/api2/controllers/DataController.php index 4c57788f..1bd1eada 100644 --- a/erp24/api2/controllers/DataController.php +++ b/erp24/api2/controllers/DataController.php @@ -760,7 +760,11 @@ class DataController extends BaseController 'payment_method' => $marketplaceOrder->payment_method, 'cancel_requested' => $marketplaceOrder->cancel_requested, 'raw_data' => $marketplaceOrder->raw_data, - 'link' => $marketplaceOrder->order_link + 'link' => $marketplaceOrder->order_link, + 'comment' => json_encode([ + 'delivery' => $marketplaceOrder->raw_data['delivery'], + 'products_without_guid' => $marketplaceOrder->getProductsWithoutArticule(), + ]) ]; } return $result; @@ -837,6 +841,10 @@ class DataController extends BaseController 'delivery_type' => $delivery_type, 'items' => $itemsFiltered, 'photo_link' => $photoLink, + 'comment_data' => json_encode([ + 'delivery' => $marketplaceOrder->raw_data['delivery'], + 'products_without_guid' => $marketplaceOrder->getProductsWithoutArticule(), + ]) // 'marketplace_order_id' => $marketplaceOrder->marketplace_order_id, // 'status_id' => $marketplaceOrder->status_id, // 'substatus_id' => $marketplaceOrder->substatus_id, diff --git a/erp24/records/MarketplaceOrders.php b/erp24/records/MarketplaceOrders.php index f2b00fd4..799ec050 100644 --- a/erp24/records/MarketplaceOrders.php +++ b/erp24/records/MarketplaceOrders.php @@ -211,4 +211,21 @@ class MarketplaceOrders extends \yii\db\ActiveRecord return $photo; } + + public function getProductsWithoutArticule() + { + $products = $this->items; + $result = []; + + foreach ($products as $product) { + $isProductWithGuid = Products1c::findOne(['articule' => $product->offer_id]); + if (!$isProductWithGuid) { + $result[] = [ + 'product_id' => $product->offer_name ?? null, + 'quantity' => $product->count ?? null, + ]; + } + } + return $result; + } } -- 2.39.5