function _delete_section($sectionID) { static $onDeleteEventSet = false; $result = true; if ($onDeleteEventSet == false && ($this->workflow == 'bizproc' || $this->workflow == 'bizproc_limited')) { AddEventHandler("iblock", "OnBeforeIBlockElementDelete", array($this, "_onDeleteElement")); AddEventHandler("iblock", "OnBeforeIBlockSectionDelete", array($this, "_onDeleteSection")); } $arSections = array(); $sectionID = intval($sectionID); $s = CIBlockSection::GetList(array(), array("ID" => $sectionID, 'CHECK_PERMISSIONS' => 'N'), false, array('ID', 'NAME', 'LEFT_MARGIN', 'RIGHT_MARGIN', 'DEPTH_LEVEL', 'IBLOCK_ID')); if ($arParentSection = $s->Fetch()) { CWebDavSymlinkHelper::setSectionOriginalName($sectionID, $arParentSection['NAME']); if (!$this->GetPermission('SECTION', $sectionID, 'section_delete', false)) { $result = GetMessage('WD_ERR_DELETE_FOLDER_NO_PERMS', array('ID' => $sectionID, 'NAME' => "")); } else { $arSections[] = $sectionID; $rSection = CIBlockSection::GetList(array('LEFT_MARGIN' => 'DESC'), array('CHECK_PERMISSIONS' => 'N', 'IBLOCK_ID' => $arParentSection['IBLOCK_ID'], '>LEFT_MARGIN' => $arParentSection['LEFT_MARGIN'], '<RIGHT_MARGIN' => $arParentSection['RIGHT_MARGIN'], '>DEPTH_LEVEL' => $arParentSection['DEPTH_LEVEL']), false, array('ID', 'NAME')); if ($rSection) { while ($arSection = $rSection->Fetch()) { if (!$this->GetPermission('SECTION', $arSection['ID'], 'section_delete')) { $result = GetMessage('WD_ERR_DELETE_FOLDER_NO_PERMS', array('ID' => $arSection['ID'], 'NAME' => htmlspecialcharsbx($arSection['NAME']))); break; } else { $arSections[] = $arSection['ID']; } } } } if ($result === true) { $se = new CIBlockSection(); if (!$se->Delete($arParentSection['ID'], false)) { $result = GetMessage('WD_FILE_ERROR16'); } } } return $result === true ? $result : $this->ThrowError("423 Locked", "423", $result); }