• Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/lib/Debugger/Listener.php
  • Класс: BitrixBizprocDebuggerListener
  • Вызов: Listener::onDocumentUpdated
public function onDocumentUpdated(array $changedFields)
{
	$documentId = SessionManager::getActiveSession()->getFixedDocument()->getParameterDocumentId();
	$documentType = SessionManager::getActiveSession()->getParameterDocumentType();

	$documentService = CBPRuntime::GetRuntime(true)->getDocumentService();
	$documentFields = $documentService->getDocumentFields($documentType);
	$lazyList = $documentService->GetDocument($documentId);

	$rawValues = [];
	$values = [];
	$changedFields[] = 'DATE_MODIFY';

	//TODO - temporary
	if (in_array('ASSIGNED_BY_ID', $changedFields))
	{
		$changedFields[] = 'ASSIGNED_BY_EMAIL';
		$changedFields[] = 'ASSIGNED_BY_WORK_PHONE';
		$changedFields[] = 'ASSIGNED_BY_PERSONAL_MOBILE';
	}

	foreach ($changedFields as $fieldId)
	{
		$property = $documentFields[$fieldId] ?? null;

		if (!$property)
		{
			continue;
		}

		$fieldType = $documentService->getFieldTypeObject($documentType, $property);

		if (!$fieldType)
		{
			continue;
		}

		$fieldType->setDocumentId($documentId);

		$rawValues[$fieldId] = $lazyList[$fieldId];
		$values[$fieldId] = $fieldType->formatValue($rawValues[$fieldId]);
	}

	$this->pushEvent(
		'documentValues',
		[
			'values' => $values,
			'rawValues' => $rawValues,
		]
	);
}