diff --git a/intaro.retailcrm/classes/general/order/RetailCrmOrder_v5.php b/intaro.retailcrm/classes/general/order/RetailCrmOrder_v5.php index 0f0e7962..97df603c 100644 --- a/intaro.retailcrm/classes/general/order/RetailCrmOrder_v5.php +++ b/intaro.retailcrm/classes/general/order/RetailCrmOrder_v5.php @@ -495,19 +495,17 @@ class RetailCrmOrder continue; } - $user = UserTable::getById($order['USER_ID'])->fetch(); - - if (!$user) { + if (empty($order['USER_ID'])) { RCrmActions::eventLog( 'RetailCrmOrder::uploadOrders', - 'UserTable::getById', - 'Error find user: ' . $order['USER_ID'] . ' in order: ' . $order['ID'] + 'Order::load', + 'The user does not exist in order: ' . $order['ID'] ); continue; } - self::createCustomerForOrder($api, $arCustomer, $arCustomerCorporate,$arParams, $order, $site, $user); + self::createCustomerForOrder($api, $arCustomer, $arCustomerCorporate,$arParams, $order, $site); if (isset($order['RESPONSIBLE_ID']) && !empty($order['RESPONSIBLE_ID'])) { $managerService = ManagerService::getInstance(); @@ -591,13 +589,18 @@ class RetailCrmOrder array &$arCustomerCorporate, array &$arParams, array $order, - $site, - array $user = null + $site ): void { $optionsContragentType = RetailcrmConfigProvider::getContragentTypes(); + $user = UserTable::getById($order['USER_ID'])->fetch(); - if (empty($user)) { - $user = UserTable::getById($order['USER_ID'])->fetch(); + if (!$user) { + RCrmActions::eventLog( + 'RetailCrmOrder::createCustomerForOrder', + 'UserTable::getById', + 'Error find user: ' . $order['USER_ID'] . ' in order: ' . $order['ID'] + ); + return; } if ('Y' === RetailcrmConfigProvider::getCorporateClientStatus()) {