...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_role.php
- Класс: \CCrmRole
- Вызов: CCrmRole::GetList
public function GetList($arOrder = Array('ID' => 'DESC'), $arFilter = Array()) { global $DB; // where $arWhereFields = array( 'ID' => array( 'TABLE_ALIAS' => 'R', 'FIELD_NAME' => 'R.ID', 'FIELD_TYPE' => 'int', 'JOIN' => false ), 'NAME' => array( 'TABLE_ALIAS' => 'R', 'FIELD_NAME' => 'R.NAME', 'FIELD_TYPE' => 'string', 'JOIN' => false ), 'IS_SYSTEM' => array( 'TABLE_ALIAS' => 'R', 'FIELD_NAME' => 'R.IS_SYSTEM', 'FIELD_TYPE' => 'string', 'JOIN' => false ), 'CODE' => array( 'TABLE_ALIAS' => 'R', 'FIELD_NAME' => 'R.CODE', 'FIELD_TYPE' => 'string', 'JOIN' => false ), 'GROUP_CODE' => array( 'TABLE_ALIAS' => 'R', 'FIELD_NAME' => 'R.GROUP_CODE', 'FIELD_TYPE' => 'string', 'JOIN' => false ), ); $obQueryWhere = new CSQLWhere(); $obQueryWhere->SetFields($arWhereFields); if(!is_array($arFilter)) $arFilter = array(); $sQueryWhereFields = $obQueryWhere->GetQuery($arFilter); $sSqlSearch = ''; if(!empty($sQueryWhereFields)) $sSqlSearch .= "\n\t\t\t\tAND ($sQueryWhereFields) "; // order $arSqlOrder = Array(); if (!is_array($arOrder)) $arOrder = Array('ID' => 'DESC'); foreach ($arOrder as $by => $order) { $by = mb_strtoupper($by); $order = mb_strtolower($order); if($order != 'asc') $order = 'desc'; if(isset($arWhereFields[$by])) $arSqlOrder[$by] = " R.$by $order "; else { $by = 'id'; $arSqlOrder[$by] = " R.ID $order "; } } if (count($arSqlOrder) > 0) $sSqlOrder = "\n\t\t\t\tORDER BY ".implode(', ', $arSqlOrder); else $sSqlOrder = ''; $sSql = " SELECT ID, NAME, IS_SYSTEM, CODE, GROUP_CODE FROM b_crm_role R WHERE 1=1 $sSqlSearch $sSqlOrder"; $obRes = $DB->Query($sSql, false, 'FILE: '.__FILE__.'
LINE: '.__LINE__); return $obRes; }