1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
admin.php
См. документацию.
1<?php
3
11
13{
14 protected static $catalogRead = false;
15 protected static $catalogGroup = false;
16 protected static $catalogPrice = false;
17 protected static $catalogMeasure = false;
18 protected static $catalogDiscount = false;
19 protected static $catalogVat = false;
20 protected static $catalogExtra = false;
21 protected static $catalogStore = false;
22 protected static $catalogExportEdit = false;
23 protected static $catalogExportExec = false;
24 protected static $catalogImportEdit = false;
25 protected static $catalogImportExec = false;
26 protected static $catalogSettings = false;
27 protected static $adminMenuExists;
28
29 private static function initRights(): void
30 {
31 $accessController = AccessController::getCurrent();
32
33 self::$catalogRead = $accessController->check(ActionDictionary::ACTION_CATALOG_READ);
34 self::$catalogGroup = $accessController->check(ActionDictionary::ACTION_PRICE_GROUP_EDIT);
35 self::$catalogPrice = $accessController->check(ActionDictionary::ACTION_PRICE_EDIT);
36 self::$catalogMeasure = $accessController->check(ActionDictionary::ACTION_MEASURE_EDIT);
37 self::$catalogDiscount = $accessController->check(ActionDictionary::ACTION_PRODUCT_DISCOUNT_SET);
38 self::$catalogVat = $accessController->check(ActionDictionary::ACTION_VAT_EDIT);
39 self::$catalogExtra = $accessController->check(ActionDictionary::ACTION_PRODUCT_PRICE_EXTRA_EDIT);
40 self::$catalogStore = $accessController->check(ActionDictionary::ACTION_STORE_VIEW);
41 self::$catalogExportEdit = $accessController->check(ActionDictionary::ACTION_CATALOG_EXPORT_EDIT);
42 self::$catalogExportExec = $accessController->check(ActionDictionary::ACTION_CATALOG_EXPORT_EXECUTION);
43 self::$catalogImportEdit = $accessController->check(ActionDictionary::ACTION_CATALOG_IMPORT_EDIT);
44 self::$catalogImportExec = $accessController->check(ActionDictionary::ACTION_CATALOG_IMPORT_EXECUTION);
45 self::$catalogSettings = $accessController->check(ActionDictionary::ACTION_CATALOG_SETTINGS_ACCESS);
46 }
47
48 public static function get_other_elements_menu($IBLOCK_TYPE_ID, $IBLOCK_ID, $arSection, &$more_url)
49 {
50 $arSection['ID'] = (int)$arSection['ID'];
51 $urlSectionAdminPage = CIBlock::GetAdminSectionListLink($IBLOCK_ID, array('catalog' => null, "skip_public" => true));
52 $more_url[] = $urlSectionAdminPage."&find_section_section=".$arSection["ID"];
53 $more_url[] = CIBlock::GetAdminElementListLink($IBLOCK_ID, array("find_section_section" => $arSection["ID"]));
54 $more_url[] = CIBlock::GetAdminSectionEditLink($IBLOCK_ID, $arSection["ID"], array('catalog' => null, "find_section_section" => $arSection["ID"]));
55 $more_url[] = CIBlock::GetAdminSectionEditLink($IBLOCK_ID, 0, array('catalog' => null, "find_section_section" => $arSection["ID"]));
56
57 if (($arSection["RIGHT_MARGIN"] - $arSection["LEFT_MARGIN"]) > 1)
58 {
59 $rsSections = CIBlockSection::GetList(
60 array("LEFT_MARGIN" => "ASC"),
61 array(
62 "IBLOCK_ID" => $IBLOCK_ID,
63 "SECTION_ID" => $arSection["ID"],
64 ),
65 false,
66 array("ID", "IBLOCK_SECTION_ID", "NAME", "LEFT_MARGIN", "RIGHT_MARGIN")
67 );
68 while($arSubSection = $rsSections->Fetch())
70 }
71 }
72
73 public static function get_sections_menu($IBLOCK_TYPE_ID, $IBLOCK_ID, $DEPTH_LEVEL, $SECTION_ID, $arSectionsChain = false)
74 {
75 if (self::$adminMenuExists === null)
76 {
77 self::$adminMenuExists = isset($adminMenu) && $adminMenu instanceof CAdminMenu;
78 }
79
80 if (isset($_REQUEST["public_menu"]))
81 {
82 return [];
83 }
84
85 global $adminMenu;
86 if ($arSectionsChain === false)
87 {
88 $arSectionsChain = array();
89 if (isset($_REQUEST['admin_mnu_menu_id']))
90 {
91 $menu_id = "menu_catalog_category_".$IBLOCK_ID."/";
92 if (strncmp($_REQUEST['admin_mnu_menu_id'], $menu_id, mb_strlen($menu_id)) == 0)
93 {
94 $rsSections = CIBlockSection::GetNavChain($IBLOCK_ID, mb_substr($_REQUEST['admin_mnu_menu_id'], mb_strlen($menu_id)), array('ID', 'IBLOCK_ID'));
95 while ($arSection = $rsSections->Fetch())
96 $arSectionsChain[$arSection["ID"]] = $arSection["ID"];
97 }
98 }
99 if(
100 isset($_REQUEST["find_section_section"])
101 && (int)$_REQUEST["find_section_section"] > 0
102 && isset($_REQUEST["IBLOCK_ID"])
103 && $_REQUEST["IBLOCK_ID"] == $IBLOCK_ID
104 )
105 {
106 $rsSections = CIBlockSection::GetNavChain($IBLOCK_ID, $_REQUEST["find_section_section"], array('ID', 'IBLOCK_ID'));
107 while ($arSection = $rsSections->Fetch())
108 $arSectionsChain[$arSection["ID"]] = $arSection["ID"];
109 }
110 if (defined("PUBLIC_MODE") && PUBLIC_MODE == 1)
111 {
112 $arSectionsChain = array();
113 $rsSections = CIBlockSection::GetList(array(), array("IBLOCK_ID" => $IBLOCK_ID), false, array("ID"));
114 while ($arSection = $rsSections->Fetch())
115 {
116 $arSectionsChain[$arSection["ID"]] = $arSection["ID"];
117 }
118 }
119 }
120
121 $baseUrlSectionAdminPage = CIBlock::GetAdminSectionListLink($IBLOCK_ID, array("catalog" => null, "skip_public" => true));
122
123 $arSections = array();
124 $rsSections = CIBlockSection::GetList(
125 array("LEFT_MARGIN" => "ASC"),
126 array(
127 "IBLOCK_ID" => $IBLOCK_ID,
128 "SECTION_ID" => $SECTION_ID,
129 ),
130 false,
131 array("ID", "IBLOCK_SECTION_ID", "NAME", "LEFT_MARGIN", "RIGHT_MARGIN")
132 );
133 $intCount = 0;
134 $arOtherSectionTmp = array();
135 $limit = (int)Option::get('iblock', 'iblock_menu_max_sections');
136 $sortCount = 0.01;
137 while ($arSection = $rsSections->Fetch())
138 {
139 $arSection['ID'] = (int)$arSection['ID'];
140 $arSection['IBLOCK_SECTION_ID'] = (int)$arSection['IBLOCK_SECTION_ID'];
141 if ($limit > 0 && $intCount >= $limit)
142 {
143 if (empty($arOtherSectionTmp))
144 {
145 $urlSectionAdminPage = $baseUrlSectionAdminPage."&find_section_section=".
146 $arSection["IBLOCK_SECTION_ID"]."&SECTION_ID=".$arSection["IBLOCK_SECTION_ID"];
147 $arOtherSectionTmp = array(
148 "text" => Loc::getMessage("CAT_MENU_ALL_OTH"),
149 "url" => $urlSectionAdminPage."&apply_filter=Y",
150 "more_url" => array(
151 $urlSectionAdminPage,
152 CIBlock::GetAdminElementListLink($IBLOCK_ID, array("find_section_section" => $arSection["ID"])),
153 CIBlock::GetAdminElementEditLink($IBLOCK_ID, 0, array("find_section_section" => $arSection["ID"])),
154 CIBlock::GetAdminSectionEditLink($IBLOCK_ID, 0, array('catalog' => null)),
155 CIBlock::GetAdminSectionEditLink($IBLOCK_ID, $arSection["ID"], array('catalog' => null)),
156 ),
157 "title" => Loc::getMessage("CAT_MENU_ALL_OTH_TITLE"),
158 "icon" => "iblock_menu_icon_sections",
159 "page_icon" => "iblock_page_icon_sections",
160 "skip_chain" => true,
161 "items_id" => "menu_catalog_category_".$IBLOCK_ID."/".$arSection["ID"],
162 "module_id" => "catalog",
163 "items" => array(),
164 "sort" => 203+$sortCount,
165 );
166 CCatalogAdmin::get_other_elements_menu($IBLOCK_TYPE_ID, $IBLOCK_ID, $arSection, $arOtherSectionTmp["more_url"]);
167 }
168 else
169 {
170 $arOtherSectionTmp['more_url'][] = $baseUrlSectionAdminPage."&find_section_section=".$arSection["ID"]."&SECTION_ID=".$arSection["ID"];
171 $arOtherSectionTmp['more_url'][] = CIBlock::GetAdminElementEditLink($IBLOCK_ID, 0, array("find_section_section" => $arSection["ID"]));
172 $arOtherSectionTmp['more_url'][] = CIBlock::GetAdminSectionEditLink($IBLOCK_ID, 0, array('catalog' => null));
173 $arOtherSectionTmp['more_url'][] = CIBlock::GetAdminSectionEditLink($IBLOCK_ID, $arSection["ID"], array('catalog' => null));
174 }
175 $sortCount += $sortCount + 0.01;
176 }
177 else
178 {
179 $urlSectionAdminPage = $baseUrlSectionAdminPage."&find_section_section=".$arSection["ID"]."&SECTION_ID=".$arSection["ID"];
180 $arSectionTmp = array(
181 "text" => htmlspecialcharsEx($arSection["NAME"]),
182 "url" => $urlSectionAdminPage."&apply_filter=Y",
183 "more_url" => array(
184 $urlSectionAdminPage,
185 CIBlock::GetAdminElementListLink($IBLOCK_ID, array("find_section_section" => $arSection["ID"])),
186 CIBlock::GetAdminElementEditLink($IBLOCK_ID, 0, array("find_section_section" => $arSection["ID"])),
187 CIBlock::GetAdminSectionEditLink($IBLOCK_ID, 0, array('catalog' => null)),
188 CIBlock::GetAdminSectionEditLink($IBLOCK_ID, $arSection["ID"], array('catalog' => null)),
189 ),
190 "title" => htmlspecialcharsEx($arSection["NAME"]),
191 "icon" => "iblock_menu_icon_sections",
192 "page_icon" => "iblock_page_icon_sections",
193 "skip_chain" => true,
194 "items_id" => "menu_catalog_category_".$IBLOCK_ID."/".$arSection["ID"],
195 "module_id" => "catalog",
196 "dynamic" => (($arSection["RIGHT_MARGIN"] - $arSection["LEFT_MARGIN"]) > 1),
197 "items" => array(),
198 "sort" => 203+$sortCount,
199 );
200
201 if (isset($arSectionsChain[$arSection["ID"]]))
202 {
203 $arSectionTmp["items"] = CCatalogAdmin::get_sections_menu($IBLOCK_TYPE_ID, $IBLOCK_ID, $DEPTH_LEVEL + 1, $arSection["ID"], $arSectionsChain);
204 }
205 elseif (self::$adminMenuExists)
206 {
207
208 if ($adminMenu->IsSectionActive("menu_catalog_category_".$IBLOCK_ID."/".$arSection["ID"]))
209 $arSectionTmp["items"] = CCatalogAdmin::get_sections_menu($IBLOCK_TYPE_ID, $IBLOCK_ID, $DEPTH_LEVEL + 1, $arSection["ID"], $arSectionsChain);
210 }
211
212 $arSections[] = $arSectionTmp;
213 $sortCount += $sortCount + 0.01;
214 }
215 $intCount++;
216 }
217 if (!empty($arOtherSectionTmp))
218 $arSections[] = $arOtherSectionTmp;
219 return $arSections;
220 }
221
222 public static function OnBuildGlobalMenu(&$aGlobalMenu, &$aModuleMenu)
223 {
224 if (defined('BX_CATALOG_UNINSTALLED'))
225 return;
226
227 if (!Loader::includeModule('iblock'))
228 return;
229
230 self::initRights();
231
232 $publicMenu = isset($_REQUEST["public_menu"]);
233
234 $aMenu = array(
235 "text" => Loc::getMessage("CAT_MENU_ROOT"),
236 "title" => "",
237 "items_id" => "menu_catalog_list",
238 "items" => array(),
239 "sort" => 200,
240 );
241 $arCatalogs = array();
242 $arCatalogSku = array();
244 'select' => ['IBLOCK_ID', 'PRODUCT_IBLOCK_ID']
245 ]);
246 while ($row = $iterator->fetch())
247 {
248 $row["PRODUCT_IBLOCK_ID"] = (int)$row["PRODUCT_IBLOCK_ID"];
249 $row["IBLOCK_ID"] = (int)$row["IBLOCK_ID"];
250 if ($row["PRODUCT_IBLOCK_ID"] > 0)
251 {
252 $arCatalogs[$row["PRODUCT_IBLOCK_ID"]] = true;
253 $arCatalogSku[$row["PRODUCT_IBLOCK_ID"]] = $row["IBLOCK_ID"];
254 }
255 else
256 {
257 $arCatalogs[$row["IBLOCK_ID"]] = true;
258 }
259 }
260 unset($row, $iterator);
261 if (empty($arCatalogs))
262 return;
263
264 //TODO: replace this hack to api
265 if ($publicMenu && Loader::includeModule("crm"))
266 {
267 $defaultCrmIblock = CCrmCatalog::GetDefaultID();
269 'select' => ['ID', 'XML_ID'],
270 'filter' => ['@ID' => array_keys($arCatalogs)]
271 ]);
272 while ($row = $iterator->fetch())
273 {
274 $iblockId = (int)$row['ID'];
275 if ($iblockId === $defaultCrmIblock)
276 {
277 continue;
278 }
279 if (strncmp($row['XML_ID'] ?? '', 'crm_external_', 13) === 0)
280 {
281 unset($arCatalogs[$iblockId]);
282 }
283 }
284 unset($iblockId, $row, $iterator);
285 }
286
287 $listIblockId = array_keys($arCatalogs);
288
289 if (empty($listIblockId))
290 {
291 return;
292 }
293
294 $defaultProductsName = Loc::getMessage('CAT_MENU_PRODUCT_LIST_EXT');
295 $defaultSectionsName = Loc::getMessage('CAT_MENU_PRODUCT_SECTION_LIST');
296 $defaultMixedName = Loc::getMessage('CAT_MENU_PRODUCT_MIXED_LIST');
297
298 $rsIBlocks = CIBlock::GetList(
299 array("SORT" => "ASC", "NAME" => "ASC"),
300 array('ID' => $listIblockId, "MIN_PERMISSION" => "S")
301 );
302 $sortCount = 0.01;
303 $totalCount = ($publicMenu ? $rsIBlocks->SelectedRowsCount() : 0);
304 while ($arIBlock = $rsIBlocks->Fetch())
305 {
306 $mixedList = CIBlock::GetAdminListMode($arIBlock["ID"]) == Iblock\IblockTable::LIST_MODE_COMBINED;
307 $url = ($mixedList ? 'cat_product_list.php' : 'cat_product_admin.php');
308
309 if ($mixedList)
310 {
311 $productsName = $defaultMixedName;
312 $sectionsName = '';
313 }
314 else
315 {
316 $productsName = (string)CIBlock::GetArrayByID($arIBlock['ID'], 'ELEMENTS_NAME');
317 if ($productsName === '')
318 {
319 $productsName = $defaultProductsName;
320 }
321 $sectionsName = (string)CIBlock::GetArrayByID($arIBlock['ID'], 'SECTIONS_NAME');
322 if ($sectionsName === '')
323 {
324 $sectionsName = $defaultSectionsName;
325 }
326 }
327
328 $arItems = [];
329 $arItems[] = [
330 "text" => htmlspecialcharsbx($productsName),
331 "url" => ($mixedList
332 ? $url."?IBLOCK_ID=".$arIBlock["ID"]."&type=".urlencode($arIBlock["IBLOCK_TYPE_ID"]).'&lang='.LANGUAGE_ID.'&find_section_section=0&SECTION_ID=0&apply_filter=Y'
333 : $url."?IBLOCK_ID=".$arIBlock["ID"]."&type=".urlencode($arIBlock["IBLOCK_TYPE_ID"]).'&lang='.LANGUAGE_ID.'&find_section_section=-1'
334 ),
335 "more_url" => [
336 $url."?IBLOCK_ID=".$arIBlock["ID"]."&type=".urlencode($arIBlock["IBLOCK_TYPE_ID"]).'&lang='.LANGUAGE_ID,
337 CIBlock::GetAdminElementListLink($arIBlock["ID"], ["find_section_section" => -1]),
338 CIBlock::GetAdminElementEditLink($arIBlock["ID"], null),
339 "cat_product_list.php?IBLOCK_ID=".$arIBlock["ID"].'&find_section_section=-1',
340 "cat_product_edit.php?IBLOCK_ID=".$arIBlock["ID"],
341 ],
342 "title" => "",
343 "page_icon" => "iblock_page_icon_elements",
344 "items_id" => "menu_catalog_goods_".$arIBlock["ID"],
345 "module_id" => "catalog",
346 "sort" => 202+$sortCount,
347 ];
348 if (!$mixedList)
349 {
350 $arItems[] = [
351 "text" => htmlspecialcharsbx($sectionsName),
352 "url" => "cat_section_admin.php?lang=".LANGUAGE_ID."&type=".$arIBlock["IBLOCK_TYPE_ID"]."&IBLOCK_ID=".
353 $arIBlock["ID"]."&find_section_section=0&SECTION_ID=0&apply_filter=Y",
354 "more_url" => [
355 CIBlock::GetAdminElementListLink($arIBlock["ID"], ["find_section_section" => 0]),
356 "cat_section_admin.php?lang=".LANGUAGE_ID."IBLOCK_ID=".$arIBlock["ID"]."&find_section_section=0&SECTION_ID=0",
357 CIBlock::GetAdminSectionEditLink($arIBlock["ID"], 0, ['catalog' => null]),
358 ],
359 "title" => "",
360 "page_icon" => "iblock_page_icon_sections",
361 "items_id" => "menu_catalog_category_".$arIBlock["ID"],
362 "module_id" => "catalog",
363 "items" => CCatalogAdmin::get_sections_menu($arIBlock["IBLOCK_TYPE_ID"], $arIBlock["ID"], 1, 0),
364 "sort" => 203+$sortCount,
365 "ajax_options" => ($publicMenu ? [
366 "module_id" => "catalog",
367 "params" => [
368 "iblock_id" => $arIBlock["ID"],
369 "section_id" => 0
370 ]
371 ] : [])
372 ];
373 }
374
375 if (
376 CIBlockRights::UserHasRightTo($arIBlock["ID"], $arIBlock["ID"], "iblock_edit")
377 || ($publicMenu && self::$catalogSettings)
378 )
379 {
380 $arItems[] = array(
381 "text" => Loc::getMessage("CAT_MENU_PRODUCT_PROPERTIES"),
382 "url" => "iblock_property_admin.php?lang=".LANGUAGE_ID."&IBLOCK_ID=".$arIBlock["ID"]."&admin=N",
383 "more_url" => array(
384 "iblock_property_admin.php?IBLOCK_ID=".$arIBlock["ID"]."&admin=N",
385 "iblock_edit_property.php?IBLOCK_ID=".$arIBlock["ID"]."&admin=N",
386 ),
387 "title" => "",
388 "page_icon" => "iblock_page_icon_settings",
389 "items_id" => "menu_catalog_attributes_".$arIBlock["ID"],
390 "module_id" => "catalog",
391 "sort" => 204+$sortCount,
392 );
393 }
394
395 if (isset($arCatalogSku[$arIBlock["ID"]]))
396 {
397 $intOffersIBlockID = $arCatalogSku[$arIBlock["ID"]];
398 if (
399 CIBlockRights::UserHasRightTo($intOffersIBlockID, $intOffersIBlockID, "iblock_edit")
400 || ($publicMenu && self::$catalogSettings)
401 )
402 {
403 $arItems[] = array(
404 "text" => Loc::getMessage("CAT_MENU_SKU_PROPERTIES"),
405 "url" => "iblock_property_admin.php?lang=".LANGUAGE_ID."&IBLOCK_ID=".$intOffersIBlockID."&admin=N",
406 "more_url" => array(
407 "iblock_property_admin.php?IBLOCK_ID=".$intOffersIBlockID."&admin=N",
408 "iblock_edit_property.php?IBLOCK_ID=".$intOffersIBlockID."&admin=N",
409 ),
410 "title" => "",
411 "page_icon" => "iblock_page_icon_settings",
412 "items_id" => "menu_catalog_attributes_".$intOffersIBlockID,
413 "module_id" => "catalog",
414 "sort" => 205+$sortCount,
415 );
416 }
417 }
418
419 if (
420 CIBlockRights::UserHasRightTo($arIBlock["ID"], $arIBlock["ID"], "iblock_edit")
421 || ($publicMenu && self::$catalogSettings)
422 )
423 {
424 $arItems[] = array(
425 "text" => Loc::getMessage("CAT_MENU_CATALOG_SETTINGS"),
426 "url" => "cat_catalog_edit.php?lang=".LANGUAGE_ID."&IBLOCK_ID=".$arIBlock["ID"],
427 "more_url" => array(
428 "cat_catalog_edit.php?IBLOCK_ID=".$arIBlock["ID"],
429 ),
430 "title" => "",
431 "page_icon" => "iblock_page_icon_settings",
432 "items_id" => "menu_catalog_edit_".$arIBlock["ID"],
433 "module_id" => "catalog",
434 "sort" => 206+$sortCount,
435 );
436 }
437
438 if ($publicMenu)
439 $text = ($totalCount > 1 ? htmlspecialcharsEx($arIBlock["NAME"]) : Loc::getMessage("CAT_MENU_ROOT_TITLE"));
440 else
442
443 $aMenu["items"][] = array(
444 "text" => $text,
445 "title" => "",
446 "page_icon" => "iblock_page_icon_sections",
447 "items_id" => "menu_catalog_".$arIBlock["ID"],
448 "module_id" => "catalog",
449 "items" => $arItems,
450 "url" => $url."?lang=".LANGUAGE_ID."&IBLOCK_ID=".$arIBlock["ID"]."&type=".urlencode($arIBlock["IBLOCK_TYPE_ID"]).'&find_section_section=-1',
451 "sort" => 201+$sortCount,
452 );
453 $sortCount += $sortCount + 0.01;
454 }
455 unset($arIBlock, $rsIBlocks);
456
458 global $USER;
459 $showMarketplaceLink = $USER->CanDoOperation('install_updates');
460
461 if (!empty($aMenu["items"]))
462 {
463 $singleCatalog = count($aMenu["items"]) == 1;
464 if ($singleCatalog)
465 {
466 $aMenu = $aMenu["items"][0];
467 }
468 else
469 {
470 $aMenu["text"] = Loc::getMessage("CAT_MENU_ROOT_MULTI");
471 if ($showMarketplaceLink)
472 {
473 $aMenu["items"][] = [
474 "text" => Loc::getMessage("CAT_MENU_CATALOG_MARKETPLACE_ADD"),
475 "url" => "update_system_market.php?category=107&lang=".LANGUAGE_ID,
476 "more_url" => array("update_system_market.php?category=107"),
477 "title" => Loc::getMessage("CAT_MENU_CATALOG_MARKETPLACE_ADD"),
478 "items_id" => "update_system_market",
479 "sort" => 207+$sortCount,
480 ];
481 }
482 }
483 $aMenu["parent_menu"] = "global_menu_store";
484 $aMenu["section"] = "catalog_list";
485 $aMenu["sort"] = 200;
486 $aMenu["icon"] = "iblock_menu_icon_sections";
487 $aMenu["page_icon"] = "iblock_page_icon_types";
488 $aModuleMenu[] = $aMenu;
489 if ($singleCatalog && $showMarketplaceLink)
490 {
491 $aModuleMenu[] = [
492 "parent_menu" => "global_menu_store",
493 "section" => "catalog_list",
494 "text" => Loc::getMessage("CAT_MENU_CATALOG_MARKETPLACE_CATALOG_TOOLS"),
495 "title" => Loc::getMessage("CAT_MENU_CATALOG_MARKETPLACE_CATALOG_TOOLS"),
496 "icon" => "iblock_menu_icon_sections",
497 "page_icon" => "iblock_page_icon_types",
498 "items_id" => "update_system_market",
499 "url" => "update_system_market.php?category=107&lang=".LANGUAGE_ID,
500 "more_url" => array("update_system_market.php?category=107"),
501 "sort" => 201,
502 ];
503 }
504 unset($singleCatalog);
505 }
506 else
507 {
508 if ($showMarketplaceLink)
509 {
510 $aMenu["items"] = [
511 [
512 "text" => Loc::getMessage("CAT_MENU_CATALOG_MARKETPLACE_CATALOG_TOOLS"),
513 "url" => "update_system_market.php?category=107&lang=".LANGUAGE_ID,
514 "more_url" => array("update_system_market.php?category=107"),
515 "title" => Loc::getMessage("CAT_MENU_CATALOG_MARKETPLACE_CATALOG_TOOLS"),
516 "items_id" => "update_system_market",
517 "sort" => 207
518 ]
519 ];
520 $aMenu["parent_menu"] = "global_menu_store";
521 $aMenu["section"] = "catalog_list";
522 $aMenu["sort"] = 200;
523 $aMenu["icon"] = "iblock_menu_icon_sections";
524 $aMenu["page_icon"] = "iblock_page_icon_types";
525 $aModuleMenu[] = $aMenu;
526 }
527 }
528 unset($showMarketplaceLink, $aMenu);
529 }
530
536 public static function OnAdminListDisplay(&$obList) {}
537
538 public static function OnBuildSaleMenu(&$arGlobalMenu, &$arModuleMenu)
539 {
540 global $adminMenu;
541
542 if (defined('BX_CATALOG_UNINSTALLED'))
543 return;
544
545 global $USER;
547 return;
548 if (!Loader::includeModule('sale'))
549 return;
550
551 if (!defined('BX_SALE_MENU_CATALOG_CLEAR') || BX_SALE_MENU_CATALOG_CLEAR != 'Y')
552 return;
553
554 self::initRights();
555 self::$adminMenuExists = isset($adminMenu) && $adminMenu instanceof CAdminMenu;
556
557 static::OnBuildSaleMenuItem($arModuleMenu);
558 }
559
560 protected static function OnBuildSaleMenuItem(&$arMenu)
561 {
562 if (empty($arMenu) || !is_array($arMenu))
563 return;
564
565 $arMenuID = array(
566 'menu_sale_discounts',
567 'menu_sale_taxes',
568 'menu_sale_settings',
569 'menu_catalog_store',
570 'menu_sale_buyers'
571 );
572
573 foreach ($arMenu as &$arMenuItem)
574 {
575 if (!isset($arMenuItem['items']) || !is_array($arMenuItem['items']))
576 continue;
577
578 if (!isset($arMenuItem['items_id']) || !is_string($arMenuItem['items_id']) || !in_array($arMenuItem['items_id'], $arMenuID))
579 continue;
580
581 switch ($arMenuItem['items_id'])
582 {
583 case 'menu_sale_discounts':
584 $useSaleDiscountOnly = (string)Option::get('sale', 'use_sale_discount_only');
585 if ($useSaleDiscountOnly != 'Y')
586 static::OnBuildSaleDiscountMenu($arMenuItem['items']);
587 break;
588 case 'menu_sale_taxes':
589 static::OnBuildSaleTaxMenu($arMenuItem['items']);
590 break;
591 case 'menu_sale_settings':
592 static::OnBuildSaleSettingsMenu($arMenuItem['items']);
593 break;
594 case 'menu_catalog_store':
595 static::OnBuildSaleStoreMenu($arMenuItem['items']);
596 break;
597 case 'menu_sale_buyers':
598 static::OnBuildSaleBuyersMenu($arMenuItem['items']);
599 break;
600 }
601
602 static::OnBuildSaleMenuItem($arMenuItem['items']);
603 }
604 unset($arMenuItem);
605 }
606
607 protected static function OnBuildSaleDiscountMenu(&$arItems)
608 {
609 if (self::$catalogRead || self::$catalogDiscount)
610 {
611 $arItemsIdAtEnd = array('menu_sale_marketplace');
612 $arItemsForEnd = array();
613 foreach($arItems as $key => $item)
614 {
615 if (isset($item['items_id']) && in_array($item['items_id'], $arItemsIdAtEnd))
616 {
617 $arItemsForEnd[] = $arItems[$key];
618 unset($arItems[$key]);
619 }
620 }
621
622 $arItems[] = array(
623 "text" => Loc::getMessage("CM_DISCOUNTS3"),
624 "title" => Loc::getMessage("CM_DISCOUNTS_ALT2"),
625 "items_id" => "menu_catalog_discount",
626 "items" => array(
627 array(
628 "text" => Loc::getMessage("CM_DISCOUNTS3"),
629 "url" => "cat_discount_admin.php?lang=".LANGUAGE_ID,
630 "more_url" => array("cat_discount_edit.php"),
631 "title" => Loc::getMessage("CM_DISCOUNTS_ALT2"),
632 "readonly" => !self::$catalogDiscount,
633 "items_id" => "cat_discount_admin",
634 ),
635 array(
636 "text" => Loc::getMessage("CM_COUPONS_EXT"),
637 "url" => "cat_discount_coupon.php?lang=".LANGUAGE_ID,
638 "more_url" => array("cat_discount_coupon_edit.php"),
639 "title" => Loc::getMessage("CM_COUPONS_TITLE"),
640 "readonly" => !self::$catalogDiscount,
641 "items_id" => "cat_discount_coupon",
642 )
643 )
644 );
645 if (Catalog\Config\Feature::isCumulativeDiscountsEnabled())
646 {
647 $arItems[] = array(
648 "text" => Loc::getMessage("CAT_DISCOUNT_SAVE"),
649 "url" => "cat_discsave_admin.php?lang=".LANGUAGE_ID,
650 "more_url" => array("cat_discsave_edit.php"),
651 "title" => Loc::getMessage("CAT_DISCOUNT_SAVE_DESCR"),
652 "readonly" => !self::$catalogDiscount,
653 "items_id" => "cat_discsave_admin",
654 );
655 }
656
657 if($arItemsForEnd)
658 {
659 $arItems = array_merge($arItems, $arItemsForEnd);
660 }
661 }
662 }
663
664 protected static function OnBuildSaleTaxMenu(&$arItems)
665 {
666 if (self::$catalogRead || self::$catalogVat)
667 {
668 $arItems[] = array(
669 "text" => Loc::getMessage("VAT"),
670 "url" => "cat_vat_admin.php?lang=".LANGUAGE_ID,
671 "more_url" => array("cat_vat_edit.php"),
672 "title" => Loc::getMessage("VAT_ALT"),
673 "readonly" => !self::$catalogVat,
674 "items_id" => "cat_vat_admin",
675 );
676 }
677 }
678
679 protected static function OnBuildSaleSettingsMenu(&$arItems)
680 {
681 $showPrices = self::$catalogRead || self::$catalogGroup;
682 $showExtra = (Catalog\Config\Feature::isMultiPriceTypesEnabled() && (self::$catalogRead || self::$catalogExtra));
683 if ($showPrices || $showExtra)
684 {
685 $section = array(
686 'text' => Loc::getMessage('PRICES_SECTION'),
687 'title' => Loc::getMessage('PRICES_SECTION_TITLE'),
688 'items_id' => 'menu_catalog_prices',
689 'items' => array(),
690 "sort" => 725.1,
691 );
692 if ($showPrices)
693 {
694 $section['items'][] = array(
695 'text' => Loc::getMessage('GROUP'),
696 'title' => Loc::getMessage('GROUP_ALT'),
697 'url' => 'cat_group_admin.php?lang='.LANGUAGE_ID,
698 'more_url' => array('cat_group_edit.php'),
699 'readonly' => !self::$catalogGroup,
700 'items_id' => 'cat_group_admin',
701 "sort" => 725.2,
702 );
703 $section['items'][] = array(
704 'text' => Loc::getMessage('PRICE_ROUND'),
705 'title' => Loc::getMessage('PRICE_ROUND_TITLE'),
706 'url' => 'cat_round_list.php?lang='.LANGUAGE_ID,
707 'more_url' => array('cat_round_edit.php'),
708 'readonly' => !self::$catalogGroup,
709 'items_id' => 'cat_round_list',
710 "sort" => 725.3,
711 );
712 }
713 if ($showExtra)
714 {
715 $section['items'][] = array(
716 'text' => Loc::getMessage('EXTRA'),
717 'title' => Loc::getMessage('EXTRA_ALT'),
718 'url' => 'cat_extra.php?lang='.LANGUAGE_ID,
719 'more_url' => array('cat_extra_edit.php'),
720 'readonly' => !self::$catalogExtra,
721 'items_id' => 'cat_extra',
722 "sort" => 725.4,
723 );
724 }
725 $arItems[] = $section;
726 unset($section);
727 }
728 unset($showExtra, $showPrices);
729
730 if (self::$catalogRead || self::$catalogMeasure)
731 {
732 $arItems[] = array(
733 "text" => Loc::getMessage("MEASURE"),
734 "url" => "cat_measure_list.php?lang=".LANGUAGE_ID,
735 "more_url" => array("cat_measure_edit.php"),
736 "title" => Loc::getMessage("MEASURE_ALT"),
737 "readonly" => !self::$catalogMeasure,
738 "items_id" => "cat_measure_list",
739 "sort" => 726.1,
740 );
741 }
742
743 if (self::$catalogRead || self::$catalogExportEdit || self::$catalogExportExec)
744 {
745 $arItems[] = array(
746 "text" => Loc::getMessage("SETUP_UNLOAD_DATA"),
747 "url" => "cat_export_setup.php?lang=".LANGUAGE_ID,
748 "more_url" => array("cat_exec_exp.php"),
749 "title" => Loc::getMessage("SETUP_UNLOAD_DATA_ALT"),
750 "dynamic" => true,
751 "module_id" => "sale",
752 "items_id" => "mnu_catalog_exp",
753 "readonly" => !self::$catalogExportEdit && !self::$catalogExportExec,
754 "items" => static::OnBuildSaleExportMenu("mnu_catalog_exp"),
755 );
756 }
757
758 if (self::$catalogRead || self::$catalogImportEdit || self::$catalogImportExec)
759 {
760 $arItems[] = array(
761 "text" => Loc::getMessage("SETUP_LOAD_DATA"),
762 "url" => "cat_import_setup.php?lang=".LANGUAGE_ID,
763 "more_url" => array("cat_exec_imp.php"),
764 "title" => Loc::getMessage("SETUP_LOAD_DATA_ALT"),
765 "dynamic" => true,
766 "module_id" => "sale",
767 "items_id" => "mnu_catalog_imp",
768 "readonly" => !self::$catalogImportEdit && !self::$catalogImportExec,
769 "items" => static::OnBuildSaleImportMenu("mnu_catalog_imp"),
770 );
771 }
772
774 global $USER;
775 if (self::$catalogRead && $USER->CanDoOperation('install_updates'))
776 {
777 $arItems[] = array(
778 "text" => Loc::getMessage("SALE_MENU_MARKETPLACE_SETTINGS_ADD"),
779 "url" => "update_system_market.php?category=54&lang=".LANGUAGE_ID,
780 "title" => Loc::getMessage("SALE_MENU_MARKETPLACE_SETTINGS_ADD"),
781 "module_id" => "sale",
782 "items_id" => "update_system_market",
783 );
784 }
785 }
786
787 protected static function OnBuildSaleStoreMenu(&$arItems)
788 {
789 if (self::$catalogRead || self::$catalogStore)
790 {
791 $result = [];
792 if (self::$catalogStore)
793 {
794 $allowRows = false;
795 $rows = [
796 [
797 "text" => Loc::getMessage("CM_STORE_DOCS_MSGVER_1"),
798 "url" => "cat_store_document_list.php?lang=".LANGUAGE_ID,
799 "more_url" => ["cat_store_document_edit.php"],
800 "title" => Loc::getMessage("CM_STORE_DOCS_MSGVER_1"),
801 "readonly" => !self::$catalogStore,
802 "items_id" => "cat_store_document_list",
803 "sort" => 551,
804 ],
805 ];
806 if (Catalog\Config\Feature::isInventoryManagementEnabled())
807 {
808 if (Catalog\Config\State::isUsedInventoryManagement())
809 {
810 $allowRows = true;
811 }
812 }
813 else
814 {
816 if ($helpLink !== null)
817 {
818 $allowRows = true;
819 foreach ($rows as &$item)
820 {
821 unset($item['url'], $item['more_url']);
822 $item['is_locked'] = true;
823 $item['on_click'] = $helpLink['LINK'];
824 }
825 unset($item);
826 }
827 }
828
829 if ($allowRows)
830 {
831 $result = $rows;
832 }
833 unset($rows, $allowRows);
834 }
835 $result[] = [
836 "text" => Loc::getMessage("CM_STORE"),
837 "url" => "cat_store_list.php?lang=".LANGUAGE_ID,
838 "more_url" => ["cat_store_edit.php"],
839 "title" => Loc::getMessage("CM_STORE"),
840 "readonly" => !self::$catalogStore,
841 "items_id" => "cat_store_list",
842 "sort" => 553,
843 ];
844
845 $result[] = [
846 "text" => Loc::getMessage("CM_CONTRACTORS"),
847 "url" => "cat_contractor_list.php?lang=".LANGUAGE_ID,
848 "more_url" => ["cat_contractor_edit.php"],
849 "title" => Loc::getMessage("CM_CONTRACTORS"),
850 "readonly" => !self::$catalogStore,
851 "items_id" => "cat_contractor_list",
852 "sort" => 552,
853 ];
854 $arItems = $result;
855 }
856 }
857
858 protected static function OnBuildSaleBuyersMenu(&$arItems)
859 {
860 if (self::$catalogRead)
861 {
862 $found = false;
863 if (!empty($arItems))
864 {
865 foreach ($arItems as $item)
866 {
867 if ($item['url'] == "cat_subscription_list.php?lang=".LANGUAGE_ID)
868 {
869 $found = true;
870 break;
871 }
872 }
873 unset($item);
874 }
875 if (!$found)
876 {
877 $arItems[] = array(
878 "text" => Loc::getMessage("CM_SUBSCRIPTION_PRODUCT"),
879 "url" => "cat_subscription_list.php?lang=" . LANGUAGE_ID,
880 "more_url" => array("cat_subscription_list.php"),
881 "title" => Loc::getMessage("CM_SUBSCRIPTION_PRODUCT"),
882 "items_id" => "cat_subscription_list",
883 "sort" => 407,
884 );
885 }
886 unset($found);
887 }
888 }
889
890 protected static function OnBuildSaleExportMenu($strItemID)
891 {
892 global $adminMenu;
893
894 $arProfileList = array();
895
896 if (empty($strItemID))
897 {
898 return $arProfileList;
899 }
900 if (!(self::$catalogRead || self::$catalogExportEdit || self::$catalogExportExec))
901 {
902 return $arProfileList;
903 }
904
905 if (!self::$adminMenuExists)
906 {
907 return $arProfileList;
908 }
909
910 if ($adminMenu->IsSectionActive($strItemID))
911 {
912 $rsProfiles = CCatalogExport::GetList(array("NAME"=>"ASC", "ID"=>"ASC"), array("IN_MENU"=>"Y"));
913 while ($arProfile = $rsProfiles->Fetch())
914 {
915 $arProfile['NAME'] = (string)$arProfile['NAME'];
916 $strName = ($arProfile["NAME"] != '' ? $arProfile["NAME"] : $arProfile["FILE_NAME"]);
917 if ($arProfile['DEFAULT_PROFILE'] == 'Y')
918 {
919 $arProfileList[] = array(
920 "text" => htmlspecialcharsbx($strName),
921 "url" => "cat_exec_exp.php?lang=".LANGUAGE_ID."&ACT_FILE=".$arProfile["FILE_NAME"]."&ACTION=EXPORT&PROFILE_ID=".$arProfile["ID"]."&".bitrix_sessid_get(),
922 "title" => Loc::getMessage("CAM_EXPORT_DESCR_EXPORT")." &quot;".htmlspecialcharsbx($strName)."&quot;",
923 "readonly" => !self::$catalogExportExec,
924 );
925 }
926 else
927 {
928 $arProfileList[] = array(
929 "text" => htmlspecialcharsbx($strName),
930 "url" => "cat_export_setup.php?lang=".LANGUAGE_ID."&ACT_FILE=".$arProfile["FILE_NAME"]."&ACTION=EXPORT_EDIT&PROFILE_ID=".$arProfile["ID"]."&".bitrix_sessid_get(),
931 "title"=>Loc::getMessage("CAM_EXPORT_DESCR_EDIT")." &quot;".htmlspecialcharsbx($strName)."&quot;",
932 "readonly" => !self::$catalogExportEdit,
933 );
934 }
935 }
936 }
937 return $arProfileList;
938 }
939
940 protected static function OnBuildSaleImportMenu($strItemID)
941 {
942 global $adminMenu;
943
944 $arProfileList = array();
945
946 if (empty($strItemID))
947 {
948 return $arProfileList;
949 }
950
951 if (!(self::$catalogRead || self::$catalogImportEdit || self::$catalogImportExec))
952 {
953 return $arProfileList;
954 }
955
956 if (!self::$adminMenuExists)
957 {
958 return $arProfileList;
959 }
960
961 if ($adminMenu->IsSectionActive($strItemID))
962 {
963 $rsProfiles = CCatalogImport::GetList(array("NAME"=>"ASC", "ID"=>"ASC"), array("IN_MENU"=>"Y"));
964 while ($arProfile = $rsProfiles->Fetch())
965 {
966 $arProfile["NAME"] = (string)$arProfile["NAME"];
967 $strName = ($arProfile["NAME"] != '' ? $arProfile["NAME"] : $arProfile["FILE_NAME"]);
968 if ($arProfile['DEFAULT_PROFILE'] == 'Y')
969 {
970 $arProfileList[] = array(
971 "text" => htmlspecialcharsbx($strName),
972 "url" => "cat_exec_imp.php?lang=".LANGUAGE_ID."&ACT_FILE=".$arProfile["FILE_NAME"]."&ACTION=IMPORT&PROFILE_ID=".$arProfile["ID"]."&".bitrix_sessid_get(),
973 "title" => Loc::getMessage("CAM_IMPORT_DESCR_IMPORT")." &quot;".htmlspecialcharsbx($strName)."&quot;",
974 "readonly" => !self::$catalogImportExec,
975 );
976 }
977 else
978 {
979 $arProfileList[] = array(
980 "text" => htmlspecialcharsbx($strName),
981 "url" => "cat_import_setup.php?lang=".LANGUAGE_ID."&ACT_FILE=".$arProfile["FILE_NAME"]."&ACTION=IMPORT_EDIT&PROFILE_ID=".$arProfile["ID"]."&".bitrix_sessid_get(),
982 "title" => Loc::getMessage("CAM_IMPORT_DESCR_EDIT")." &quot;".htmlspecialcharsbx($strName)."&quot;",
983 "readonly" => !self::$catalogImportEdit,
984 );
985 }
986 }
987 }
988
989 return $arProfileList;
990 }
991}
$useSaleDiscountOnly
Определения options.php:32
$accessController
Определения options.php:23
static getInventoryManagementHelpLink()
Определения feature.php:285
static isMultiPriceTypesEnabled()
Определения feature.php:118
const LIST_MODE_COMBINED
Определения iblocktable.php:95
static get($moduleId, $name, $default="", $siteId=false)
Определения option.php:30
Определения loader.php:13
static includeModule($moduleName)
Определения loader.php:67
static getMessage($code, $replace=null, $language=null)
Определения loc.php:30
static getList(array $parameters=array())
Определения datamanager.php:431
Определения admin_lib.php:682
static GetList($arOrder=array("ID"=>"ASC"), $arFilter=array(), $bCount=false)
Определения catalog_export.php:99
static IsUserExists()
Определения catalog.php:1812
static GetList($arOrder=array("ID"=> "ASC"), $arFilter=array(), $bCount=false)
Определения catalog_import.php:99
Определения admin.php:13
static $catalogGroup
Определения admin.php:15
static get_other_elements_menu($IBLOCK_TYPE_ID, $IBLOCK_ID, $arSection, &$more_url)
Определения admin.php:48
static OnBuildSaleExportMenu($strItemID)
Определения admin.php:890
static $catalogPrice
Определения admin.php:16
static $catalogExportExec
Определения admin.php:23
static $catalogExportEdit
Определения admin.php:22
static OnAdminListDisplay(&$obList)
Определения admin.php:536
static OnBuildSaleStoreMenu(&$arItems)
Определения admin.php:787
static $adminMenuExists
Определения admin.php:27
static $catalogSettings
Определения admin.php:26
static $catalogDiscount
Определения admin.php:18
static get_sections_menu($IBLOCK_TYPE_ID, $IBLOCK_ID, $DEPTH_LEVEL, $SECTION_ID, $arSectionsChain=false)
Определения admin.php:73
static $catalogMeasure
Определения admin.php:17
static OnBuildSaleDiscountMenu(&$arItems)
Определения admin.php:607
static OnBuildSaleBuyersMenu(&$arItems)
Определения admin.php:858
static OnBuildSaleSettingsMenu(&$arItems)
Определения admin.php:679
static $catalogVat
Определения admin.php:19
static OnBuildSaleMenu(&$arGlobalMenu, &$arModuleMenu)
Определения admin.php:538
static OnBuildSaleImportMenu($strItemID)
Определения admin.php:940
static OnBuildSaleTaxMenu(&$arItems)
Определения admin.php:664
static OnBuildGlobalMenu(&$aGlobalMenu, &$aModuleMenu)
Определения admin.php:222
static $catalogExtra
Определения admin.php:20
static $catalogStore
Определения admin.php:21
static $catalogRead
Определения admin.php:14
static OnBuildSaleMenuItem(&$arMenu)
Определения admin.php:560
static $catalogImportEdit
Определения admin.php:24
static $catalogImportExec
Определения admin.php:25
global $IBLOCK_TYPE_ID
Определения commerceml_run.php:330
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$arMenu
Определения file_new.php:216
$_REQUEST["admin_mnu_menu_id"]
Определения get_menu.php:8
$result
Определения get_property_values.php:14
$iblockId
Определения iblock_catalog_edit.php:30
global $adminMenu
Определения init_admin.php:7
$IBLOCK_ID
Определения csv_new_run.php:168
global $USER
Определения csv_new_run.php:40
if(( $ACTION=='EXPORT_EDIT'||$ACTION=='EXPORT_COPY') &&$STEP==1) if($STEP > 1) if(( $ACTION=='EXPORT_EDIT'||$ACTION=='EXPORT_COPY') &&$STEP==2) if($STEP >2) $aMenu
Определения csv_new_setup.php:214
htmlspecialcharsEx($str)
Определения tools.php:2685
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
bitrix_sessid_get($varname='sessid')
Определения tools.php:4695
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
if(empty($signedUserToken)) $key
Определения quickway.php:257
$text
Определения template_pdf.php:79
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
const BX_SALE_MENU_CATALOG_CLEAR
Определения include.php:49
$rows
Определения options.php:264
$totalCount
Определения subscription_card_product.php:51
$url
Определения iframe.php:7
$rsIBlocks
Определения yandex_detail.php:58
$arIBlock['PROPERTY']
Определения yandex_detail.php:172
$arSections
Определения yandex_run.php:805
$iterator
Определения yandex_run.php:610