1
0
Fork 0
mirror of synced 2025-04-04 14:23:33 +03:00

fix-event-install

This commit is contained in:
anton 2024-10-22 16:40:50 +03:00
parent 7e260a2d22
commit 85492e39bd
7 changed files with 22 additions and 16 deletions

View file

@ -1,3 +1,6 @@
## 2024-10-22 v6.5.35
- Исправлена подписка модуля на событие сохранения заказа
## 2024-10-21 v6.5.34
- Исправлена ошибка агента выгрузки изменений при наличии у заказа клиента без магазина

View file

@ -1 +1 @@
- Исправлена ошибка агента выгрузки изменений при наличии у заказа клиента без магазина
- Исправлена подписка модуля на событие сохранения заказа

View file

@ -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');

View file

@ -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'
);

View file

@ -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';

View file

@ -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'])

View file

@ -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;
@ -15,6 +16,7 @@ use Bitrix\Main\UserConsent\Internals\AgreementTable;
use Bitrix\Sale\Internals\OrderPropsGroupTable;
use Bitrix\Sale\Internals\OrderPropsTable;
use Bitrix\Sale\Internals\PersonTypeTable;
use Intaro\RetailCrm\Component\Advanced\LoyaltyInstaller;
/**
* Class ToModuleTable
@ -60,7 +62,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 +679,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 +928,7 @@ class LoyaltyProgramUpdater
'DESCRIPTION' => $lpBonusInfo,
];
while ($bonusProp = $bonusProps->Fetch())
{
while ($bonusProp = $bonusProps->Fetch()) {
CSaleOrderProps::Update($bonusProp['ID'], $updateInfo);
}
@ -1104,15 +1106,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,
@ -1142,7 +1142,12 @@ class UpdateSubscribe
RegisterModuleDependences('main', 'OnAfterUserRegister', 'intaro.retailcrm', 'RetailCrmEvent', 'OnAfterUserRegister');
RegisterModuleDependences('main', 'OnAfterUserAdd', 'intaro.retailcrm', 'RetailCrmEvent', 'OnAfterUserAdd');
RegisterModuleDependences('sale', 'OnSaleOrderSaved', 'intaro.retailcrm', 'RetailCrmEvent', 'orderSave', 99);
if (Option::get('intaro.retailcrm', 'loyalty_program_toggle') !== 'Y') {
$loyalty = new LoyaltyInstaller();
$loyalty->deleteLPEvents();
}
return $this;
}