CAllCrmLead::PrepareConversionPermissionFlags

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CAllCrmLead
  4. PrepareConversionPermissionFlags
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_lead.php
  • Класс: \CAllCrmLead
  • Вызов: CAllCrmLead::PrepareConversionPermissionFlags
static function PrepareConversionPermissionFlags($ID, array &$params, $userPermissions = null)
{
	if(!$userPermissions)
	{
		$userPermissions = CCrmPerms::GetCurrentUserPermissions();
	}

	$canEdit = CCrmAuthorizationHelper::CheckUpdatePermission(self::$TYPE_NAME, $ID, $userPermissions);
	$canCreateContact = CCrmContact::CheckCreatePermission($userPermissions);
	$canCreateCompany = CCrmCompany::CheckCreatePermission($userPermissions);
	$canCreateDeal = CCrmDeal::CheckCreatePermission($userPermissions);

	$params['CAN_CONVERT_TO_CONTACT'] = $canEdit && $canCreateContact;
	$params['CAN_CONVERT_TO_COMPANY'] = $canEdit && $canCreateCompany;
	$params['CAN_CONVERT_TO_DEAL'] = $canEdit && $canCreateDeal;
	$params['CAN_CONVERT'] = $params['CONVERT'] = $canEdit && ($canCreateContact || $canCreateCompany || $canCreateDeal);
	$params['CONVERSION_PERMITTED'] = true;

	if (!Crm\Restriction\RestrictionManager::getLeadsRestriction()->hasPermission())
	{
		$params['CAN_CONVERT'] = false;
	}
}

Добавить комментарий