ref #91040 добавлены логи на подписки
This commit is contained in:
parent
2c638fca90
commit
c1a70ac905
4 changed files with 39 additions and 0 deletions
|
@ -13,6 +13,7 @@ use Bitrix\Sale\Order;
|
|||
use Intaro\RetailCrm\Component\ConfigProvider;
|
||||
use Intaro\RetailCrm\Model\Api\Response\OrdersCreateResponse;
|
||||
use Intaro\RetailCrm\Model\Api\Response\OrdersEditResponse;
|
||||
use Logger;
|
||||
|
||||
/**
|
||||
* Class RetailCrmEvent
|
||||
|
@ -46,6 +47,8 @@ class RetailCrmEvent
|
|||
*/
|
||||
public static function OnAfterUserUpdate($arFields)
|
||||
{
|
||||
RetailCrmService::writeLogsSubscribe($arFields);
|
||||
|
||||
if (isset($GLOBALS['RETAIL_CRM_HISTORY']) && $GLOBALS['RETAIL_CRM_HISTORY']) {
|
||||
return false;
|
||||
}
|
||||
|
@ -684,6 +687,8 @@ class RetailCrmEvent
|
|||
|
||||
$customerService->createOrUpdateCustomer($customer);
|
||||
|
||||
RetailCrmService::writeLogsSubscribe($arFields);
|
||||
|
||||
//Если пользователь выразил желание зарегистрироваться в ПЛ и согласился со всеми правилами
|
||||
if ((int) $arFields['UF_REG_IN_PL_INTARO'] === 1
|
||||
&& (int) $arFields['UF_AGREE_PL_INTARO'] === 1
|
||||
|
@ -702,6 +707,17 @@ class RetailCrmEvent
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $arFields
|
||||
*
|
||||
* @return void
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public static function OnAfterUserAdd($arFields)
|
||||
{
|
||||
RetailCrmService::writeLogsSubscribe($arFields);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
|
|
|
@ -154,4 +154,24 @@ class RetailCrmService
|
|||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $arFields
|
||||
* @return void
|
||||
*/
|
||||
public static function writeLogsSubscribe(array $arFields): void
|
||||
{
|
||||
if (array_key_exists('UF_SUBSCRIBE_USER_EMAIL', $arFields)) {
|
||||
$actionSub = 'Подписался на рассылки';
|
||||
$fileSub = 'subscribe';
|
||||
|
||||
if (empty($arFields['UF_SUBSCRIBE_USER_EMAIL'])) {
|
||||
$actionSub = 'Отписался от рассылок';
|
||||
$fileSub = 'unSubscribe';
|
||||
}
|
||||
|
||||
$logger = new Logger();
|
||||
$logger->write('Пользователь ' . $arFields['ID'] . ' ' . $actionSub, $fileSub);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1079,6 +1079,7 @@ class intaro_retailcrm extends CModule
|
|||
RegisterModuleDependences('sale', 'OnSalePaymentEntitySaved', $this->MODULE_ID, 'RetailCrmEvent', 'paymentSave');
|
||||
RegisterModuleDependences('sale', 'OnSalePaymentEntityDeleted', $this->MODULE_ID, 'RetailCrmEvent', 'paymentDelete');
|
||||
RegisterModuleDependences('main', 'OnAfterUserRegister', $this->MODULE_ID, 'RetailCrmEvent', 'OnAfterUserRegister');
|
||||
RegisterModuleDependences('main', 'OnAfterUserAdd', $this->MODULE_ID, 'RetailCrmEvent', 'OnAfterUserAdd');
|
||||
|
||||
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_CATALOG_BASE_PRICE, htmlspecialchars(trim($_POST['price-types'])));
|
||||
|
@ -1279,6 +1280,7 @@ class intaro_retailcrm extends CModule
|
|||
UnRegisterModuleDependences('sale', 'OnSalePaymentEntitySaved', $this->MODULE_ID, 'RetailCrmEvent', 'paymentSave');
|
||||
UnRegisterModuleDependences('sale', 'OnSalePaymentEntityDeleted', $this->MODULE_ID, 'RetailCrmEvent', 'paymentDelete');
|
||||
UnRegisterModuleDependences('main', 'OnAfterUserRegister', $this->MODULE_ID, 'RetailCrmEvent', 'OnAfterUserRegister');
|
||||
UnRegisterModuleDependences('main', 'OnAfterUserAdd', $this->MODULE_ID, 'RetailCrmEvent', 'OnAfterUserAdd');
|
||||
|
||||
if (
|
||||
CModule::IncludeModule('catalog')
|
||||
|
|
|
@ -1139,6 +1139,7 @@ class UpdateSubscribe
|
|||
);
|
||||
|
||||
RegisterModuleDependences('main', 'OnAfterUserRegister', 'intaro.retailcrm', 'RetailCrmEvent', 'OnAfterUserRegister');
|
||||
RegisterModuleDependences('main', 'OnAfterUserAdd', 'intaro.retailcrm', 'RetailCrmEvent', 'OnAfterUserAdd');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue