function AddDocumentToHistory($docID, $fileName) { global $USER; $documentId = $this->wfParams["DOCUMENT_TYPE"]; $documentId[2] = $docID; $userID = $USER->GetID(); $rDoc = CIBlockElement::GetList(array(), array('ID' => $docID), false, false, array('MODIFIED_BY')); if ($rDoc && ($arDoc = $rDoc->Fetch())) { $userID = $arDoc['MODIFIED_BY']; } $historyDoc = CWebdavDocumentHistory::IsHistoryUpdate($documentId); $historyIndex = false; if ($historyDoc) { $historyIndex = CWebdavDocumentHistory::UpdateDocumentHistory($documentId, $historyDoc['ID']); } else { $historyIndex = CBPDocument::AddDocumentToHistory($documentId, $fileName, $userID); } return $historyIndex; }