• Модуль: rpa
  • Путь к файлу: ~/bitrix/modules/rpa/lib/command.php
  • Класс: BitrixRpaCommand
  • Вызов: Command::checkFields
public function checkFields(): Result
{
	$result = new Result();

	if(
		$this->item->isChanged('STAGE_ID')
		&& $this->item->getMovedBy() === $this->userId
		&& $this->item->getPreviousStageId() === $this->item->getStageId()
	)
	{
		//skip checking fields if moving back
		return $result;
	}
	$currentStageId = $this->item->remindActualStageId() ?? $this->item->getStageId();
	if (!$currentStageId && $this->item->getId() <= 0)
	{
		$firstStage = $this->item->getType()->getFirstStage();
		if ($firstStage)
		{
			$currentStageId = $firstStage->getId();
		}
	}

	if (!$currentStageId)
	{
		return $result->addError(new Error('Stage is not found'));
	}

	$stage = $this->item->getType()->getStage($currentStageId);
	/** @noinspection NullPointerExceptionInspection */
	$userFields = $stage->getUserFieldCollection();
	$this->resetNotEditableFields($userFields);
	if($this->item->isChanged('STAGE_ID'))
	{
		$result = $this->checkRequiredFields($userFields);
	}

	return $result;
}