- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/agent/activity/synccountabledataagent.php
- Класс: Bitrix\Crm\Agent\Activity\SyncCountableDataAgent
- Вызов: SyncCountableDataAgent::synchronizeEntityData
private function synchronizeEntityData(array $entity)
{
$entityTypeId = (int)$entity['ENTITY_TYPE_ID'];
$entityId = (int)$entity['ENTITY_ID'];
$countable = EntityCountableActivityTable::query()
->setSelect([
'ENTITY_ID',
'ENTITY_ASSIGNED_BY_ID',
])
->where('ENTITY_ID', $entityId)
->where('ENTITY_TYPE_ID', $entityTypeId)
->whereNot('ENTITY_ASSIGNED_BY_ID', (int)$entity['ENTITY_ASSIGNED_BY_ID'])
->setLimit(1)
->fetch()
;
if ($countable)
{
EntityCountableActivityTable::updateEntityAssignedBy(new ItemIdentifier($entityTypeId, $entityId), (int)$entity['ENTITY_ASSIGNED_BY_ID']);
$this->resetCounterByEntity($entityTypeId, $entityId, $countable['ENTITY_ASSIGNED_BY_ID']);
}
}