CCrmActivityConverter::ConvertCalEvents

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmActivityConverter
  4. ConvertCalEvents
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_activity_converter.php
  • Класс: \CCrmActivityConverter
  • Вызов: CCrmActivityConverter::ConvertCalEvents
static function ConvertCalEvents($checkPerms = true, $regEvent = true)
{
	if(!(IsModuleInstalled('calendar') && CModule::IncludeModule('calendar')))
	{
		return 0;
	}

	$arEvents = CCalendarEvent::GetList(
		array(
			'arFilter' => array(
				'!UF_CRM_CAL_EVENT' => null,
				'DELETED' => 'N'
			),
			'getUserfields' => true
		)
	);

	$total = 0;
	foreach($arEvents as $arEvent)
	{
		$eventID = $arEvent['ID'];
		$count = CCrmActivity::GetCount(array('=CALENDAR_EVENT_ID' => $eventID));

		if($count === 0
			&& CCrmActivity::CreateFromCalendarEvent($eventID, $arEvent, $checkPerms, $regEvent) > 0)
		{
			$total++;
		}
	}
	return $total;
}

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