CAllCrmActivity::RefreshCalendarBindings

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CAllCrmActivity
  4. RefreshCalendarBindings
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_activity.php
  • Класс: \CAllCrmActivity
  • Вызов: CAllCrmActivity::RefreshCalendarBindings
static function RefreshCalendarBindings()
{
	if (!(IsModuleInstalled('calendar') && CModule::IncludeModule('calendar')))
	{
		return false;
	}

	global $DB;
	$dbResult = $DB->Query(
		'SELECT OWNER_ID, OWNER_TYPE_ID, ASSOCIATED_ENTITY_ID FROM '.CCrmActivity::TABLE_NAME.' WHERE OWNER_ID > 0 AND OWNER_TYPE_ID > 0 AND ASSOCIATED_ENTITY_ID > 0 AND TYPE_ID IN ('.CCrmActivityType::Call.', '.CCrmActivityType::Meeting.')',
		false,
		'File: '.__FILE__.'
Line: '.__LINE__ ); if(!$dbResult) { return false; } while($arResult = $dbResult->Fetch()) { $ownerID = intval($arResult['OWNER_ID']); $ownerTypeID = intval($arResult['OWNER_TYPE_ID']); $assocEntityID = intval($arResult['ASSOCIATED_ENTITY_ID']); if($ownerID > 0 && $ownerTypeID > 0 && $assocEntityID > 0) { CCalendarEvent::UpdateUserFields( $assocEntityID, [ 'UF_CRM_CAL_EVENT' => [ Crm\UserField\Types\ElementType::getValueByIdentifier(new Crm\ItemIdentifier( $ownerTypeID, $ownerID, )), ] ] ); } } return true; }

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