• Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/classes/general/document.php
  • Класс: CBPDocument
  • Вызов: CBPDocument::migrateDocumentType
static function migrateDocumentType($oldType, $newType)
{
	$templateIds = array();
	$db = CBPWorkflowTemplateLoader::GetList(array(), array("DOCUMENT_TYPE" => $oldType), false, false, 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);
		BizprocWorkflowEntityWorkflowInstanceTable::migrateDocumentType($oldType, $newType, $templateIds);
	}
}