From: Vladimir Fomichev Date: Mon, 13 Oct 2025 09:24:06 +0000 (+0300) Subject: Фильтруем только заказы с заполненным status_processing_1C X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=05e9490686e430037fd36530a2fd2c6c978fe272;p=erp24_rep%2Fyii-erp24%2F.git Фильтруем только заказы с заполненным status_processing_1C --- diff --git a/erp24/api2/controllers/OrdersController.php b/erp24/api2/controllers/OrdersController.php index ddd97971..355673b3 100644 --- a/erp24/api2/controllers/OrdersController.php +++ b/erp24/api2/controllers/OrdersController.php @@ -244,7 +244,7 @@ class OrdersController extends BaseController ->with('items') ->with('status1C') ->where(['store_id' => $storeId]) - ->andWhere(['status_1c' => MarketplaceOrders::STATUSES_1C_CREATED_IN_1C]) + ->andWhere(['IS NOT', 'status_processing_1c', null]) ->andWhere(['>=', 'creation_date', $startTime->format('Y-m-d H:i:s')]) ->andWhere(['<=', 'creation_date', $currentTime->format('Y-m-d H:i:s')]) ->orderBy(['id' => SORT_DESC]) diff --git a/erp24/controllers/MarketplaceOrdersController.php b/erp24/controllers/MarketplaceOrdersController.php index 3bbf07f8..10ca79ad 100644 --- a/erp24/controllers/MarketplaceOrdersController.php +++ b/erp24/controllers/MarketplaceOrdersController.php @@ -908,7 +908,15 @@ class MarketplaceOrdersController extends Controller */ protected function findModel($id) { - if (($model = MarketplaceOrders::findOne(['id' => $id])) !== null) { + $model = MarketplaceOrders::find() + ->with([ + 'status1C', + 'items', + ]) + ->where(['id' => $id]) + ->one(); + + if ($model !== null) { return $model; } diff --git a/erp24/records/MarketplaceOrdersSearch.php b/erp24/records/MarketplaceOrdersSearch.php index 1bd1a2a8..6b407460 100644 --- a/erp24/records/MarketplaceOrdersSearch.php +++ b/erp24/records/MarketplaceOrdersSearch.php @@ -60,6 +60,7 @@ class MarketplaceOrdersSearch extends MarketplaceOrders public function search($params, $formName = null) { $query = MarketplaceOrders::find() + ->with('status1C') ->joinWith(['store', 'status statusAlias', 'substatus substatusAlias']); $dataProvider = new ActiveDataProvider([ diff --git a/erp24/views/marketplace-orders/index.php b/erp24/views/marketplace-orders/index.php index 5eaf7bf9..22c02cae 100644 --- a/erp24/views/marketplace-orders/index.php +++ b/erp24/views/marketplace-orders/index.php @@ -175,7 +175,7 @@ YiiAsset::register($this); [ 'attribute' => 'status_processing_1c', 'value' => function ($model) { - return $model->status1c->status ?? null; + return $model->status1C->status ?? null; } ], [ diff --git a/erp24/views/marketplace-orders/view.php b/erp24/views/marketplace-orders/view.php index be021aea..f2458eac 100644 --- a/erp24/views/marketplace-orders/view.php +++ b/erp24/views/marketplace-orders/view.php @@ -141,9 +141,8 @@ $this->params['breadcrumbs'][] = $this->title; ], [ 'attribute' => 'status_processing_1c', - 'value' => function ($model) { - return $model->status1c->status ?? null; - } + 'value' => $model->status1C->status ?? null + ], [ 'attribute' => 'cancelled_order_sent',