Product::checkFields

  1. Bitrix24 API (v. 23.675.0)
  2. catalog
  3. Product
  4. checkFields
  • Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/controller/product.php
  • Класс: BitrixCatalogControllerProduct
  • Вызов: Product::checkFields
protected function checkFields($fields)
{
	$r = new Result();

	if (isset($fields['SECTION_ID']))
	{
		$section = CIBlockSection::GetByID($fields['SECTION_ID'])->Fetch();
		if (!isset($section['ID']))
		{
			$r->addError(new Error('Section is not exists'));
		}
	}
	if (isset($fields['MODIFIED_BY']))
	{
		$user = CUser::GetByID($fields['MODIFIED_BY'])->Fetch();
		if (!isset($user['ID']))
		{
			$r->addError(new Error('User modifiedBy is not exists'));
		}
	}
	if (isset($fields['CREATED_BY']))
	{
		$user = CUser::GetByID($fields['CREATED_BY'])->Fetch();
		if (!isset($user['ID']))
		{
			$r->addError(new Error('User createdBy is not exists'));
		}
	}
	if (isset($fields['PURCHASING_CURRENCY']))
	{
		$currency = CCurrency::GetByID($fields['PURCHASING_CURRENCY']);
		if (!isset($currency['CURRENCY']))
		{
			$r->addError(new Error('Currency purchasingCurrency is not exists'));
		}
	}
	if (isset($fields['VAT_ID']))
	{
		$user = CCatalogVat::GetByID($fields['VAT_ID'])->Fetch();
		if (!isset($user['ID']))
		{
			$r->addError(new Error('VAT vatId is not exists'));
		}
	}

	return $r;
}

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