3namespace Bitrix\Iblock\Grid\Panel\UI\Actions\Item;
5use Bitrix\Iblock\Grid\Access\IblockRightsChecker;
6use Bitrix\Iblock\Grid\ActionType;
7use Bitrix\Iblock\Grid\Panel\UI\Actions\Helpers\ItemFinder;
8use Bitrix\Main\Application;
9use Bitrix\Main\DB\SqlQueryException;
11use Bitrix\Main\Filter\Filter;
12use Bitrix\Main\HttpRequest;
13use Bitrix\Main\Localization\Loc;
14use Bitrix\Main\Result;
23 private int $iblockId;
25 private string $listMode;
27 public static function getId(): string
34 $this->iblockId = $iblockId;
35 $this->rights = $rights;
36 $this->listMode = $listMode;
46 return $this->listMode;
53 [$elementIds, $sectionIds] = $this->prepareItemIds(
$request, $isSelectedAllRows,
$filter);
58 $this->removeElements($elementIds)->
getErrors()
65 $this->removeSections($sectionIds)->
getErrors()
81 $conn = Application::getConnection();
85 if (!$this->rights->canDeleteElement($id))
87 $message = Loc::getMessage(
'IBLOCK_GRID_PANEL_UI_REMOVE_ACTIONS_ITEM_ACCESS_DENIED', [
97 $conn->startTransaction();
101 if (!CIBlockElement::Delete($id))
106 $error = $ex->GetString();
111 'IBLOCK_GRID_PANEL_UI_ACTIONS_ELEMENT_DELETE_INTERNAL_ERROR',
120 catch (SqlQueryException)
123 'IBLOCK_GRID_PANEL_UI_ACTIONS_ELEMENT_DELETE_INTERNAL_ERROR',
131 $conn->commitTransaction();
135 $conn->rollbackTransaction();
143 private function removeSections(
array $ids): Result
152 $conn = Application::getConnection();
154 foreach ($ids as $id)
156 if (!$this->rights->canDeleteSection($id))
158 $message = Loc::getMessage(
'IBLOCK_GRID_PANEL_UI_REMOVE_ACTIONS_ITEM_ACCESS_DENIED', [
168 $conn->startTransaction();
172 if (!CIBlockSection::Delete($id))
177 $error = $ex->GetString();
182 'IBLOCK_GRID_PANEL_UI_ACTIONS_SECTION_DELETE_INTERNAL_ERROR',
191 catch (SqlQueryException)
194 'IBLOCK_GRID_PANEL_UI_ACTIONS_SECTION_DELETE_INTERNAL_ERROR',
202 $conn->commitTransaction();
206 $conn->rollbackTransaction();
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
processRequest(HttpRequest $request, bool $isSelectedAllRows, ?Filter $filter=null)
__construct(int $iblockId, IblockRightsChecker $rights, string $listMode)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)