CBPActivityCondition::getConditionFieldInputValue

  1. Bitrix24 API (v. 23.675.0)
  2. bizproc
  3. CBPActivityCondition
  4. getConditionFieldInputValue
  • Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/classes/general/activitycondition.php
  • Класс: CBPActivityCondition
  • Вызов: CBPActivityCondition::getConditionFieldInputValue
static function getConditionFieldInputValue(string $operator, $parameterDocumentType, $property, $fieldName, $request): BitrixMainResult
{
	$documentService = CBPRuntime::getRuntime()->getDocumentService();

	$result = new BitrixMainResult();
	$isBetweenOperator = $operator === BitrixBizprocActivityOperatorBetweenOperator::getCode();

	$errors = [];
	$value =
		$isBetweenOperator
			? []
			: $documentService->getFieldInputValue($parameterDocumentType, $property, $fieldName, $request, $errors)
	;

	if ($isBetweenOperator)
	{
		$property['Multiple'] = false;

		$value1 = $documentService->getFieldInputValue(
			$parameterDocumentType,
			$property,
			$fieldName . '_greater_then',
			$request,
			$errors
		);

		$value2 = $documentService->getFieldInputValue(
			$parameterDocumentType,
			$property,
			$fieldName . '_less_then',
			$request,
			$errors
		);

		$value = [$value1 ?? '', $value2 ?? ''];
	}

	if (!empty($errors))
	{
		foreach ($errors as $error)
		{
			$result->addError(new BitrixMainError((string)$error['message'], (string)$error['code']));
		}
	}

	$result->setData(['value' => $value]);

	return $result;
}

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