CAllCrmActivity::SaveBindings

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CAllCrmActivity
  4. SaveBindings
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_activity.php
  • Класс: \CAllCrmActivity
  • Вызов: CAllCrmActivity::SaveBindings
static function SaveBindings($ID, $arBindings, $registerEvents = true, $checkPerms = true, $registerBindingsChanges = true)
{
	$result = array();
	foreach($arBindings as $arBinding)
	{
		$ownerID =  isset($arBinding['OWNER_ID']) ? (int)$arBinding['OWNER_ID'] : 0;
		$ownerTypeID =  isset($arBinding['OWNER_TYPE_ID']) ? (int)$arBinding['OWNER_TYPE_ID'] : 0;

		if($ownerID > 0 && CCrmOwnerType::IsDefined($ownerTypeID))
		{
			$key = "{$ownerTypeID}_{$ownerID}";
			if(!isset($result[$key]))
			{
				$arBinding['ACTIVITY_ID'] = $ID;
				$result[$key] = $arBinding;
			}
		}
	}

	$effectiveBindings = array_values($result);
	CCrmActivity::DoSaveBindings($ID, $effectiveBindings, $registerBindingsChanges);
	Crm\Timeline\ActivityController::synchronizeBindings($ID, $effectiveBindings);
}

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