CAllCrmCatalog::CheckFields

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CAllCrmCatalog
  4. CheckFields
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_catalog.php
  • Класс: \CAllCrmCatalog
  • Вызов: CAllCrmCatalog::CheckFields
static function CheckFields($sAction, &$arFields, $ID)
{
	self::$LAST_ERROR = '';

	if($sAction == 'ADD')
	{
		if (!isset($arFields['ID']))
		{
			self::RegisterError('Could not find ID.');
			return false;
		}


		$iblockID = intval($arFields['ID']);
		if($iblockID <= 0)
		{
			self::RegisterError('ID that is treated as a IBLOCK_ID is invalid.');
			return false;
		}

		if (intval(CIBlock::GetArrayByID($iblockID, 'ID')) !== $iblockID)
		{
			self::RegisterError(sprintf('Could not find IBlock(ID = %d).', $iblockID));
			return false;
		}
	}
	else//if($sAction == 'UPDATE')
	{
		if(!self::Exists($ID))
		{
			self::RegisterError(sprintf('Could not find CrmCatalog(ID = %d).', $ID));
			return false;
		}
	}

	return true;
}

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