• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/controller/propertygroups.php
  • Класс: BitrixSaleControllerPropertyGroups
  • Вызов: PropertyGroups::addAction
public function addAction(array $fields)
{
	global $APPLICATION;

	$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'), 'PERSON_TYPE_ID_FIELD_EMPTY'));
	if(trim($fields['NAME'])=='')
		$r->addError(new Error(Loc::getMessage('CONTROLLER_ERROR_PERSON_TYPE_ID_FIELD_EMPTY'), 'NAME_FIELD_EMPTY'));

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

	if(!$r->isSuccess())
	{
		$this->addErrors($r->getErrors());
		return null;
	}
	else
		return ['PROPERTY_GROUP'=>$this->get($propertyGroupId)];


}