...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/counter/entitycountermanager.php
- Класс: Bitrix\Crm\Counter\EntityCounterManager
- Вызов: EntityCounterManager::prepareCodes
static function prepareCodes($entityTypeID, $typeIDs, array $extras = null) { $entityTypeID = (int)$entityTypeID; if(!is_array($typeIDs)) { $typeIDs = [$typeIDs]; } if(!is_array($extras)) { $extras = []; } $factory = Container::getInstance()->getFactory($entityTypeID); if (!$factory || !$factory->isCountersEnabled()) { return []; } $entityName = mb_strtolower(\CCrmOwnerType::ResolveName($entityTypeID)); $results = []; $categoryId = null; if ($factory->isCategoriesSupported()) { $categoryId = $extras['CATEGORY_ID'] ?? $extras['DEAL_CATEGORY_ID'] ?? null; if (!is_null($categoryId)) { $categoryId = (int)$categoryId; if ( $categoryId < 0 // compatibility with $categoryId=-1 for all deal categories || self::isDynamicTypeAllCategory($categoryId, $factory, $entityTypeID) // dynamic types all categories has 0 code ) { $categoryId = null; } } if (is_null($categoryId)) { $entityId = (int)($extras['ENTITY_ID'] ?? 0); if ($entityId > 0) { $categoryId = $factory->getItemCategoryId($entityId); } } } $excludeUsers = (bool)($extras['EXCLUDE_USERS'] ?? false); foreach($typeIDs as $typeID) { $typeName = mb_strtolower(EntityCounterType::resolveName($typeID)); if($typeName === '') { continue; } if ($excludeUsers) { $typeName .= '_' . \Bitrix\Crm\Counter\EntityCounterType::EXCLUDE_USERS_CODE_SUFFIX; } if(!is_null($categoryId)) // counter for definite category { $results[] = "crm_{$entityName}_c{$categoryId}_{$typeName}"; } $results[] = "crm_{$entityName}_{$typeName}"; } if ($factory instanceof Factory\Dynamic && CustomSectionProvider::hasCustomSection($factory)) { $settingsName = IntranetManager::preparePageSettingsForItemsList($factory->getEntityTypeId()); $results[] = CustomSectionProvider::COUNTER_PREFIX . $settingsName; $sectionIds = CustomSectionProvider::getAllCustomSectionIdsByEntityTypeId($factory->getEntityTypeId()); foreach ($sectionIds as $sectionId) { $results[] = CustomSectionProvider::buildCustomSectionCounterId($sectionId); } } return $results; }