CCrmProductSectionRestProxy::processEvent

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmProductSectionRestProxy
  4. processEvent
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
  • Класс: \CCrmProductSectionRestProxy
  • Вызов: CCrmProductSectionRestProxy::processEvent
static function processEvent(array $arParams, array $arHandler)
{
	$eventName = $arHandler['EVENT_NAME'];
	switch(mb_strtolower($eventName))
	{
		case 'oncrmproductsectionadd':
		case 'oncrmproductsectionupdate':
		case 'oncrmproductsectiondelete':
			$fields = isset($arParams[0]) && is_array($arParams[0])? $arParams[0] : array();

			$id = isset($fields['ID'])? (int)$fields['ID'] : 0;
			if($id <= 0)
			{
				throw new RestException("Could not find entity ID in fields of event \"{$eventName}\"");
			}

			$iblockId = isset($fields['IBLOCK_ID'])? (int)$fields['IBLOCK_ID'] : 0;
			if($iblockId <= 0)
			{
				throw new RestException("Could not find IBLOCK_ID in fields of event \"{$eventName}\"");
			}

			if($iblockId !== CCrmCatalog::GetDefaultID())
			{
				throw new RestException("Outside CRM product property event is detected");
			}
			return array('FIELDS' => array('ID' => $id));

			break;
		default:
			throw new RestException("The Event \"{$eventName}\" is not supported in current context");
	}
}

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