Skip to content

Commit fcb3ed9

Browse files
authored
Исправлена запись ID программы лояльности (#411)
1 parent e08533c commit fcb3ed9

File tree

6 files changed

+45
-18
lines changed

6 files changed

+45
-18
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 2025-12-15 v6.7.7
2+
- Исправлена ошибка обновления ID участий в ПЛ
3+
14
## 2025-12-15 v6.7.6
25
- Исправлена логика обработки скидок при использовании программы лояльности
36

intaro.retailcrm/classes/general/RCrmActions.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,8 @@ public static function apiMethod($api, $methodApi, $method, $params, $site = nul
730730
case 'cartSet':
731731
case 'cartClear':
732732
return self::proxy($api, $methodApi, $method, [$params, $site]);
733+
case 'getLoyaltyAccounts':
734+
return self::proxy($api, $methodApi, $method, [['filter' => $params], $site]);
733735
default:
734736
return self::proxy($api, $methodApi, $method, [$params, $site]);
735737
}

intaro.retailcrm/classes/general/user/RetailCrmUser.php

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -310,18 +310,27 @@ public static function updateLoyaltyAccountIds(): bool
310310
$crmAccounts = RCrmActions::apiMethod($api, 'getLoyaltyAccounts', __METHOD__, $filter, $site);
311311

312312
foreach ($crmAccounts['loyaltyAccounts'] as $crmAccount) {
313-
$loyalty = $crmAccounts = RCrmActions::apiMethod(
314-
$api,
315-
'getLoyaltyLoyalty',
316-
__METHOD__,
317-
$crmAccount['loyalty']['id'],
318-
$site
319-
);
320-
321-
if ($loyalty['loyalty']['active'] === true) {
322-
$actualLoyalty = $crmAccount;
323-
324-
break;
313+
try {
314+
$loyalty = RCrmActions::apiMethod(
315+
$api,
316+
'getLoyaltyLoyalty',
317+
__METHOD__,
318+
$crmAccount['loyalty']['id'],
319+
$site
320+
);
321+
322+
if ($loyalty['loyalty']['active'] === true) {
323+
$actualLoyalty = $crmAccount;
324+
325+
break;
326+
}
327+
} catch (Throwable $exception) {
328+
Logger::getInstance()->write(
329+
sprintf('Ошибка получения участия в ПЛ пользователя с ID %s', $user['ID']),
330+
'loyaltyIdsUpdate'
331+
);
332+
333+
continue;
325334
}
326335
}
327336

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

337-
if ($updateUser->Update($user['ID'], $fields)) {
346+
try {
347+
$result = $updateUser->Update($user['ID'], $fields);
348+
349+
Logger::getInstance()->write(
350+
$result
351+
? sprintf('Обновлен идентификатор участия ПЛ для пользователя с ID %s', $user['ID'])
352+
: sprintf('Не удалось обновить данные пользователя с ID %s', $user['ID']),
353+
'loyaltyIdsUpdate'
354+
);
355+
} catch (Throwable $exception) {
338356
Logger::getInstance()->write(
339-
sprintf('Обновлен идентификатор участия ПЛ для пользователя с ID %s', $user['ID']),
357+
sprintf(
358+
'Ошибка при обновлении участия для пользователя с ID %s. Подробнее: %s',
359+
$user['ID'],
360+
$exception->getMessage()
361+
),
340362
'loyaltyIdsUpdate'
341363
);
342364
}

intaro.retailcrm/description.ru

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
- Исправлена логика обработки скидок при использовании программы лояльности
1+
- Исправлена ошибка обновления ID участий в ПЛ
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

33
$arModuleVersion = [
4-
'VERSION' => '6.7.6',
5-
'VERSION_DATE' => '2025-12-15 9:30:00'
4+
'VERSION' => '6.7.7',
5+
'VERSION_DATE' => '2025-12-15 12:30:00'
66
];

intaro.retailcrm/lib/component/constants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
class Constants
2020
{
21-
public const MODULE_VERSION = '6.7.6';
21+
public const MODULE_VERSION = '6.7.7';
2222
public const CRM_PURCHASE_PRICE_NULL = 'purchasePrice_null';
2323
public const BITRIX_USER_ID_PREFIX = 'bitrixUserId-';
2424
public const CRM_USERS_MAP = 'crm_users_map';

0 commit comments

Comments
 (0)