• Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/lib/activity/baseactivity.php
  • Класс: BitrixBizprocActivityBaseActivity
  • Вызов: BaseActivity::extractPropertiesValues
static function extractPropertiesValues(PropertiesDialog $dialog, array $fieldsMap): Result
{
	$result = new Result();

	$properties = [];
	$errors = [];
	$currentValues = $dialog->getCurrentValues();
	$documentService = static::getDocumentService();

	foreach ($fieldsMap as $propertyKey => $fieldProperties)
	{
		$field = $documentService->getFieldTypeObject($dialog->getDocumentType(), $fieldProperties);
		if(!$field)
		{
			continue;
		}

		$properties[$propertyKey] = $field->extractValue(
			['Field' => $fieldProperties['FieldName']],
			$currentValues,
			$errors
		);
	}

	if ($errors)
	{
		foreach ($errors as $error)
		{
			$result->addError(
				new Error(
					$error['message'] ?? '',
					$error['code'] ?? '',
					$error['parameter'] ?? ''
				)
			);
		}
	}
	else
	{
		$result->setData($properties);
	}

	return $result;
}