Исправлена подписка на событие сохранения заказа (#368)
This commit is contained in:
parent
7e260a2d22
commit
534757e6c6
@ -1,3 +1,6 @@
|
||||
## 2024-10-22 v6.5.35
|
||||
- Исправлена подписка модуля на событие сохранения заказа
|
||||
|
||||
## 2024-10-21 v6.5.34
|
||||
- Исправлена ошибка агента выгрузки изменений при наличии у заказа клиента без магазина
|
||||
|
||||
|
@ -1 +1 @@
|
||||
- Исправлена ошибка агента выгрузки изменений при наличии у заказа клиента без магазина
|
||||
- Исправлена подписка модуля на событие сохранения заказа
|
||||
|
@ -1090,6 +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');
|
||||
|
@ -228,7 +228,7 @@ class LoyaltyInstaller
|
||||
$eventManager->unRegisterEventHandler(
|
||||
$event['FROM_MODULE'],
|
||||
$event['EVENT_NAME'],
|
||||
$this->MODULE_ID,
|
||||
Constants::MODULE_ID,
|
||||
EventsHandlers::class,
|
||||
$event['EVENT_NAME'].'Handler'
|
||||
);
|
||||
|
@ -18,7 +18,7 @@ namespace Intaro\RetailCrm\Component;
|
||||
*/
|
||||
class Constants
|
||||
{
|
||||
public const MODULE_VERSION = '6.5.34';
|
||||
public const MODULE_VERSION = '6.5.35';
|
||||
public const CRM_PURCHASE_PRICE_NULL = 'purchasePrice_null';
|
||||
public const BITRIX_USER_ID_PREFIX = 'bitrixUserId-';
|
||||
public const CRM_USERS_MAP = 'crm_users_map';
|
||||
|
@ -132,9 +132,6 @@ class EventsHandlers
|
||||
try {
|
||||
/** @var Order $order */
|
||||
$order = $event->getParameter('ENTITY');
|
||||
|
||||
$saveResult = RetailCrmEvent::orderSave($order);
|
||||
Utils::handleApiErrors($saveResult);
|
||||
|
||||
$isBonusInput = (
|
||||
!empty($_POST['bonus-input'])
|
||||
|
@ -612,6 +612,9 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
|
||||
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 {
|
||||
|
@ -5,6 +5,7 @@ use Bitrix\Main;
|
||||
use Bitrix\Main\Context;
|
||||
use Bitrix\Main\EventManager;
|
||||
use Bitrix\Main\Loader;
|
||||
use Bitrix\Main\Config\Option;
|
||||
use Bitrix\Main\Localization\Loc;
|
||||
use Bitrix\Main\ORM\Fields\DatetimeField;
|
||||
use Bitrix\Main\ORM\Fields\IntegerField;
|
||||
@ -60,7 +61,8 @@ class ToModuleTable extends Main\Entity\DataManager
|
||||
return [
|
||||
new IntegerField(
|
||||
'id',
|
||||
['primary' => true, 'autocomplete' => true]),
|
||||
['primary' => true, 'autocomplete' => true]
|
||||
),
|
||||
new DatetimeField('TIMESTAMP_X', ['required' => true]),
|
||||
new IntegerField('sort'),
|
||||
new StringField(
|
||||
@ -676,9 +678,9 @@ class LoyaltyProgramUpdater
|
||||
public function getGroupIdByPersonId($personId): ?int
|
||||
{
|
||||
$lpOrderGroupName = [
|
||||
'ru' => 'Программа лояльности',
|
||||
'en' => 'Loyalty Program'
|
||||
][Context::getCurrent()->getLanguage()] ?? 'Программа лояльности';
|
||||
'ru' => 'Программа лояльности',
|
||||
'en' => 'Loyalty Program'
|
||||
][Context::getCurrent()->getLanguage()] ?? 'Программа лояльности';
|
||||
|
||||
try {
|
||||
$lpGroup = OrderPropsGroupTable::query()
|
||||
@ -925,8 +927,7 @@ class LoyaltyProgramUpdater
|
||||
'DESCRIPTION' => $lpBonusInfo,
|
||||
];
|
||||
|
||||
while ($bonusProp = $bonusProps->Fetch())
|
||||
{
|
||||
while ($bonusProp = $bonusProps->Fetch()) {
|
||||
CSaleOrderProps::Update($bonusProp['ID'], $updateInfo);
|
||||
}
|
||||
|
||||
@ -1104,15 +1105,13 @@ class UpdateSubscribe
|
||||
foreach ($templateNames as $directory => $templates) {
|
||||
foreach ($templates as $template) {
|
||||
$templatePath = $_SERVER['DOCUMENT_ROOT']
|
||||
. '/local/templates/.default/components/bitrix/' . $template['name'] . '/' . $directory
|
||||
;
|
||||
. '/local/templates/.default/components/bitrix/' . $template['name'] . '/' . $directory;
|
||||
|
||||
if (!file_exists($templatePath)) {
|
||||
$pathFrom = $_SERVER['DOCUMENT_ROOT']
|
||||
. '/bitrix/modules/intaro.retailcrm/install/export/local/components/intaro/'
|
||||
. $template['name']
|
||||
. '/templates/' . $template['templateDirectory']
|
||||
;
|
||||
. '/templates/' . $template['templateDirectory'];
|
||||
|
||||
CopyDirFiles(
|
||||
$pathFrom,
|
||||
@ -1180,8 +1179,15 @@ function update()
|
||||
{
|
||||
Loader::includeModule('sale');
|
||||
Loader::includeModule('highloadblock');
|
||||
$loyaltyEventClass = 'Intaro\RetailCrm\Component\Handlers\EventsHandlers';
|
||||
|
||||
COption::SetOptionString('intaro.retailcrm', 'api_version', 'v5');
|
||||
RegisterModuleDependences('sale', 'OnSaleOrderSaved', 'intaro.retailcrm', 'RetailCrmEvent', 'orderSave', 99);
|
||||
|
||||
if (Option::get('intaro.retailcrm', 'loyalty_program_toggle') !== 'Y') {
|
||||
UnRegisterModuleDependences('sale', 'OnSaleOrderSaved', 'intaro.retailcrm', $loyaltyEventClass, 'OnSaleOrderSavedHandler');
|
||||
UnRegisterModuleDependences('sale', 'OnSaleComponentOrderResultPrepared', 'intaro.retailcrm', $loyaltyEventClass, 'OnSaleComponentOrderResultPreparedHandler');
|
||||
}
|
||||
}
|
||||
|
||||
function createCustomPropertyFile()
|
||||
|
Loading…
Reference in New Issue
Block a user