CAllCrmLead::EnsureStatusesLoaded

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CAllCrmLead
  4. EnsureStatusesLoaded
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_lead.php
  • Класс: \CAllCrmLead
  • Вызов: CAllCrmLead::EnsureStatusesLoaded
static function EnsureStatusesLoaded()
{
	if (self::$LEAD_STATUSES === null)
	{
		$bFinished = $bFailed = false;
		self::$LEAD_STATUSES = CCrmStatus::GetStatus('STATUS');
		$statusesWork = array();
		$statusesSuccess = array();
		$statusesFailed = array();
		$statusesFinished = array();
		foreach (self::$LEAD_STATUSES as $statusInfo)
		{
			if (!$bFinished && $statusInfo['STATUS_ID'] === 'CONVERTED')
			{
				$statusesSuccess[] = $statusInfo['STATUS_ID'];
				$bFinished = true;
			}
			if (!$bFailed && $statusInfo['STATUS_ID'] === 'JUNK')
				$bFailed = true;
			if ($bFinished)
				$statusesFinished[] = $statusInfo['STATUS_ID'];
			else
				$statusesWork[] = $statusInfo['STATUS_ID'];
			if ($bFailed)
				$statusesFailed[] = $statusInfo['STATUS_ID'];
		}
		self::$LEAD_STATUSES_BY_GROUP = array(
			'WORK' => $statusesWork,
			'SUCCESS' => $statusesSuccess,
			'FAILED' => $statusesFailed,
			'FINISHED' => $statusesFinished
		);
	}
}

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