...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_deal.php
- Класс: \CAllCrmDeal
- Вызов: CAllCrmDeal::GetListEx
static function GetListEx($arOrder = array(), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array(), $arOptions = array()) { if(!is_array($arOptions)) { $arOptions = array(); } if(!isset($arOptions['PERMISSION_SQL_TYPE'])) { $arOptions['PERMISSION_SQL_TYPE'] = 'FROM'; $arOptions['PERMISSION_SQL_UNION'] = 'DISTINCT'; } $checkPermissions = true; if(isset($arFilter['CHECK_PERMISSIONS'])) { $checkPermissions = $arFilter['CHECK_PERMISSIONS'] !== 'N'; } if($checkPermissions) { $ID = isset($arFilter['ID']) && is_numeric($arFilter['ID']) ? (int)$arFilter['ID'] : 0; if($ID <= 0) { $ID = isset($arFilter['=ID']) && is_numeric($arFilter['=ID']) ? (int)$arFilter['=ID'] : 0; } if($ID > 0) { if(!self::CheckReadPermission($ID)) { $dbResult = new CDBResult(); $dbResult->InitFromArray(array()); return $dbResult; } $arFilter['CHECK_PERMISSIONS'] = 'N'; } } if ( !isset($arFilter['IS_RECURRING']) && !isset($arFilter['=IS_RECURRING']) && !(isset($arFilter['ID']) || isset($arFilter['=ID']) || isset($arFilter['@ID'])) ) { if(!isset($arFilter['LOGIC']) || $arFilter['LOGIC'] === 'AND') { $arFilter['=IS_RECURRING'] = 'N'; } else { unset($arFilter['CHECK_PERMISSIONS']); $arFilter = array( '__INNER_FILTER' => $arFilter, '=IS_RECURRING' => 'N' ); if(!$checkPermissions) { $arFilter['CHECK_PERMISSIONS'] = 'N'; } } } $operationInfo = Crm\UI\Filter\EntityHandler::findFieldOperation('CATEGORY_ID', $arFilter); if(is_array($operationInfo) && in_array($operationInfo['OPERATION'], ['=', 'IN'])) { $categoryIDs = is_array($operationInfo['CONDITION']) ? $operationInfo['CONDITION'] : array($operationInfo['CONDITION']); $entityTypes = array(); foreach($categoryIDs as $categoryID) { if($categoryID >= 0) { $entityTypes[] = DealCategory::convertToPermissionEntityType($categoryID); } } if(!empty($entityTypes)) { $arOptions['RESTRICT_BY_ENTITY_TYPES'] = array_unique($entityTypes); } } $lb = new CCrmEntityListBuilder( CCrmDeal::DB_TYPE, CCrmDeal::TABLE_NAME, self::TABLE_ALIAS, self::GetFields(isset($arOptions['FIELD_OPTIONS']) ? $arOptions['FIELD_OPTIONS'] : null), self::$sUFEntityID, 'DEAL', array('CCrmDeal', 'BuildPermSql'), array('CCrmDeal', '__AfterPrepareSql') ); return $lb->Prepare($arOrder, $arFilter, $arGroupBy, $arNavStartParams, $arSelectFields, $arOptions); }