...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/activity/communicationstatistics.php
- Класс: Bitrix\Crm\Activity\CommunicationStatistics
- Вызов: CommunicationStatistics::updateStatistics
static function updateStatistics($activity, array $bindings) { $provider = \CCrmActivity::GetActivityProvider($activity); $supportedStatistics = $provider? $provider::getSupportedCommunicationStatistics() : array(); $completed = static::isCompleted($activity); $deadline = static::getDeadline($activity); $statistics = array(); if (in_array(static::STATISTICS_STATUSES, $supportedStatistics)) $statistics[] = static::STATISTICS_STATUSES; if (in_array(static::STATISTICS_STREAMS, $supportedStatistics)) $statistics[] = static::STATISTICS_STREAMS; if ($completed && in_array(static::STATISTICS_QUANTITY, $supportedStatistics)) $statistics[] = static::STATISTICS_QUANTITY; if ($completed && in_array(static::STATISTICS_MARKS, $supportedStatistics)) $statistics[] = static::STATISTICS_MARKS; if ($completed && in_array(static::STATISTICS_MONEY, $supportedStatistics)) $statistics[] = static::STATISTICS_MONEY; $countOnly = (count($statistics) === 1 && in_array(static::STATISTICS_QUANTITY, $statistics)); foreach ($bindings as $ownerTypeId => $ids) { if ($countOnly) { $activities = static::getActivitiesCount( $ownerTypeId, $ids, $activity ); } else { $activities = static::getActivities( $ownerTypeId, $ids, $activity ); } foreach ($ids as $ownerId) { if ($ownerId <= 0 || !isset($activities[$ownerId])) continue; if ($countOnly) { $results = array(static::STATISTICS_QUANTITY => $activities[$ownerId]); } else { $results = static::mergeActivityResults($activities[$ownerId]); } static::register( $ownerTypeId, $ownerId, $statistics, array( 'DATE' => $deadline, 'PROVIDER_ID' => $provider::getId(), 'PROVIDER_TYPE_ID' => $provider::getTypeId($activity) ), $results ); } } }