Number::createNumeratorTemplateIfNotExists

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. Number
  4. createNumeratorTemplateIfNotExists
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Field/Number.php
  • Класс: Bitrix\Crm\Field\Number
  • Вызов: Number::createNumeratorTemplateIfNotExists
protected function createNumeratorTemplateIfNotExists(string $numeratorType, $maxLastId = null): ?Numerator\Numerator
{
	if ($this->numerator)
	{
		return $this->numerator;
	}

	$this->numerator = Numerator\Numerator::create();
	$this->numerator->setConfig([
		Numerator\Numerator::getType() =>
			[
				'name' => $this->getName(),
				'template' => '{NUMBER}',
				'type' => $numeratorType,
			],
		Numerator\Generator\SequentNumberGenerator::getType() =>
			[
				'start' => (int)$maxLastId,
				'isDirectNumeration' => true,
			],
	]);
	$this->numerator->save();

	return $this->numerator;
}

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