static function getFilterDefinition(array $ufFieldsList, int $configId, ?array $arResult)
{
BitrixMainLoader::includeModule('ImConnector');
$filterFields = array(
'CONFIG_ID' => array(
'id' => 'CONFIG_ID',
'name' => Loc::getMessage('OL_STATS_HEADER_CONFIG_NAME'),
'type' => 'list',
'items' => $arResult['LINES'] ?? Loc::getMessage('OL_SEARCH_OL'),
'default' => !$configId,
'default_value' => $configId ?: '',
'params' => array(
'multiple' => 'Y'
)
),
'TYPE' => array(
'id' => 'TYPE',
'name' => Loc::getMessage('OL_STATS_HEADER_MODE_NAME'),
'type' => 'list',
'items' => array(
"" => Loc::getMessage('OL_STATS_FILTER_UNSET'),
'input' => Loc::getMessage('OL_COMPONENT_TABLE_INPUT'),
'output' => Loc::getMessage('OL_COMPONENT_TABLE_OUTPUT'),
),
'default' => false,
),
'DATE_CREATE' => array(
'id' => 'DATE_CREATE',
'name' => Loc::getMessage('OL_STATS_HEADER_DATE_CREATE'),
'type' => 'date',
'default' => true
),
'DATE_CLOSE' => array(
'id' => 'DATE_CLOSE',
'name' => Loc::getMessage('OL_STATS_HEADER_DATE_CLOSE'),
'type' => 'date',
'default' => false
),
'OPERATOR_ID' => array(
'id' => 'OPERATOR_ID',
'name' => Loc::getMessage('OL_STATS_HEADER_OPERATOR_NAME'),
'type' => 'dest_selector',
'params' => array(
'apiVersion' => '3',
'context' => 'OL_STATS_FILTER_OPERATOR_ID',
'multiple' => 'N',
'contextCode' => 'U',
'enableAll' => 'N',
'enableEmpty' => 'Y',
'enableSonetgroups' => 'N',
'allowEmailInvitation' => 'N',
'departmentSelectDisable' => 'Y',
'isNumeric' => 'Y',
'prefix' => 'U',
'allowBots' => 'Y'
),
'default' => true,
),
'CLIENT_NAME' => array(
'id' => 'CLIENT_NAME',
'name' => Loc::getMessage('OL_STATS_HEADER_USER_NAME'),
'type' => 'string',
'default' => false,
),
'SOURCE' => array(
'id' => 'SOURCE',
'name' => Loc::getMessage('OL_STATS_HEADER_SOURCE_TEXT_2'),
'type' => 'list',
'items' => BitrixImConnectorConnector::getListConnector(),
'default' => true,
'params' => array(
'multiple' => 'Y'
)
),
'ID' => array(
'id' => 'ID',
'name' => Loc::getMessage('OL_STATS_HEADER_SESSION_ID'),
'type' => 'string',
'default' => true
),
'EXTRA_URL' => array(
'id' => 'EXTRA_URL',
'name' => Loc::getMessage('OL_STATS_HEADER_EXTRA_URL'),
'type' => 'string',
'default' => false
),
'STATUS' => array(
'id' => 'STATUS',
'name' => Loc::getMessage('OL_STATS_HEADER_STATUS'),
'type' => 'list',
'items' => array(
"" => Loc::getMessage('OL_STATS_FILTER_UNSET'),
'client' => Loc::getMessage('OL_COMPONENT_TABLE_STATUS_CLIENT_NEW'),
'operator' => Loc::getMessage('OL_COMPONENT_TABLE_STATUS_OPERATOR_NEW'),
'closed' => Loc::getMessage('OL_COMPONENT_TABLE_STATUS_CLOSED'),
),
'default' => true,
),
'STATUS_DETAIL' => array(
'id' => 'STATUS_DETAIL',
'name' => Loc::getMessage('OL_STATS_HEADER_STATUS_DETAIL'),
'type' => 'list',
'items' => array(
'' => Loc::getMessage('OL_STATS_FILTER_UNSET'),
(string)Session::STATUS_NEW => Loc::getMessage('OL_COMPONENT_TABLE_STATUS_NEW'),
(string)Session::STATUS_SKIP => Loc::getMessage('OL_COMPONENT_TABLE_STATUS_OPERATOR_SKIP_NEW'),
(string)Session::STATUS_ANSWER => Loc::getMessage('OL_COMPONENT_TABLE_STATUS_OPERATOR_ANSWER_NEW'),
(string)Session::STATUS_CLIENT => Loc::getMessage('OL_COMPONENT_TABLE_STATUS_CLIENT_NEW'),
(string)Session::STATUS_CLIENT_AFTER_OPERATOR => Loc::getMessage('OL_COMPONENT_TABLE_STATUS_CLIENT_AFTER_OPERATOR_NEW'),
(string)Session::STATUS_OPERATOR => Loc::getMessage('OL_COMPONENT_TABLE_STATUS_OPERATOR_NEW'),
(string)Session::STATUS_WAIT_CLIENT => Loc::getMessage('OL_COMPONENT_TABLE_STATUS_WAIT_ACTION_2'),
(string)Session::STATUS_CLOSE => Loc::getMessage('OL_COMPONENT_TABLE_STATUS_CLOSED'),
(string)Session::STATUS_SPAM => Loc::getMessage('OL_STATS_HEADER_SPAM_2'),
),
'params' => array(
'multiple' => 'Y'
),
'default' => false
),
);
if (self::isFdcMode())
{
$filterFields['EXTRA_TARIFF'] = array(
'id' => 'EXTRA_TARIFF',
'name' => Loc::getMessage('OL_STATS_HEADER_EXTRA_TARIFF'),
'type' => 'string',
'default' => false
);
$filterFields['EXTRA_USER_LEVEL'] = array(
'id' => 'EXTRA_USER_LEVEL',
'name' => Loc::getMessage('OL_STATS_HEADER_EXTRA_USER_LEVEL'),
'type' => 'string',
'default' => false
);
$filterFields['EXTRA_PORTAL_TYPE'] = array(
'id' => 'EXTRA_PORTAL_TYPE',
'name' => Loc::getMessage('OL_STATS_HEADER_EXTRA_PORTAL_TYPE'),
'type' => 'string',
'default' => false
);
$filterFields['EXTRA_REGISTER'] = array(
'id' => 'EXTRA_REGISTER',
'name' => Loc::getMessage('OL_STATS_HEADER_EXTRA_REGISTER'),
'default' => false,
'type' => 'number'
);
}
if (Loader::includeModule('crm'))
{
$filterFields['CRM'] = array(
'id' => 'CRM',
'name' => Loc::getMessage('OL_STATS_HEADER_CRM'),
'default' => false,
'type' => 'list',
'items' => array(
"" => Loc::getMessage('OL_STATS_FILTER_UNSET'),
'Y' => Loc::getMessage('OL_STATS_FILTER_Y'),
'N' => Loc::getMessage('OL_STATS_FILTER_N'),
)
);
/*
$filterFields['CRM_ENTITY'] = array(
'id' => 'CRM_ENTITY',
'name' => Loc::getMessage('OL_STATS_HEADER_CRM_TEXT'),
'default' => false,
'type' => 'custom_entity',
'selector' => array(
'TYPE' => 'crm_entity',
'DATA' => array(
'ID' => 'CRM_ENTITY',
'FIELD_ID' => 'CRM_ENTITY',
'ENTITY_TYPE_NAMES' => array(CCrmOwnerType::LeadName, CCrmOwnerType::CompanyName, CCrmOwnerType::ContactName, CCrmOwnerType::DealName),
'IS_MULTIPLE' => false
)
)
);
*/
}
$filterFields = array_merge($filterFields, array(
'SEND_FORM' => array(
'id' => 'SEND_FORM',
'name' => Loc::getMessage('OL_STATS_HEADER_SEND_FORM'),
'default' => false,
'type' => 'list',
'items' => array(
"" => Loc::getMessage('OL_STATS_FILTER_UNSET'),
'Y' => Loc::getMessage('OL_STATS_FILTER_Y'),
'N' => Loc::getMessage('OL_STATS_FILTER_N'),
)
),
'SEND_HISTORY' => array(
'id' => 'SEND_HISTORY',
'name' => Loc::getMessage('OL_STATS_HEADER_SEND_HISTORY'),
'default' => false,
'type' => 'list',
'items' => array(
"" => Loc::getMessage('OL_STATS_FILTER_UNSET'),
'Y' => Loc::getMessage('OL_STATS_FILTER_Y'),
'N' => Loc::getMessage('OL_STATS_FILTER_N'),
)
),
'WORKTIME' => array(
'id' => 'WORKTIME',
'name' => Loc::getMessage('OL_STATS_HEADER_WORKTIME_TEXT'),
'default' => false,
'type' => 'list',
'items' => array(
"" => Loc::getMessage('OL_STATS_FILTER_UNSET'),
'Y' => Loc::getMessage('OL_STATS_FILTER_Y'),
'N' => Loc::getMessage('OL_STATS_FILTER_N'),
)
),
'SPAM' => array(
'id' => 'SPAM',
'name' => Loc::getMessage('OL_STATS_HEADER_SPAM_2'),
'default' => false,
'type' => 'list',
'items' => array(
"" => Loc::getMessage('OL_STATS_FILTER_UNSET'),
'Y' => Loc::getMessage('OL_STATS_FILTER_Y'),
'N' => Loc::getMessage('OL_STATS_FILTER_N'),
)
),
'MESSAGE_COUNT' => array(
'id' => 'MESSAGE_COUNT',
'name' => Loc::getMessage('OL_STATS_FILTER_MESSAGE_COUNT'),
'default' => false,
'type' => 'number'
),
'VOTE' => array(
'id' => 'VOTE',
'name' => Loc::getMessage('OL_STATS_HEADER_VOTE_CLIENT'),
'default' => false,
'type' => 'list',
'items' => array(
"" => Loc::getMessage('OL_STATS_FILTER_UNSET'),
'5' => Loc::getMessage('OL_STATS_HEADER_VOTE_CLIENT_LIKE'),
'1' => Loc::getMessage('OL_STATS_HEADER_VOTE_CLIENT_DISLIKE'),
)
),
'VOTE_HEAD' => array(
'id' => 'VOTE_HEAD',
'name' => Loc::getMessage('OL_STATS_HEADER_VOTE_HEAD_1'),
'default' => false,
'type' => 'list',
'items' => array(
'wo' => Loc::getMessage('OL_STATS_HEADER_VOTE_HEAD_WO'),
'5' => Session::VOTE_LIKE,
'4' => 4,
'3' => 3,
'2' => 2,
'1' => Session::VOTE_DISLIKE,
),
'params' => array(
'multiple' => 'Y'
)
),
));
// UF
foreach ($ufFieldsList as $fieldName => $field)
{
if (
$field['SHOW_FILTER'] != 'N'
&& $field['USER_TYPE']['BASE_TYPE'] != CUserTypeManager::BASE_TYPE_FILE
)
{
$fieldClass = $field['USER_TYPE']['CLASS_NAME'];
if (
is_a($fieldClass, BitrixMainUserFieldTypesBaseType::class, true)
&& is_callable([$fieldClass, 'getFilterData'])
)
{
$filterFields[$fieldName] = $fieldClass::getFilterData(
$field,
[
'ID' => $fieldName,
'NAME' => $field['LIST_FILTER_LABEL'] ?: $field['FIELD_NAME'],
]
);
}
}
}
return $filterFields;
}