• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/webform/internals/limitation.php
  • Класс: Bitrix\Crm\WebForm\Internals\LimitationTable
  • Вызов: LimitationTable::incrementByValue
static function incrementByValue(string $code, string $type, int $value): Main\Result
{
	$result = new Main\Result();

	$current = self::getCurrent($code, $type);
	if (empty($current))
	{
		return self::add([
			'fields' => [
				'DATE_STAT' => new Type\Date,
				'CODE' => $code,
				'TYPE' => $type,
				'VALUE' => $value
			]
		]);
	}

	return self::update($current['ID'], [
		'fields' => [
			'VALUE' => (int) $current['VALUE'] + $value,
			'DATE_STAT' => $current['DATE_STAT'],
		]
	]);
}