From 656c076195dcecfdaa575ac0c5e011c8e83e6dc0 Mon Sep 17 00:00:00 2001 From: Smiley48 <43863676+Smiley48@users.noreply.github.com> Date: Mon, 23 Jan 2023 14:27:15 +0300 Subject: [PATCH] =?UTF-8?q?=D0=91=D0=BB=D0=BE=D0=BA=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B0=20=D1=80=D0=B5=D0=B7=D0=B5=D1=80=D0=B2=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B2=20=D0=BE?= =?UTF-8?q?=D1=82=D0=B3=D1=80=D1=83=D0=B6=D0=B5=D0=BD=D0=BD=D0=BE=D0=BC=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=BA=D0=B0=D0=B7=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 ++ .../general/history/RetailCrmHistory_v5.php | 2 +- intaro.retailcrm/install/version.php | 4 +- .../history/RetailCrmHistory_v5Test.php | 38 +++++++++++++++++++ 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 569e232d..8e88a31b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2023-01-20 v.6.1.14 +- Исправление ошибки изменения отгрузки при её завершении + ## 2023-01-10 v.6.1.13 - Изменение метода обновления полей программы лояльности в административной панели diff --git a/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php b/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php index 5ff4aabe..5563f16f 100644 --- a/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php +++ b/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php @@ -1734,7 +1734,7 @@ class RetailCrmHistory $basket = $order->getBasket(); foreach ($shipmentCollection as $shipment) { - if (!$shipment->isSystem()) { + if (!$shipment->isSystem() && !$shipment->isShipped()) { $reserved = false; if ($shipment->needReservation()) { diff --git a/intaro.retailcrm/install/version.php b/intaro.retailcrm/install/version.php index 099de893..8defcce6 100644 --- a/intaro.retailcrm/install/version.php +++ b/intaro.retailcrm/install/version.php @@ -1,6 +1,6 @@ '6.1.13', - 'VERSION_DATE' => '2023-01-10 17:00:00' + 'VERSION' => '6.1.14', + 'VERSION_DATE' => '2023-01-20 17:00:00' ]; diff --git a/tests/classes/general/history/RetailCrmHistory_v5Test.php b/tests/classes/general/history/RetailCrmHistory_v5Test.php index a27e6063..d97e785c 100644 --- a/tests/classes/general/history/RetailCrmHistory_v5Test.php +++ b/tests/classes/general/history/RetailCrmHistory_v5Test.php @@ -1,5 +1,6 @@ createMock(\Bitrix\Sale\ShipmentCollection::class); + $shipmentCollection->method('resetCollection') + ->willReturn(true); + $shipmentCollection->method('tryUnreserve') + ->willReturn(true); + $shipmentCollection->method('tryReserve') + ->willReturn(true); + + $shipment = $this->createMock(\Bitrix\Sale\Shipment::class); + $shipment->method('getShipmentItemCollection') + ->willReturn($shipmentCollection); + $shipment->method('needReservation') + ->willReturn(true); + $shipment->method('isShipped') + ->willReturn(true); + $shipment->method('isSystem') + ->willReturn(false); + + $shipmentCollection->method('getIterator') + ->willReturn(new \ArrayObject([$shipment])); + + $order = $this->createMock(\Bitrix\Sale\Order::class); + $order->method('getShipmentCollection') + ->willReturn($shipmentCollection); + $order->method('getBasket') + ->willReturn(true); + + $this->assertEquals(null, RetailCrmHistory::shipmentItemReset($order)); + + $shipment->method('isShipped') + ->willReturn(false); + + $this->assertEquals(null, RetailCrmHistory::shipmentItemReset($order)); + } + private function getCustomers(): array { return [