Пример #1
0
             if (CBPDocument::CanUserOperateDocument(CBPWebDavCanUserOperateOperation::DeleteDocument, $GLOBALS["USER"]->GetID(), $arParams["DOCUMENT_ID"], array("UserGroups" => $GLOBALS["USER"]->GetUserGroupArray()))) {
                 CBPHistoryService::Delete($ID, $arParams["DOCUMENT_ID"]);
             } else {
                 $arError[] = array("id" => "access_denied", "text" => GetMessage("BPADH_NO_PERMS"));
             }
         } else {
             CBPHistoryService::Delete($ID, $arParams["DOCUMENT_ID"]);
         }
         break;
     case "recover":
         if ($arParams["MODULE_ID"] == "webdav" && isset($arParams["OBJECT"])) {
             $arParams['OBJECT']->IsDir(array('element_id' => $arParams["DOCUMENT_ID"][2]));
             if (($arParams["OBJECT"]->workflow == 'bizproc' || $arParams["OBJECT"]->workflow == 'bizproc_limited') && $arParams['OBJECT']->arParams['not_found'] == false) {
                 CBPDocument::AddDocumentToHistory($arParams['DOCUMENT_ID'], $arParams['OBJECT']->arParams["element_name"], $GLOBALS["USER"]->GetID());
                 if (method_exists('CIBlockDocumentWebdav', 'TruncateHistory')) {
                     CIBlockDocumentWebdav::TruncateHistory($arParams['OBJECT']->wfParams['DOCUMENT_TYPE'], $arParams["DOCUMENT_ID"][2]);
                 }
             }
         }
         try {
             if (!CBPHistoryService::RecoverDocumentFromHistory($ID)) {
                 $arError[] = array("id" => "not recover", "text" => GetMessage("BPADH_RECOVERY_ERROR"));
             }
         } catch (Exception $e) {
             $arError[] = array("id" => "not recover", "text" => $e->getMessage());
         }
         break;
 }
 if (!empty($arError)) {
     $e = new CAdminException($arError);
     $arResult["ERROR_MESSAGE"] = $e->GetString();
Пример #2
0
 public static function OnAddToHistory($arParams)
 {
     $docType = $arParams['DOCUMENT_ID'];
     if (!($docType[0] === 'webdav' && strpos($docType[1], "Webdav") !== false)) {
         return;
     }
     CIBlockDocumentWebdav::TruncateHistory($docType, $docType[2]);
 }