...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_activity.php
- Класс: \CAllCrmActivity
- Вызов: CAllCrmActivity::__AfterPrepareSql
static function __AfterPrepareSql(/*CCrmEntityListBuilder*/ $sender, $arOrder, $arFilter, $arGroupBy, $arSelectFields) { $sqlData = array('FROM' => array(), 'WHERE' => array()); if(isset($arFilter['SEARCH_CONTENT']) && $arFilter['SEARCH_CONTENT'] !== '') { $tableAlias = $sender->GetTableAlias(); $queryWhere = new CSQLWhere(); $queryWhere->SetFields( array( 'SEARCH_CONTENT' => array( 'FIELD_NAME' => "{$tableAlias}.SEARCH_CONTENT", 'FIELD_TYPE' => 'string', 'JOIN' => false ) ) ); $options = []; if (isset($arFilter['__ENABLE_SEARCH_CONTENT_PHONE_DETECTION'])) { $options['ENABLE_PHONE_DETECTION'] = $arFilter['__ENABLE_SEARCH_CONTENT_PHONE_DETECTION']; unset($arFilter['__ENABLE_SEARCH_CONTENT_PHONE_DETECTION']); } $query = $queryWhere->GetQuery( Crm\Search\SearchEnvironment::prepareEntityFilter( CCrmOwnerType::Activity, array( 'SEARCH_CONTENT' => Crm\Search\SearchEnvironment::prepareSearchContent($arFilter['SEARCH_CONTENT'], $options) ) ) ); if($query !== '') { $sqlData['WHERE'][] = $query; } } if(isset($arFilter['BINDINGS'])) { $sql = CCrmActivity::PrepareBindingsFilterSql($arFilter['BINDINGS'], $sender->GetTableAlias()); if($sql !== '') { $sqlData['FROM'][] = $sql; } } $result = array(); if(!empty($sqlData['FROM'])) { $result['FROM'] = implode(' ', $sqlData['FROM']); } if(!empty($sqlData['WHERE'])) { $result['WHERE'] = implode(' AND ', $sqlData['WHERE']); } return !empty($result) ? $result : false; }