From 85e3d5f1bdab8260305db7e171f996387e75f77b Mon Sep 17 00:00:00 2001 From: Arsen Mirzaev Tatyano-Muradovich Date: Sun, 25 Apr 2021 20:09:39 +1000 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mirzaev/skillparts/system/config/web.php.example | 2 +- mirzaev/skillparts/system/models/OrderEdgeSupply.php | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mirzaev/skillparts/system/config/web.php.example b/mirzaev/skillparts/system/config/web.php.example index 2fb375b..127b08e 100644 --- a/mirzaev/skillparts/system/config/web.php.example +++ b/mirzaev/skillparts/system/config/web.php.example @@ -77,7 +77,7 @@ $config = [ 'controller' => 'main' ], 'product/' => 'product/index', - 'product///' => 'product/-', + '///' => '
/-', 'orders' => 'order/index' ], ], diff --git a/mirzaev/skillparts/system/models/OrderEdgeSupply.php b/mirzaev/skillparts/system/models/OrderEdgeSupply.php index 0bd3b60..8521f56 100644 --- a/mirzaev/skillparts/system/models/OrderEdgeSupply.php +++ b/mirzaev/skillparts/system/models/OrderEdgeSupply.php @@ -45,15 +45,22 @@ class OrderEdgeSupply extends Edge * Поиск поставки по артикулу * * @param string $catn Артикул + * @param Order $order Заказ * @param int $limit Максимальное количество * * @return array Поставки */ - public static function searchBySupplyCatn(string $catn, int $limit = 10): array + public static function searchBySupplyCatn(string $catn, Order $order = null, int $limit = 10): array { if ($supply = Supply::searchByCatn($catn, 1)) { // Поставка найдена + if (isset($order)) { + // Поиск только по определённому заказу + + return self::find()->where(['_from' => $order->readId(), '_to' => $supply->readId()])->limit($limit)->all(); + } + return self::find()->where(['_to' => $supply->readId()])->limit($limit)->all(); }