- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/notify.php
- Класс: BitrixSaleNotify
- Вызов: Notify::getUserEmail
static function getUserEmail(Order $order)
{
$userEmail = "";
if (!empty(static::$cacheUserData[$order->getId()]))
{
$userData = static::$cacheUserData[$order->getId()];
if (!empty($userData['EMAIL']))
{
$userEmail = $userData['EMAIL'];
}
}
if (empty($userEmail))
{
/** @var PropertyValueCollection $propertyCollection */
if ($propertyCollection = $order->getPropertyCollection())
{
if ($propUserEmail = $propertyCollection->getUserEmail())
{
$userEmail = $propUserEmail->getValue();
static::$cacheUserData[$order->getId()]['EMAIL'] = $userEmail;
}
}
}
if (empty($userEmail))
{
$userRes = MainUserTable::getList(array(
'select' => array('ID', 'LOGIN', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'EMAIL'),
'filter' => array('=ID' => $order->getUserId()),
));
if ($userData = $userRes->fetch())
{
static::$cacheUserData[$order->getId()] = $userData;
$userEmail = $userData['EMAIL'];
}
}
return $userEmail;
}