1
0
mirror of synced 2024-11-21 21:06: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
- Добавлена передача профилей доставки Официального модуля Почты России

View File

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

View File

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

View File

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

View File

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

View File

@ -18,7 +18,7 @@ namespace Intaro\RetailCrm\Component;
*/
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 BITRIX_USER_ID_PREFIX = 'bitrixUserId-';
public const CRM_USERS_MAP = 'crm_users_map';

View File

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

View File

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

View File

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