...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/statistics/leadchannelstatisticentry.php
- Класс: Bitrix\Crm\Statistics\LeadChannelStatisticEntry
- Вызов: LeadChannelStatisticEntry::register
static function register($ownerID, $channelTypeID, array $bindingParams = null, array $entityFields = null, array $options = null) { if(!is_int($ownerID)) { $ownerID = (int)$ownerID; } if($ownerID <= 0) { throw new Main\ArgumentException('Owner ID must be greater than zero.', 'ownerID'); } if($channelTypeID <= 0) { throw new Main\ArgumentException('Owner ID must be greater than zero.', 'channelTypeID'); } if(!is_array($entityFields)) { $dbResult = \CCrmLead::GetListEx( array(), array('=ID' => $ownerID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('STATUS_ID', 'ASSIGNED_BY_ID', 'DATE_CREATE', 'DATE_MODIFY') ); $entityFields = is_object($dbResult) ? $dbResult->Fetch() : null; if(!is_array($entityFields)) { return; } } $statusID = isset($entityFields['STATUS_ID']) ? $entityFields['STATUS_ID'] : ''; $semanticID = \CCrmLead::GetSemanticID($statusID); $responsibleID = isset($entityFields['ASSIGNED_BY_ID']) ? (int)$entityFields['ASSIGNED_BY_ID'] : 0; /** @var Date $date */ $date = self::parseDateString(isset($entityFields['DATE_MODIFY']) ? $entityFields['DATE_MODIFY'] : ''); if($date === null) { $date = new Date(); } $latest = self::get($ownerID, $channelTypeID); if(is_array($latest) && $responsibleID === (int)$latest['RESPONSIBLE_ID'] && $semanticID === $latest['STATUS_SEMANTIC_ID'] ) { return; } $data = array( 'OWNER_ID' => $ownerID, 'CREATED_DATE' => $date, 'CHANNEL_TYPE_ID' => $channelTypeID, 'CHANNEL_ORIGIN_ID' => isset($bindingParams['ORIGIN_ID']) ? $bindingParams['ORIGIN_ID'] : '', 'CHANNEL_COMPONENT_ID' => isset($bindingParams['COMPONENT_ID']) ? $bindingParams['COMPONENT_ID'] : '', 'RESPONSIBLE_ID' => $responsibleID, 'STATUS_SEMANTIC_ID' => $semanticID, ); LeadChannelStatisticsTable::upsert($data); }