• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/entitypropertyvaluecollection.php
  • Класс: BitrixSaleEntityPropertyValueCollection
  • Вызов: EntityPropertyValueCollection::checkRequired
public function checkRequired(array $rules, array $fields)
{
	$result = new Result();

	/** @var EntityPropertyValue $propertyValue */
	foreach ($this->collection as $propertyValue)
	{
		if ($propertyValue->getField('ORDER_PROPS_ID') > 0)
		{
			$key = $propertyValue->getField('ORDER_PROPS_ID');
		}
		else
		{
			$key = "n".$propertyValue->getInternalIndex();
		}

		if (!in_array($key, $rules))
		{
			continue;
		}

		$value = isset($fields['PROPERTIES'][$key]) ? $fields['PROPERTIES'][$key] : null;
		if (!isset($fields['PROPERTIES'][$key]))
		{
			$value = $propertyValue->getValue();
		}

		$r = $propertyValue->checkRequiredValue($key, $value);
		if (!$r->isSuccess())
		{
			$result->addErrors($r->getErrors());
		}
	}

	return $result;
}