Exemple #1
0
 function UpdateHistory($ID, $IBLOCK_ID, $modifyComment = false)
 {
     global $USER;
     $rIBlock = CIBlock::getList(array(), array('ID' => $IBLOCK_ID, 'CHECK_PERMISSIONS' => 'N'));
     $arIBlock = $rIBlock->GetNext();
     // add changes history
     if ($arIBlock['BIZPROC'] == 'Y' && CModule::IncludeModule('bizproc')) {
         $cRuntime = CBPRuntime::GetRuntime();
         $cRuntime->StartRuntime();
         $documentService = $cRuntime->GetService('DocumentService');
         $historyIndex = CBPHistoryService::Add(array('DOCUMENT_ID' => array('iblock', 'CWikiDocument', $ID), 'NAME' => 'New', 'DOCUMENT' => null, 'USER_ID' => $USER->GetID()));
         $arDocument = $documentService->GetDocumentForHistory(array('iblock', 'CWikiDocument', $ID), $historyIndex);
         $arDocument["MODIFY_COMMENT"] = $modifyComment ? $modifyComment : '';
         if (is_array($arDocument)) {
             CBPHistoryService::Update($historyIndex, array('NAME' => $arDocument['NAME'], 'DOCUMENT' => $arDocument));
         }
         return true;
     }
     return false;
 }