Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2025-12-15 v6.7.7
- Исправлена ошибка обновления ID участий в ПЛ

## 2025-12-15 v6.7.6
- Исправлена логика обработки скидок при использовании программы лояльности

Expand Down
2 changes: 2 additions & 0 deletions intaro.retailcrm/classes/general/RCrmActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,8 @@ public static function apiMethod($api, $methodApi, $method, $params, $site = nul
case 'cartSet':
case 'cartClear':
return self::proxy($api, $methodApi, $method, [$params, $site]);
case 'getLoyaltyAccounts':
return self::proxy($api, $methodApi, $method, [['filter' => $params], $site]);
default:
return self::proxy($api, $methodApi, $method, [$params, $site]);
}
Expand Down
50 changes: 36 additions & 14 deletions intaro.retailcrm/classes/general/user/RetailCrmUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,18 +310,27 @@ public static function updateLoyaltyAccountIds(): bool
$crmAccounts = RCrmActions::apiMethod($api, 'getLoyaltyAccounts', __METHOD__, $filter, $site);

foreach ($crmAccounts['loyaltyAccounts'] as $crmAccount) {
$loyalty = $crmAccounts = RCrmActions::apiMethod(
$api,
'getLoyaltyLoyalty',
__METHOD__,
$crmAccount['loyalty']['id'],
$site
);

if ($loyalty['loyalty']['active'] === true) {
$actualLoyalty = $crmAccount;

break;
try {
$loyalty = RCrmActions::apiMethod(
$api,
'getLoyaltyLoyalty',
__METHOD__,
$crmAccount['loyalty']['id'],
$site
);

if ($loyalty['loyalty']['active'] === true) {
$actualLoyalty = $crmAccount;

break;
}
} catch (Throwable $exception) {
Logger::getInstance()->write(
sprintf('Ошибка получения участия в ПЛ пользователя с ID %s', $user['ID']),
'loyaltyIdsUpdate'
);

continue;
}
}

Expand All @@ -334,9 +343,22 @@ public static function updateLoyaltyAccountIds(): bool
'UF_CARD_NUM_INTARO' => $cardNumber
];

if ($updateUser->Update($user['ID'], $fields)) {
try {
$result = $updateUser->Update($user['ID'], $fields);

Logger::getInstance()->write(
$result
? sprintf('Обновлен идентификатор участия ПЛ для пользователя с ID %s', $user['ID'])
: sprintf('Не удалось обновить данные пользователя с ID %s', $user['ID']),
'loyaltyIdsUpdate'
);
} catch (Throwable $exception) {
Logger::getInstance()->write(
sprintf('Обновлен идентификатор участия ПЛ для пользователя с ID %s', $user['ID']),
sprintf(
'Ошибка при обновлении участия для пользователя с ID %s. Подробнее: %s',
$user['ID'],
$exception->getMessage()
),
'loyaltyIdsUpdate'
);
}
Expand Down
2 changes: 1 addition & 1 deletion intaro.retailcrm/description.ru
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- Исправлена логика обработки скидок при использовании программы лояльности
- Исправлена ошибка обновления ID участий в ПЛ
4 changes: 2 additions & 2 deletions intaro.retailcrm/install/version.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

$arModuleVersion = [
'VERSION' => '6.7.6',
'VERSION_DATE' => '2025-12-15 9:30:00'
'VERSION' => '6.7.7',
'VERSION_DATE' => '2025-12-15 12:30:00'
];
2 changes: 1 addition & 1 deletion intaro.retailcrm/lib/component/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
class Constants
{
public const MODULE_VERSION = '6.7.6';
public const MODULE_VERSION = '6.7.7';
public const CRM_PURCHASE_PRICE_NULL = 'purchasePrice_null';
public const BITRIX_USER_ID_PREFIX = 'bitrixUserId-';
public const CRM_USERS_MAP = 'crm_users_map';
Expand Down