From 74833ed2db6c6a19eb6a3fc0f8d6c69d828d6ec1 Mon Sep 17 00:00:00 2001 From: ellynoize <111681973+ellynoize@users.noreply.github.com> Date: Mon, 23 Sep 2024 09:46:10 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=BD=D0=BE=D1=81=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=B4=D0=BF=D0=B8=D1=81=D0=BA=D0=B8=20=D0=BD=D0=B0?= =?UTF-8?q?=20=D1=81=D0=BE=D0=B1=D1=8B=D1=82=D0=B8=D0=B5=20=D1=81=D0=BE?= =?UTF-8?q?=D1=85=D1=80=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B7=D0=B0=D0=BA=D0=B0?= =?UTF-8?q?=D0=B7=D0=B0=20=D0=B2=20=D1=83=D1=81=D1=82=D0=B0=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D1=83=20=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D1=8F=20(#3?= =?UTF-8?q?62)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 +++ intaro.retailcrm/description.ru | 2 +- intaro.retailcrm/install/index.php | 10 ++------ intaro.retailcrm/install/version.php | 4 ++-- .../lib/component/handlers/eventshandlers.php | 4 ---- .../component/handlers/EventsHandlersTest.php | 24 +------------------ 6 files changed, 9 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74738b1f..46311689 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2024-09-19 v6.5.29 +- Исправлена подписка модуля на событие сохранения заказа + ## 2024-09-11 v6.5.28 - Исправлен возврат на предыдущий статус в заказе Bitrix diff --git a/intaro.retailcrm/description.ru b/intaro.retailcrm/description.ru index 67732cb1..583cbb21 100644 --- a/intaro.retailcrm/description.ru +++ b/intaro.retailcrm/description.ru @@ -1 +1 @@ -- Исправлен возврат на предыдущий статус в заказе Bitrix +- Исправлена подписка модуля на событие сохранения заказа при установке diff --git a/intaro.retailcrm/install/index.php b/intaro.retailcrm/install/index.php index dc229fd1..12a4c52d 100644 --- a/intaro.retailcrm/install/index.php +++ b/intaro.retailcrm/install/index.php @@ -1090,7 +1090,7 @@ class intaro_retailcrm extends CModule RegisterModuleDependences('sale', 'OnSalePaymentEntityDeleted', $this->MODULE_ID, 'RetailCrmEvent', 'paymentDelete'); RegisterModuleDependences('main', 'OnAfterUserRegister', $this->MODULE_ID, 'RetailCrmEvent', 'OnAfterUserRegister'); RegisterModuleDependences('main', 'OnAfterUserAdd', $this->MODULE_ID, 'RetailCrmEvent', 'OnAfterUserAdd'); - + RegisterModuleDependences('sale', 'OnSaleOrderSaved', $this->MODULE_ID, 'RetailCrmEvent', 'orderSave', 99); COption::SetOptionString($this->MODULE_ID, Constants::CRM_CATALOG_BASE_PRICE, htmlspecialchars(trim($_POST['price-types']))); COption::SetOptionString($this->MODULE_ID, Constants::CRM_INVENTORIES_UPLOAD, 'N'); @@ -1272,13 +1272,7 @@ class intaro_retailcrm extends CModule COption::RemoveOption($this->MODULE_ID, Constants::USE_CRM_ORDER_METHODS); if (CModule::IncludeModule('sale')) { - UnRegisterModuleDependences( - 'sale', - EventActions::EVENT_ON_ORDER_SAVED, - $this->MODULE_ID, - 'RetailCrmEvent', - 'orderSave' - ); + UnRegisterModuleDependences('sale', 'OnSaleOrderSaved', $this->MODULE_ID, 'RetailCrmEvent', 'orderSave'); } UnRegisterModuleDependences('sale', 'OnOrderUpdate', $this->MODULE_ID, 'RetailCrmEvent', 'onUpdateOrder'); diff --git a/intaro.retailcrm/install/version.php b/intaro.retailcrm/install/version.php index c75e52dc..7ad9654f 100644 --- a/intaro.retailcrm/install/version.php +++ b/intaro.retailcrm/install/version.php @@ -1,6 +1,6 @@ '6.5.28', - 'VERSION_DATE' => '2024-09-11 13:00:00' + 'VERSION' => '6.5.29', + 'VERSION_DATE' => '2024-09-19 15:00:00' ]; diff --git a/intaro.retailcrm/lib/component/handlers/eventshandlers.php b/intaro.retailcrm/lib/component/handlers/eventshandlers.php index f56b1741..f084b75f 100644 --- a/intaro.retailcrm/lib/component/handlers/eventshandlers.php +++ b/intaro.retailcrm/lib/component/handlers/eventshandlers.php @@ -133,10 +133,6 @@ class EventsHandlers /** @var Order $order */ $order = $event->getParameter('ENTITY'); - // TODO: Replace old call with a new one. - $saveResult = RetailCrmEvent::orderSave($order); - Utils::handleApiErrors($saveResult); - $isBonusInput = ( !empty($_POST['bonus-input']) && !empty($_POST['available-bonuses']) diff --git a/tests/lib/component/handlers/EventsHandlersTest.php b/tests/lib/component/handlers/EventsHandlersTest.php index fd975bf8..c5316d30 100644 --- a/tests/lib/component/handlers/EventsHandlersTest.php +++ b/tests/lib/component/handlers/EventsHandlersTest.php @@ -13,28 +13,6 @@ class EventsHandlersTest extends \BitrixTestCase CModule::IncludeModule('intaro.retailcrm'); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ - public function testOnSaleOrderSavedHandler() - { - $order = \Bitrix\Sale\Order::create('s1', 2, 'RUB'); - $order->setPersonTypeId(2); - - $event = $this->createMock(\Bitrix\Main\Event::class); - $event->method('getParameter')->willReturn($order); - - $spy = \Mockery::spy('overload:' .RetailCrmEvent::class); - - EventsHandlers::OnSaleOrderSavedHandler($event); - - //Проверяет, был ли вызван метод класса. Если метод не вызывался, выдает ошибку теста - //Если метод вызывался, ошибку не выдает, но phpunit выдает сообщение об отсутствии тестов - $spy->shouldHaveReceived('orderSave'); - self::assertTrue(true); - } - /** * @runInSeparateProcess * @preserveGlobalState disabled @@ -56,4 +34,4 @@ class EventsHandlersTest extends \BitrixTestCase $spy->shouldNotHaveReceived('orderSave'); self::assertTrue(true); } -} \ No newline at end of file +}