17 parent::__construct($component);
24 return $this->errorCollection->toArray();
29 return $this->errorCollection->getErrorByCode($code);
34 foreach ($template[
'ROBOTS'] as $i => $robot)
36 $template[
'ROBOTS'][$i][
'viewData'] = static::getRobotViewData($robot, $documentType);
44 $availableRobots = \Bitrix\Bizproc\Automation\Engine\Template::getAvailableRobots($documentType);
46 'responsibleLabel' =>
'',
47 'responsibleUrl' =>
'',
51 $type = mb_strtolower($robot[
'Type']);
52 if (isset($availableRobots[$type]) && isset($availableRobots[$type][
'ROBOT_SETTINGS']))
54 $settings = $availableRobots[$type][
'ROBOT_SETTINGS'];
56 if (!empty($settings[
'RESPONSIBLE_TO_HEAD']) && $robot[
'Properties'][$settings[
'RESPONSIBLE_TO_HEAD']] ===
'Y')
58 $result[
'responsibleLabel'] =
Loc::getMessage(
'BIZPROC_AUTOMATION_COMPONENT_BASE_TO_HEAD');
61 if (isset($settings[
'RESPONSIBLE_PROPERTY']))
63 $users = static::getUsersFromResponsibleProperty($robot, $settings[
'RESPONSIBLE_PROPERTY']);
64 $usersLabel = \CBPHelper::UsersArrayToString($users, [], $documentType,
false);
66 if ($result[
'responsibleLabel'] && $usersLabel)
68 $result[
'responsibleLabel'] .=
', ';
70 $result[
'responsibleLabel'] .= $usersLabel;
72 if ($users && count($users) === 1 && $users[0] && mb_strpos($users[0],
'user_') === 0)
74 $id = (int) \CBPHelper::StripUserPrefix($users[0]);
75 $result[
'responsibleUrl'] = \CComponentEngine::MakePathFromTemplate(
76 '/company/personal/user/#user_id#/',
77 array(
'user_id' => $id)
79 $result[
'responsibleId'] = $id;
90 $props = $robot[
'Properties'];
91 $path = explode(
'.', $propertyName);
93 foreach ($path as $chain)
95 $value = ($props && is_array($props) && isset($props[$chain])) ? $props[$chain] :
null;
99 return $value ? (array)$value :
null;
__construct($component=null)
static getTemplateViewData(array $template, $documentType)
static getUsersFromResponsibleProperty(array $robot, $propertyName)
static getRobotViewData($robot, array $documentType)
static getMessage($code, $replace=null, $language=null)