• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/controller/propertygroup.php
  • Класс: BitrixSaleControllerPropertyGroup
  • Вызов: PropertyGroup::addAction
public function addAction(array $fields)
{
	$r = new Result();

	$propertyGroupId = 0;
	$orderPropsGroup = new CSaleOrderPropsGroup();

	if((int)$fields['PERSON_TYPE_ID']<=0)
		$r->addError(new Error(Loc::getMessage('CONTROLLER_ERROR_PERSON_TYPE_ID_FIELD_EMPTY'), 200950000001));
	if(trim($fields['NAME'])=='')
		$r->addError(new Error(Loc::getMessage('CONTROLLER_ERROR_PERSON_TYPE_ID_FIELD_EMPTY'), 200950000002));

	if($r->isSuccess())
	{
		$propertyGroupId = $orderPropsGroup->Add($fields);
		if ((int)$propertyGroupId <= 0)
		{
			if ($ex = self::getApplication()->GetException())
			{
				$r->addError(new Error($ex->GetString(), $ex->GetID()));
			}
			else
			{
				$r->addError(new Error(Loc::getMessage('CONTROLLER_ERROR_ADD_PROPS_GROUP'), 200950000003));
			}
		}
	}

	if(!$r->isSuccess())
	{
		foreach ($r->getErrors() as $error)
		{
			$this->addError(new Error($error->getMessage(), 200950000006));
		}
		return null;
	}
	else
		return ['PROPERTY_GROUP'=>$this->get($propertyGroupId)];
}