- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_productprops_helper.php
- Класс: \CCrmProductPropsHelper
- Вызов: CCrmProductPropsHelper::GetPropsTypesByOperations
static function GetPropsTypesByOperations($userType = false, $arOperations = array())
{
if (!is_array($arOperations))
$arOperations = array((string)$arOperations);
$methodByOperation = array(
self::OPERATION_VIEW => 'GetPublicViewHTML',
self::OPERATION_EDIT => 'GetPublicEditHTML',
self::OPERATION_FILTER => 'GetPublicFilterHTML',
self::OPERATION_IMPORT => 'GetPublicEditHTML',
self::OPERATION_EXPORT => 'GetPublicEditHTML',
self::OPERATION_REST => 'GetPublicEditHTML',
);
$whiteListByOperation = self::GetUserTypeWhiteListByOperation();
$blackList = self::GetUserTypeBlackList();
$arUserTypeList = CIBlockProperty::GetUserType($userType);
if (!empty($arOperations))
{
foreach ($arUserTypeList as $key => $item)
{
$skipNumber = count($arOperations);
$skipCount = 0;
foreach ($arOperations as $operation)
{
if (!isset($methodByOperation[$operation])
|| !array_key_exists($methodByOperation[$operation], $item)
|| (
in_array($item['PROPERTY_TYPE'].':'.$key, $blackList, true)
|| is_array($whiteListByOperation[$operation])
&& count($whiteListByOperation[$operation]) > 0
&& !in_array($item['PROPERTY_TYPE'].':'.$key, $whiteListByOperation[$operation], true)
))
{
$skipCount++;
}
}
if ($skipNumber <= $skipCount)
unset($arUserTypeList[$key]);
}
}
return $arUserTypeList;
}