FormCounterTable::incEntityCounters

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. FormCounterTable
  4. incEntityCounters
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/webform/internals/formcounter.php
  • Класс: Bitrix\Crm\WebForm\Internals\FormCounterTable
  • Вызов: FormCounterTable::incEntityCounters
static function incEntityCounters($formId, array $counters)
{
	$fieldsMap = static::getMap();
	$entityFieldPrefix = static::getEntityFieldPrefix();

	$map = [
		\CCrmOwnerType::OrderName => \CCrmOwnerType::InvoiceName
	];
	$fields = array();
	foreach($counters as $counterName)
	{
		$counterName = $map[$counterName] ?? $counterName;
		if (\CCrmOwnerType::isUseDynamicTypeBasedApproach(\CCrmOwnerType::resolveID($counterName)))
		{
			$counterName = 'DYNAMIC';
		}

		$fieldName = $entityFieldPrefix . $counterName;
		if(!isset($fieldsMap[$fieldName]))
		{
			continue;
		}

		$fields[] = $fieldName;
	}

	$isSuccess = true;
	if(count($fields) > 0)
	{
		$isSuccess = static::incCounters($formId, $fields);
	}

	return $isSuccess;
}

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