ConditionGroup::createBizprocActivity: Bitrix method

      
<?php 
//  Bitrix\Bizproc\Automation\Engine\ConditionGroup :: createBizprocActivity()
//  /dist/bitrix/modules/bizproc/lib/automation/engine/conditiongroup.php:173

    
public function createBizprocActivity(array $childActivity, array $documentType)
    {
        
$title Loc::getMessage('BIZPROC_AUTOMATION_CONDITION_TITLE');
        
$fieldCondition = [];
        
$bizprocJoiner 0;

        
$documentService = \CBPRuntime::GetRuntime(true)->getDocumentService();
        
$documentFields $documentService->GetDocumentFields($documentType);

        
/** @var Condition $condition */
        
foreach ($this->getItems() as list($condition$joiner))
        {
            
$field $condition->getField();
            
$value $condition->getValue();
            
$property = isset($documentFields[$field]) ? $documentFields[$field] : null;
            if (
$property && !in_array($condition->getOperator(), ['empty''!empty']))
            {
                
$valueInternal $documentService->GetFieldInputValue(
                    
$documentType,
                    
$property,
                    
'field',
                    [
'field' => $value],
                    
$errors
                
);

                if (!
$errors)
                {
                    
$value $valueInternal;
                }
            }

            
$fieldCondition[] = [
                
$field,
                
$condition->getOperator(),
                
self::unConvertExpressions($value$documentType),
                
$bizprocJoiner
            
];
            
$bizprocJoiner = ($joiner === static::JOINER_OR) ? 0;
        }

        
$activity = array(
            
'Type' => 'IfElseActivity',
            
'Name' => Robot::generateName(),
            
'Properties' => array('Title' => $title),
            
'Children' => array(
                array(
                    
'Type' => 'IfElseBranchActivity',
                    
'Name' => Robot::generateName(),
                    
'Properties' => array(
                        
'Title' => $title,
                        
'fieldcondition' => $fieldCondition
                    
),
                    
'Children' => array($childActivity)
                ),
                array(
                    
'Type' => 'IfElseBranchActivity',
                    
'Name' => Robot::generateName(),
                    
'Properties' => array(
                        
'Title' => $title,
                        
'truecondition' => '1',
                    ),
                    
'Children' => array()
                )
            )
        );

        return 
$activity;
    }