...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/statistics/companygrowthstatisticentry.php
- Класс: Bitrix\Crm\Statistics\CompanyGrowthStatisticEntry
- Вызов: CompanyGrowthStatisticEntry::synchronize
static function synchronize($ownerID, array $entityFields = null) { if(!is_int($ownerID)) { $ownerID = (int)$ownerID; } if($ownerID <= 0) { throw new Main\ArgumentException('Owner ID must be greater than zero.', 'ownerID'); } $query = new Query(CompanyGrowthStatisticsTable::getEntity()); $query->addSelect('RESPONSIBLE_ID'); $query->addFilter('=OWNER_ID', $ownerID); $query->setLimit(1); $dbResult = $query->exec(); $first = $dbResult->fetch(); if(!is_array($first)) { return false; } if(!is_array($entityFields)) { $dbResult = \CCrmCompany::GetListEx( array(), array('=ID' => $ownerID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ASSIGNED_BY_ID') ); $entityFields = is_object($dbResult) ? $dbResult->Fetch() : null; if(!is_array($entityFields)) { return false; } } $responsibleID = isset($entityFields['ASSIGNED_BY_ID']) ? (int)$entityFields['ASSIGNED_BY_ID'] : 0; if($responsibleID === (int)$first['RESPONSIBLE_ID']) { return false; } CompanyGrowthStatisticsTable::synchronize( $ownerID, array('RESPONSIBLE_ID' => $responsibleID) ); return true; }