CBPDocument :: MigrateDocumentType: Bitrix method

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

    
public static function MigrateDocumentType($oldType$newType)
    {
        
$templateIds = array();
        
$db CBPWorkflowTemplateLoader::GetList(array(), array("DOCUMENT_TYPE" => $oldType), falsefalse, array("ID"));
        while (
$ar $db->Fetch())
            
$templateIds[] = $ar["ID"];

        foreach (
$templateIds as $id)
            
CBPWorkflowTemplateLoader::Update($id, array("DOCUMENT_TYPE" => $newType));

        if (
count($templateIds) > 0)
        {
            
CBPHistoryService::MigrateDocumentType($oldType$newType$templateIds);
            
CBPStateService::MigrateDocumentType($oldType$newType$templateIds);
            
WorkflowInstanceTable::migrateDocumentType($oldType$newType$templateIds);
        }
    }