• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integration/report/dashboard/leadanalytic/commonlead.php
  • Класс: Bitrix\Crm\Integration\Report\Dashboard\LeadAnalytic\CommonLead
  • Вызов: CommonLead::buildLeadColumnFunnel
static function buildLeadColumnFunnel()
{
	$widget = new Widget();
	$widget->setGId(Util::generateUserUniqueId());
	$widget->setWidgetClass(BaseWidget::getClassName());
	$widget->setViewKey(ColumnFunnel::VIEW_KEY);
	$widget->setCategoryKey('crm');
	$widget->setBoardId(static::BOARD_KEY);

	$widget->getWidgetHandler(true)->updateFormElementValue(
		'label',
		Loc::getMessage('CRM_REPORT_SALES_COLUMN_FUNNEL_TITLE')
	);
	$widget->getWidgetHandler(true)->updateFormElementValue('shortMode', true);
	$widget->getWidgetHandler(true)->updateFormElementValue('calculateMode', ColumnFunnel::CLASSIC_CALCULATE_MODE);
	$widget->addConfigurations($widget->getWidgetHandler(true)->getConfigurations());

	$leadFunnel = new Report();
	$leadFunnel->setGId(Util::generateUserUniqueId());
	$leadFunnel->setReportClassName(Lead::getClassName());
	$leadFunnel->setWidget($widget);
	$leadFunnel->getReportHandler(true)->updateFormElementValue(
		'label',
		Loc::getMessage(
			'CRM_REPORT_SALES_COLUMN_FUNNEL_LEAD_COUNT_TITLE_1'
		)
	);
	$leadFunnel->getReportHandler(true)->updateFormElementValue('groupingBy', Lead::GROUPING_BY_STATE);
	$leadFunnel->getReportHandler(true)->updateFormElementValue('disableSuccessStates', true);
	$leadFunnel->getReportHandler(true)->updateFormElementValue('calculate', Lead::WHAT_WILL_CALCULATE_LEAD_DATA_FOR_FUNNEL);
	$leadFunnel->addConfigurations($leadFunnel->getReportHandler(true)->getConfigurations());
	$widget->addReports($leadFunnel);


	$successLeadData = new Report();
	$successLeadData->setGId(Util::generateUserUniqueId());
	$successLeadData->setReportClassName(Lead::getClassName());
	$successLeadData->setWidget($widget);
	$successLeadData->getReportHandler(true)->updateFormElementValue(
		'label',
		Loc::getMessage(
			'CRM_REPORT_SALES_COLUMN_FUNNEL_SUCCESS_LEAD_TITLE_1'
		)
	);
	$successLeadData->getReportHandler(true)->updateFormElementValue('groupingBy', Lead::GROUPING_BY_STATE);
	$successLeadData->getReportHandler(true)->updateFormElementValue('shortMode', true);
	$successLeadData->getReportHandler(true)->updateFormElementValue('calculate', Lead::WHAT_WILL_CALCULATE_SUCCESS_LEAD_DATA_FOR_FUNNEL);
	$successLeadData->addConfigurations($successLeadData->getReportHandler(true)->getConfigurations());
	$widget->addReports($successLeadData);

	return $widget;
}