CAllCrmLead::GetStartStatusID

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CAllCrmLead
  4. GetStartStatusID
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_lead.php
  • Класс: \CAllCrmLead
  • Вызов: CAllCrmLead::GetStartStatusID
static function GetStartStatusID($permissionTypeID = 0, CCrmPerms $userPermissions = null)
{
	$statusIDs = array_keys(self::GetStatuses());
	if(empty($statusIDs))
	{
		return '';
	}

	$permissionType = Bitrix\Crm\Security\EntityPermissionType::resolveName($permissionTypeID);
	if($permissionType === '')
	{
		return $statusIDs[0];
	}

	if($userPermissions === null)
	{
		$userPermissions = CCrmPerms::GetCurrentUserPermissions();
	}

	foreach($statusIDs as $statusID)
	{
		$permission = $userPermissions->GetPermType(self::$TYPE_NAME, $permissionType, array("STATUS_ID{$statusID}"));
		if($permission !== BX_CRM_PERM_NONE)
		{
			return $statusID;
		}
	}
	return '';
}

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