Template :: saveRobotSettings: Bitrix method

      
<?php 
//  Bitrix\Bizproc\Automation\Engine\Template :: saveRobotSettings()
//  /dist/bitrix/modules/bizproc/lib/automation/engine/template.php:143

    
public function saveRobotSettings(array $robot, array $request)
    {
        
$saveResult = new Result();
        
$documentType $this->getDocumentType();

        if (isset(
$robot['Properties']) && is_array($robot['Properties']))
        {
            
$robot['Properties'] = $this->unConvertRobotProperties($robot['Properties'], $documentType);
        }

        
$request $this->unConvertRobotProperties($request$documentType);

        
$copy = clone $this;
        
$copy->setRobots([$robot]);
        
$raw $copy->template['TEMPLATE'];

        
$robotErrors $v $p = array();
        
$result = \CBPActivity::callStaticMethod(
            
$robot['Type'],
            
"GetPropertiesDialogValues",
            [
                
$documentType,
                
$robot['Name'],
                &
$raw,
                &
$v,
                &
$p,
                
$request,
                &
$robotErrors
            
]
        );

        if (
$result)
        {
            
$templateActivity = \CBPWorkflowTemplateLoader::findActivityByName($raw$robot['Name']);

            
$robotTitle $robot['Properties']['Title'];
            
$robot['Properties'] = $templateActivity['Properties'];
            
$robot['Properties']['Title'] = $robotTitle;

            
$saveResult->setData(array('robot' => $robot));
        }
        else
        {
            foreach (
$robotErrors as $i => $error)
            {
                
$saveResult->addError(new Error($error['message']));
            }
        }

        return 
$saveResult;
    }