...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_quote.php
- Класс: \CAllCrmQuote
- Вызов: CAllCrmQuote::GetTopIDs
static function GetTopIDs($top, $sortType = 'ASC', $userPermissions = null) { $top = (int) $top; if ($top <= 0) { return []; } $sortType = mb_strtoupper($sortType) !== 'DESC' ? 'ASC' : 'DESC'; $permissionSql = ''; if (!CCrmPerms::IsAdmin()) { if (!$userPermissions) { $userPermissions = CCrmPerms::GetCurrentUserPermissions(); } $permissionSql = self::BuildPermSql('L', 'READ', ['PERMS' => $userPermissions]); } if ($permissionSql === false) { return []; } $query = new Bitrix\Main\Entity\Query(Crm\QuoteTable::getEntity()); $query->addSelect('ID'); $query->addOrder('ID', $sortType); $query->setLimit($top); if ($permissionSql !== '') { $permissionSql = mb_substr($permissionSql, 7); $query->where('ID', 'in', new Bitrix\Main\DB\SqlExpression($permissionSql)); } $rs = $query->exec(); $results = []; while ($field = $rs->fetch()) { $results[] = (int) $field['ID']; } return $results; }