• Модуль: documentgenerator
  • Путь к файлу: ~/bitrix/modules/documentgenerator/lib/controller/numerator.php
  • Класс: BitrixDocumentGeneratorControllerNumerator
  • Вызов: Numerator::updateAction
public function updateAction(BitrixMainNumeratorNumerator $numerator, array $fields, CRestServer $restServer = null)
{
	$numeratorId = $this->getNumeratorId($numerator);
	if($restServer && !$this->checkAccess($numeratorId))
	{
		$this->errorCollection[] = new Error('Access denied', static::ERROR_ACCESS_DENIED);
		return null;
	}
	$typeConfig = ['type' => Driver::NUMERATOR_TYPE];
	if(isset($fields['name']))
	{
		$typeConfig['name'] = $fields['name'];
	}
	if(isset($fields['template']))
	{
		$typeConfig['template'] = $fields['template'];
	}
	if(!isset($fields['settings']) || !is_array($fields['settings']))
	{
		$fields['settings'] = [];
	}
	$config = array_merge($numerator->getConfig(), [
		$numerator::getType() => $typeConfig,
	], $fields['settings']);
	$numerator->setConfig($config);
	$saveResult = $numerator->save();
	if($saveResult->isSuccess())
	{
		return $this->prepareNumeratorConfig($numerator->getConfig());
	}
	else
	{
		$this->errorCollection = $saveResult->getErrorCollection();
		return null;
	}
}