Example #1
0
 public 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);
     }
 }