<?php
// CBPRestActivity :: GetPropertiesDialogValues()
// /dist/bitrix/modules/bizproc/classes/general/restactivity.php:555
public static function GetPropertiesDialogValues($documentType, $activityName, &$workflowTemplate, &$workflowParameters, &$workflowVariables, $currentValues, &$errors)
{
$runtime = CBPRuntime::GetRuntime();
$errors = array();
$map = array(
'setstatusmessage' => 'SetStatusMessage',
'statusmessage' => 'StatusMessage',
'usesubscription' => 'UseSubscription',
'timeoutduration' => 'TimeoutDuration',
'timeoutdurationtype' => 'TimeoutDurationType'
);
$properties = array();
foreach ($map as $key => $value)
{
$properties[$value] = $currentValues[$key];
}
$activityData = self::getRestActivityData();
$activityProperties = isset($activityData['PROPERTIES']) && is_array($activityData['PROPERTIES']) ? $activityData['PROPERTIES'] : array();
/** @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.strtolower($name);
if (isset($properties[$requestName]))
continue;
$errors = array();
$properties[$name] = $documentService->GetFieldInputValue(
$activityDocumentType,
$property,
$requestName,
$currentValues,
$errors
);
if (count($errors) > 0)
return false;
}
if (static::checkAdminPermissions())
{
$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;
}