• Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/lib/activity/propertiesdialog.php
  • Класс: BitrixBizprocActivityPropertiesDialog
  • Вызов: PropertiesDialog::getCurrentValues
public function getCurrentValues($compatible = false)
{
	$workflowTemplate = $this->getWorkflowTemplate();
	if (!is_array($this->currentValues))
	{
		// Get current values from saved activity properties.
		$this->currentValues = array();
		$currentActivity = CBPWorkflowTemplateLoader::findActivityByName(
			$workflowTemplate,
			$this->getActivityName()
		);

		if (is_array($currentActivity) && isset($currentActivity['Properties']) && is_array($currentActivity['Properties']))
		{
			$map = $this->getMap();
			foreach ($map as $id => $property)
			{
				if (!isset($property['FieldName']))
					continue;

				$this->currentValues[$property['FieldName']] = null;

				if (isset($currentActivity['Properties'][$id]))
				{
					if (
						isset($property['Getter'])
						&& is_callable($property['Getter'])
						&& $property['Getter'] instanceof Closure
					)
					{
						$getter = $property['Getter'];
						$property['Id'] = $id;
						$this->currentValues[$property['FieldName']] = $getter($this, $property, $currentActivity, $compatible);
					}
					else
					{
						$this->currentValues[$property['FieldName']] = $currentActivity['Properties'][$id];
					}
				}

				if (
					(
						$this->currentValues[$property['FieldName']] === null
						||
						$this->currentValues[$property['FieldName']] === ''
					)
					&& isset($property['Default'])
				)
				{
					$this->currentValues[$property['FieldName']] = $property['Default'];
				}
			}
		}
	}

	if ($compatible && $this->currentValues)
	{
		$compatibleValues = $this->currentValues;

		foreach ($this->getMap() as $id => $property)
		{
			if (!isset($property['FieldName']))
			{
				continue;
			}

			if (isset($property['Type']) && $property['Type'] === FieldType::USER && !isset($property['Getter']))
			{
				$compatibleValues[$property['FieldName']] = CBPHelper::usersArrayToString(
					$compatibleValues[$property['FieldName']],
					$workflowTemplate,
					$this->getDocumentType()
				);
			}
		}

		return $compatibleValues;
	}

	return $this->currentValues;
}