CCrmViewHelper::PrepareDealStagesByCategoryId

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmViewHelper
  4. PrepareDealStagesByCategoryId
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_view_helper.php
  • Класс: \CCrmViewHelper
  • Вызов: CCrmViewHelper::PrepareDealStagesByCategoryId
static function PrepareDealStagesByCategoryId($categoryId): array
{
	$result = array();

	$isTresholdPassed = false;
	$successStageID = CCrmDeal::GetSuccessStageID($categoryId);
	$failureStageID = CCrmDeal::GetFailureStageID($categoryId);
	foreach(self::PrepareDealStages($categoryId) as $stage)
	{
		$info = array(
			'id' => $stage['STATUS_ID'],
			'name' => $stage['NAME'],
			'sort' => intval($stage['SORT']),
			'color' => isset($stage['COLOR']) ? $stage['COLOR'] : ''
		);

		if($stage['STATUS_ID'] === $successStageID)
		{
			$isTresholdPassed = true;
			$info['semantics'] = 'success';
			$info['hint'] = GetMessage('CRM_DEAL_STAGE_MANAGER_WON_STEP_HINT');
		}
		elseif($stage['STATUS_ID'] ===  $failureStageID)
		{
			$info['semantics'] = 'failure';
		}
		elseif(!$isTresholdPassed)
		{
			$info['semantics'] = 'process';
		}
		else
		{
			$info['semantics'] = 'apology';
		}
		$result[] = $info;
	}
	return $result;
}

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