1
0
mirror of synced 2024-11-22 05:16:09 +03:00

Исправлена подписка модуля на событие сохранения заказа (#371)

This commit is contained in:
Kocmonavtik 2024-11-05 09:24:39 +03:00 committed by GitHub
parent d25c7fc484
commit b68779a054
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 36 additions and 18 deletions

View File

@ -1,3 +1,6 @@
## 2024-10-30 v6.5.37
- Исправлена подписка модуля на событие сохранения заказа
## 2024-10-24 v6.5.36 ## 2024-10-24 v6.5.36
- Добавлена передача профилей доставки Официального модуля Почты России - Добавлена передача профилей доставки Официального модуля Почты России

View File

@ -1 +1 @@
- Добавлена передача профилей доставки Официального модуля Почты России - Исправлена подписка модуля на событие сохранения заказа

View File

@ -26,6 +26,7 @@ use Intaro\RetailCrm\Component\Advanced\LoyaltyInstaller;
Loader::IncludeModule('highloadblock'); Loader::IncludeModule('highloadblock');
IncludeModuleLangFile(__FILE__); IncludeModuleLangFile(__FILE__);
if (class_exists('intaro_retailcrm')) { if (class_exists('intaro_retailcrm')) {
return false; return false;
} }
@ -51,10 +52,11 @@ class intaro_retailcrm extends CModule
public function __construct() public function __construct()
{ {
$arModuleVersion = []; $arModuleVersion = [];
$path = str_replace("\\", '/', __FILE__); $path = str_replace("\\", '/', __FILE__);
$path = substr($path, 0, strlen($path) - strlen('/index.php')); $path = substr($path, 0, strlen($path) - strlen('/index.php'));
$this->INSTALL_PATH = $path; $this->INSTALL_PATH = $path;
include($path . '/version.php'); include($path . '/version.php');
$this->MODULE_VERSION = $arModuleVersion['VERSION']; $this->MODULE_VERSION = $arModuleVersion['VERSION'];
$this->MODULE_VERSION_DATE = $arModuleVersion['VERSION_DATE']; $this->MODULE_VERSION_DATE = $arModuleVersion['VERSION_DATE'];

View File

@ -1,6 +1,6 @@
<?php <?php
$arModuleVersion = [ $arModuleVersion = [
'VERSION' => '6.5.36', 'VERSION' => '6.5.37',
'VERSION_DATE' => '2024-10-24 15:00:00' 'VERSION_DATE' => '2024-10-30 14:00:00'
]; ];

View File

@ -161,6 +161,7 @@ class LoyaltyInstaller
'EDIT_FORM_LABEL' => ['ru' => $filed['title']], 'EDIT_FORM_LABEL' => ['ru' => $filed['title']],
]; ];
$props = array_merge($arProps, $customProps); $props = array_merge($arProps, $customProps);
$obUserField = new CUserTypeEntity(); $obUserField = new CUserTypeEntity();
$dbRes = CUserTypeEntity::GetList([], ['FIELD_NAME' => $filed['name']])->fetch(); $dbRes = CUserTypeEntity::GetList([], ['FIELD_NAME' => $filed['name']])->fetch();

View File

@ -18,7 +18,7 @@ namespace Intaro\RetailCrm\Component;
*/ */
class Constants class Constants
{ {
public const MODULE_VERSION = '6.5.36'; public const MODULE_VERSION = '6.5.37';
public const CRM_PURCHASE_PRICE_NULL = 'purchasePrice_null'; public const CRM_PURCHASE_PRICE_NULL = 'purchasePrice_null';
public const BITRIX_USER_ID_PREFIX = 'bitrixUserId-'; public const BITRIX_USER_ID_PREFIX = 'bitrixUserId-';
public const CRM_USERS_MAP = 'crm_users_map'; public const CRM_USERS_MAP = 'crm_users_map';

View File

@ -83,7 +83,8 @@ class EventsHandlers
$isWriteOffAvailable = $bonusInput > 0 $isWriteOffAvailable = $bonusInput > 0
&& $availableBonuses > 0 && $availableBonuses > 0
&& $jsDataTotal['ORDER_TOTAL_PRICE'] >= $bonusDiscount + $loyaltyDiscountInput; && $jsDataTotal['ORDER_TOTAL_PRICE'] >= $bonusDiscount + $loyaltyDiscountInput
;
if ($isWriteOffAvailable || $loyaltyDiscountInput > 0) { if ($isWriteOffAvailable || $loyaltyDiscountInput > 0) {
$jsDataTotal['ORDER_TOTAL_PRICE'] $jsDataTotal['ORDER_TOTAL_PRICE']

View File

@ -604,17 +604,22 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
} }
} catch (Exception $exception) { } catch (Exception $exception) {
RCrmActions::eventLog( RCrmActions::eventLog(
'intaro.retailcrm/options.php', 'OrderLoyaltyDataService::createLoyaltyHlBlock', 'intaro.retailcrm/options.php', 'Options_Loyalty_toggle::enable',
$e->getCode() . ': ' . $exception->getMessage() $e->getCode() . ': ' . $exception->getMessage()
); );
} }
ConfigProvider::setLoyaltyProgramStatus('Y'); ConfigProvider::setLoyaltyProgramStatus('Y');
} else { } else {
ConfigProvider::setLoyaltyProgramStatus('N'); try {
$loyaltyEventClass = 'Intaro\RetailCrm\Component\Handlers\EventsHandlers'; ConfigProvider::setLoyaltyProgramStatus('N');
UnRegisterModuleDependences('sale', 'OnSaleOrderSaved', 'intaro.retailcrm', $loyaltyEventClass, 'OnSaleOrderSavedHandler'); $loyaltySetup->deleteLPEvents();
UnRegisterModuleDependences('sale', 'OnSaleComponentOrderResultPrepared', 'intaro.retailcrm', $loyaltyEventClass, 'OnSaleComponentOrderResultPreparedHandler'); } catch (Exception $exception) {
RCrmActions::eventLog(
'intaro.retailcrm/options.php', 'Options_Loyalty_toggle::disable',
$e->getCode() . ': ' . $exception->getMessage()
);
}
} }
try { try {

View File

@ -401,7 +401,8 @@ class LoyaltyProgramUpdater
['to_method', '=', $event['EVENT_NAME'] . 'Handler'], ['to_method', '=', $event['EVENT_NAME'] . 'Handler'],
['to_class', '=', 'Intaro\RetailCrm\Component\Handlers\EventsHandlers'], ['to_class', '=', 'Intaro\RetailCrm\Component\Handlers\EventsHandlers'],
]) ])
->fetchCollection(); ->fetchCollection()
;
if (null === $events || 0 === count($events)) { if (null === $events || 0 === count($events)) {
$eventManager->registerEventHandler( $eventManager->registerEventHandler(
@ -613,6 +614,7 @@ class LoyaltyProgramUpdater
'NAME' => 'LoyaltyProgramRetailCRM', 'NAME' => 'LoyaltyProgramRetailCRM',
'TABLE_NAME' => 'loyalty_program' 'TABLE_NAME' => 'loyalty_program'
]); ]);
$arLangs = [ $arLangs = [
'ru' => 'Программа лояльности', 'ru' => 'Программа лояльности',
'en' => 'Loyalty Program' 'en' => 'Loyalty Program'
@ -661,7 +663,8 @@ class LoyaltyProgramUpdater
$persons = PersonTypeTable::query() $persons = PersonTypeTable::query()
->setSelect(['ID']) ->setSelect(['ID'])
->where([]) ->where([])
->fetchCollection(); ->fetchCollection()
;
foreach ($persons as $person) { foreach ($persons as $person) {
$personId = $person->getID(); $personId = $person->getID();
@ -691,7 +694,8 @@ class LoyaltyProgramUpdater
['NAME', '=', $lpOrderGroupName], ['NAME', '=', $lpOrderGroupName],
] ]
) )
->fetch(); ->fetch()
;
if (is_array($lpGroup)) { if (is_array($lpGroup)) {
return $lpGroup['ID']; return $lpGroup['ID'];
@ -728,7 +732,8 @@ class LoyaltyProgramUpdater
['PERSON_TYPE_ID', '=', $personId], ['PERSON_TYPE_ID', '=', $personId],
['PROPS_GROUP_ID', '=', $groupId], ['PROPS_GROUP_ID', '=', $groupId],
]) ])
->fetchObject(); ->fetchObject()
;
if ($bonusProp === null) { if ($bonusProp === null) {
$lang = Context::getCurrent()->getLanguage(); $lang = Context::getCurrent()->getLanguage();
@ -869,7 +874,8 @@ class LoyaltyProgramUpdater
->where([ ->where([
['CODE', '=', 'AGREEMENT_PERSONAL_DATA_CODE'] ['CODE', '=', 'AGREEMENT_PERSONAL_DATA_CODE']
]) ])
->fetch(); ->fetch()
;
if (!isset($isAgreementPersonalProgram['ID'])) { if (!isset($isAgreementPersonalProgram['ID'])) {
/** @var EntityObject|null $agreementPersonalData */ /** @var EntityObject|null $agreementPersonalData */