- Модуль: bizproc
- Путь к файлу: ~/bitrix/modules/bizproc/classes/general/restactivity.php
- Класс: CBPRestActivity
- Вызов: CBPRestActivity::getPropertiesDialogValues
static function getPropertiesDialogValues(
$documentType,
$activityName,
&$workflowTemplate,
&$workflowParameters,
&$workflowVariables,
$currentValues,
&$errors
)
{
$runtime = CBPRuntime::GetRuntime();
$errors = [];
$map = [
'setstatusmessage' => 'SetStatusMessage',
'statusmessage' => 'StatusMessage',
'usesubscription' => 'UseSubscription',
'timeoutduration' => 'TimeoutDuration',
'timeoutdurationtype' => 'TimeoutDurationType',
];
$properties = [];
foreach ($map as $key => $value)
{
$properties[$value] = $currentValues[$key] ?? null;
}
$activityData = self::getRestActivityData();
$activityProperties = isset($activityData['PROPERTIES']) && is_array($activityData['PROPERTIES']) ? $activityData['PROPERTIES'] : [];
/** @var CBPDocumentService $documentService */
$documentService = $runtime->GetService('DocumentService');
$activityDocumentType = is_array($activityData['DOCUMENT_TYPE']) ? $activityData['DOCUMENT_TYPE'] : $documentType;
foreach ($activityProperties as $name => $property)
{
$requestName = static::PROPERTY_NAME_PREFIX . mb_strtolower($name);
if (isset($properties[$requestName]))
{
continue;
}
$errors = [];
$properties[$name] = $documentService->GetFieldInputValue(
$activityDocumentType,
$property,
$requestName,
$currentValues,
$errors
);
if (count($errors) > 0)
{
return false;
}
}
if (static::checkAdminPermissions() && isset($currentValues['authuserid']))
{
$properties['AuthUserId'] = CBPHelper::usersStringToArray(
$currentValues['authuserid'],
$documentType,
$errors
);
if (count($errors) > 0)
{
return false;
}
}
else
{
unset($properties['AuthUserId']);
}
if (!empty($activityData['USE_SUBSCRIPTION']))
{
$properties['UseSubscription'] = $activityData['USE_SUBSCRIPTION'];
}
$errors = self::ValidateProperties(
$properties,
new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser)
);
if (count($errors) > 0)
{
return false;
}
$currentActivity = &CBPWorkflowTemplateLoader::FindActivityByName($workflowTemplate, $activityName);
$currentActivity["Properties"] = $properties;
return true;
}