- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/controller/action/entity/saveorderaction.php
- Класс: BitrixSaleControllerActionEntitySaveOrderAction
- Вызов: SaveOrderAction::searchExistingUser
private function searchExistingUser(string $email, string $phone): ?int
{
$existingUserId = null;
if (!empty($email))
{
$res = MainUserTable::getRow([
'filter' => [
'=ACTIVE' => 'Y',
'=EMAIL' => $email,
],
'select' => ['ID'],
]);
if (isset($res['ID']))
{
$existingUserId = (int)$res['ID'];
}
}
if (!$existingUserId && !empty($phone))
{
$normalizedPhone = NormalizePhone($phone);
$normalizedPhoneForRegistration = MainUserPhoneAuthTable::normalizePhoneNumber($phone);
if (!empty($normalizedPhone))
{
$res = MainUserTable::getRow([
'filter' => [
'ACTIVE' => 'Y',
[
'LOGIC' => 'OR',
'=PHONE_AUTH.PHONE_NUMBER' => $normalizedPhoneForRegistration,
'=PERSONAL_PHONE' => $normalizedPhone,
'=PERSONAL_MOBILE' => $normalizedPhone,
],
],
'select' => ['ID'],
]);
if (isset($res['ID']))
{
$existingUserId = (int)$res['ID'];
}
}
}
return $existingUserId;
}