- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/buyerstatistic.php
- Класс: BitrixSaleBuyerStatistic
- Вызов: BuyerStatistic::calculate
static function calculate($userId, $currency, $lid)
{
$result = static::collectUserData($userId, $currency, $lid);
if (!$result->isSuccess() || $result->hasWarnings())
{
return $result;
}
$statisticData = static::getList(
array(
'select' => array('ID'),
'filter' => array('=USER_ID' => $userId, '=CURRENCY' => $currency, '=LID' => $lid),
'limit' => 1
)
);
$buyerStatistic = $statisticData->fetch();
if (!$buyerStatistic)
{
return InternalsBuyerStatisticTable::add($result->getData());
}
return InternalsBuyerStatisticTable::update($buyerStatistic['ID'], $result->getData());
}