...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/integration/main/uiselector/crmcontacts.php
- Класс: Bitrix\Crm\Integration\Main\UISelector\CrmContacts
- Вызов: CrmContacts::getSearchFilter
protected function getSearchFilter(string $search, array $options) { $filter = false; $searchParts = preg_split ('/[\s]+/', $search, 2, PREG_SPLIT_NO_EMPTY); if(count($searchParts) < 2) { if (check_email($search, true)) { $entityIdList = []; $query = FieldMultiTable::query() ->where('ENTITY_ID', CCrmOwnerType::ContactName) ->where('TYPE_ID', CCrmFieldMulti::EMAIL) ->setSelect(['ELEMENT_ID']) ; if (mb_substr($search, -1) === '%') { $query->whereLike('VALUE', $search); } else { $query->where('VALUE', $search); } $res = $query->exec(); while($multiFields = $res->fetch()) { $entityIdList[] = $multiFields['ELEMENT_ID']; } if (!empty($entityIdList)) { $filter = ['@ID' => $entityIdList]; } } else { $filter = [ 'SEARCH_CONTENT' => $search, '%FULL_NAME' => $search, '@CATEGORY_ID' => 0, '__ENABLE_SEARCH_CONTENT_PHONE_DETECTION' => false ]; } } else { $filter = [ 'SEARCH_CONTENT' => $search, '__ENABLE_SEARCH_CONTENT_PHONE_DETECTION' => false, '@CATEGORY_ID' => 0, 'LOGIC' => 'AND' ]; for ($i = 0; $i < 2; $i++) { $filter["__INNER_FILTER_NAME_$i"] = ['%FULL_NAME' => $searchParts[$i]]; } } return is_array($filter) ? $this->prepareOptionalFilter($filter, $options) : false ; }