44 $availableRobots = \Bitrix\Bizproc\Automation\Engine\Template::getAvailableRobots($documentType);
46 'responsibleLabel' =>
'',
47 'responsibleUrl' =>
'',
52 $type = mb_strtolower($robot[
'Type']);
53 if (isset($availableRobots[$type][
'ROBOT_SETTINGS']))
55 $settings = $availableRobots[$type][
'ROBOT_SETTINGS'];
57 if (!empty($settings[
'RESPONSIBLE_TO_HEAD']) && $robot[
'Properties'][$settings[
'RESPONSIBLE_TO_HEAD']] ===
'Y')
59 $result[
'responsibleLabel'] =
Loc::getMessage(
'BIZPROC_AUTOMATION_COMPONENT_BASE_TO_HEAD');
62 if (isset($settings[
'RESPONSIBLE_PROPERTY']))
64 $users = static::getUsersFromResponsibleProperty($robot, $settings[
'RESPONSIBLE_PROPERTY']);
65 $usersLabel = \CBPHelper::UsersArrayToString($users, [], $documentType,
false);
67 if ($result[
'responsibleLabel'] && $usersLabel)
69 $result[
'responsibleLabel'] .=
', ';
71 $result[
'responsibleLabel'] .= $usersLabel;
73 if ($users && count($users) === 1 && $users[0] && mb_strpos($users[0],
'user_') === 0)
75 $id = (int) \CBPHelper::StripUserPrefix($users[0]);
76 $result[
'responsibleUrl'] = \CComponentEngine::MakePathFromTemplate(
77 '/company/personal/user/#user_id#/',
78 array(
'user_id' => $id)
80 $result[
'responsibleId'] = $id;
84 elseif (!isset($availableRobots[$type]))
86 $result[
'isInvalid'] =
true;