CBPDocument :: GetWorkflowTemplatesForDocumentType: Bitrix method

      
<?php 
//  CBPDocument :: GetWorkflowTemplatesForDocumentType()
//  /dist/bitrix/modules/bizproc/classes/general/document.php:1126

    
public static function GetWorkflowTemplatesForDocumentType($documentType)
    {
        
$arResult = array();

        
$dbWorkflowTemplate CBPWorkflowTemplateLoader::GetList(
            array(),
            [
                
"DOCUMENT_TYPE" => $documentType,
                
"ACTIVE" => "Y",
                
'<AUTO_EXECUTE' => CBPDocumentEventType::Automation
            
],
            
false,
            
false,
            array(
"ID""NAME""DESCRIPTION""MODIFIED""USER_ID""AUTO_EXECUTE""USER_NAME""USER_LAST_NAME""USER_LOGIN""USER_SECOND_NAME"'PARAMETERS')
        );
        while (
$arWorkflowTemplate $dbWorkflowTemplate->GetNext())
        {
            
$arWorkflowTemplate["USER"] = "(".$arWorkflowTemplate["USER_LOGIN"].")".((strlen($arWorkflowTemplate["USER_NAME"]) > || strlen($arWorkflowTemplate["USER_LAST_NAME"]) > 0) ? " " "").CUser::FormatName(COption::GetOptionString("bizproc""name_template"CSite::GetNameFormat(false), SITE_ID), array("NAME" => $arWorkflowTemplate["USER_NAME"], "LAST_NAME" => $arWorkflowTemplate["USER_LAST_NAME"], "SECOND_NAME" => $arWorkflowTemplate["USER_SECOND_NAME"]), falsefalse);

            
$arWorkflowTemplate["AUTO_EXECUTE_TEXT"] = "";

            if (
$arWorkflowTemplate["AUTO_EXECUTE"] == CBPDocumentEventType::None)
                
$arWorkflowTemplate["AUTO_EXECUTE_TEXT"] .= GetMessage("BPCGDOC_AUTO_EXECUTE_NONE");

            if ((
$arWorkflowTemplate["AUTO_EXECUTE"] & CBPDocumentEventType::Create) != 0)
            {
                if (
strlen($arWorkflowTemplate["AUTO_EXECUTE_TEXT"]) > 0)
                    
$arWorkflowTemplate["AUTO_EXECUTE_TEXT"] .= ", ";
                
$arWorkflowTemplate["AUTO_EXECUTE_TEXT"] .= GetMessage("BPCGDOC_AUTO_EXECUTE_CREATE");
            }

            if ((
$arWorkflowTemplate["AUTO_EXECUTE"] & CBPDocumentEventType::Edit) != 0)
            {
                if (
strlen($arWorkflowTemplate["AUTO_EXECUTE_TEXT"]) > 0)
                    
$arWorkflowTemplate["AUTO_EXECUTE_TEXT"] .= ", ";
                
$arWorkflowTemplate["AUTO_EXECUTE_TEXT"] .= GetMessage("BPCGDOC_AUTO_EXECUTE_EDIT");
            }

            if ((
$arWorkflowTemplate["AUTO_EXECUTE"] & CBPDocumentEventType::Delete) != 0)
            {
                if (
strlen($arWorkflowTemplate["AUTO_EXECUTE_TEXT"]) > 0)
                    
$arWorkflowTemplate["AUTO_EXECUTE_TEXT"] .= ", ";
                
$arWorkflowTemplate["AUTO_EXECUTE_TEXT"] .= GetMessage("BPCGDOC_AUTO_EXECUTE_DELETE");
            }

            
$arWorkflowTemplate['HAS_PARAMETERS'] = count($arWorkflowTemplate['PARAMETERS']) > 0;

            
$arResult[] = $arWorkflowTemplate;
        }

        return 
$arResult;
    }