Исправлена подписка модуля на событие сохранения заказа (#371)
This commit is contained in:
parent
d25c7fc484
commit
b68779a054
@ -1,3 +1,6 @@
|
|||||||
|
## 2024-10-30 v6.5.37
|
||||||
|
- Исправлена подписка модуля на событие сохранения заказа
|
||||||
|
|
||||||
## 2024-10-24 v6.5.36
|
## 2024-10-24 v6.5.36
|
||||||
- Добавлена передача профилей доставки Официального модуля Почты России
|
- Добавлена передача профилей доставки Официального модуля Почты России
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
- Добавлена передача профилей доставки Официального модуля Почты России
|
- Исправлена подписка модуля на событие сохранения заказа
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
@ -55,6 +56,7 @@ class intaro_retailcrm extends CModule
|
|||||||
$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'];
|
||||||
|
@ -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'
|
||||||
];
|
];
|
||||||
|
@ -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();
|
||||||
|
@ -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';
|
||||||
|
@ -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']
|
||||||
|
@ -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 {
|
||||||
|
try {
|
||||||
ConfigProvider::setLoyaltyProgramStatus('N');
|
ConfigProvider::setLoyaltyProgramStatus('N');
|
||||||
$loyaltyEventClass = 'Intaro\RetailCrm\Component\Handlers\EventsHandlers';
|
$loyaltySetup->deleteLPEvents();
|
||||||
UnRegisterModuleDependences('sale', 'OnSaleOrderSaved', 'intaro.retailcrm', $loyaltyEventClass, 'OnSaleOrderSavedHandler');
|
} catch (Exception $exception) {
|
||||||
UnRegisterModuleDependences('sale', 'OnSaleComponentOrderResultPrepared', 'intaro.retailcrm', $loyaltyEventClass, 'OnSaleComponentOrderResultPreparedHandler');
|
RCrmActions::eventLog(
|
||||||
|
'intaro.retailcrm/options.php', 'Options_Loyalty_toggle::disable',
|
||||||
|
$e->getCode() . ': ' . $exception->getMessage()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -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 */
|
||||||
|
Loading…
Reference in New Issue
Block a user