Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
converttoservicegroupchild.php
1
<?php
2
3
namespace
Bitrix\Catalog\Grid\Panel\UI\Item\Group
;
4
5
use
Bitrix\Catalog\Config\State
;
6
use
Bitrix\Catalog\Grid\ProductAction
;
7
use Bitrix\Iblock\Grid\Panel\UI\Actions\Helpers\ItemFinder;
8
use
Bitrix\Iblock\Grid\Panel\UI\Actions\Item\ElementGroup\BaseGroupChild
;
9
use
Bitrix\Main\Filter\Filter
;
10
use
Bitrix\Main\Grid\Panel\Actions
;
11
use
Bitrix\Main\Grid\Panel\Snippet
;
12
use
Bitrix\Main\Grid\Panel\Snippet\Onchange
;
13
use
Bitrix\Main\HttpRequest
;
14
use
Bitrix\Main\Loader
;
15
use
Bitrix\Main\Localization\Loc
;
16
use
Bitrix\Main\Result
;
17
18
Loader::requireModule(
'iblock'
);
19
20
final
class
ConvertToServiceGroupChild
extends
BaseGroupChild
21
{
22
use ItemFinder;
23
24
public
static
function
getId
(): string
25
{
26
return
'convert_to_service'
;
27
}
28
29
public
function
getName
(): string
30
{
31
return
Loc::getMessage
(
'CATALOG_GRID_PANEL_UI_PRODUCT_ACTION_CONVERT_TO_SERVICE_NAME'
);
32
}
33
34
public
function
processRequest
(
HttpRequest
$request,
bool
$isSelectedAllRows, ?
Filter
$filter =
null
): ?
Result
35
{
36
$result =
new
Result
();
37
38
[$elementIds, $sectionIds] = $this->prepareItemIds($request, $isSelectedAllRows, $filter);
39
40
if
($elementIds)
41
{
42
$result->addErrors(
43
ProductAction::convertToServiceElementList
($this->
getIblockId
(), $elementIds)->
getErrors
()
44
);
45
}
46
47
if
($sectionIds)
48
{
49
$result->addErrors(
50
ProductAction::convertToServiceSectionList
($this->
getIblockId
(), $sectionIds)->
getErrors
()
51
);
52
}
53
54
return
$result;
55
}
56
57
protected
function
getOnchange
():
Onchange
58
{
59
$confirmMessage =
60
State::isUsedInventoryManagement()
61
?
Loc::getMessage
(
'CATALOG_GRID_PANEL_UI_PRODUCT_ACTION_CONVERT_TO_SERVICE_CONFIRM_WITH_INVENTORY'
)
62
:
Loc::getMessage
(
'CATALOG_GRID_PANEL_UI_PRODUCT_ACTION_CONVERT_TO_SERVICE_CONFIRM_WITHOUT_INVENTORY'
)
63
;
64
65
return
new
Onchange
([
66
[
67
'ACTION'
=> Actions::RESET_CONTROLS,
68
],
69
[
70
'ACTION'
=> Actions::CREATE,
71
'DATA'
=> [
72
(
new
Snippet
)->getSendSelectedButton($confirmMessage),
73
],
74
],
75
]);
76
}
77
}
Bitrix\Catalog\Config\State
Definition
state.php:21
Bitrix\Catalog\Grid\Panel\UI\Item\Group\ConvertToServiceGroupChild
Definition
converttoservicegroupchild.php:21
Bitrix\Catalog\Grid\Panel\UI\Item\Group\ConvertToServiceGroupChild\getName
getName()
Definition
converttoservicegroupchild.php:29
Bitrix\Catalog\Grid\Panel\UI\Item\Group\ConvertToServiceGroupChild\processRequest
processRequest(HttpRequest $request, bool $isSelectedAllRows, ?Filter $filter=null)
Definition
converttoservicegroupchild.php:34
Bitrix\Catalog\Grid\Panel\UI\Item\Group\ConvertToServiceGroupChild\getId
static getId()
Definition
converttoservicegroupchild.php:24
Bitrix\Catalog\Grid\Panel\UI\Item\Group\ConvertToServiceGroupChild\getOnchange
getOnchange()
Definition
converttoservicegroupchild.php:57
Bitrix\Catalog\Grid\ProductAction
Definition
productaction.php:16
Bitrix\Catalog\Grid\ProductAction\convertToServiceSectionList
static convertToServiceSectionList(int $iblockId, array $sections)
Definition
productaction.php:377
Bitrix\Catalog\Grid\ProductAction\convertToServiceElementList
static convertToServiceElementList(int $iblockId, array $elementIds)
Definition
productaction.php:387
Bitrix\Iblock\Grid\Panel\UI\Actions\Item\ElementGroup\BaseGroupChild
Definition
basegroupchild.php:9
Bitrix\Iblock\Grid\Panel\UI\Actions\Item\ElementGroup\BaseGroupChild\getIblockId
getIblockId()
Definition
basegroupchild.php:21
Bitrix\Main\DB\Result
Definition
result.php:19
Bitrix\Main\Filter\Filter
Definition
filter.php:5
Bitrix\Main\Grid\Panel\Actions
Definition
actions.php:13
Bitrix\Main\Grid\Panel\Snippet\Onchange
Definition
onchange.php:15
Bitrix\Main\Grid\Panel\Snippet
Definition
snippet.php:19
Bitrix\Main\HttpRequest
Definition
httprequest.php:20
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Main\ORM\Data\Result
Definition
result.php:16
Bitrix\Catalog\Grid\Panel\UI\Item\Group
Definition
changepricesgroupchild.php:3
Bitrix\Main\Grid\Panel\Snippet
Definition
button.php:3
Bitrix\Main\getErrors
getErrors()
Definition
errorableimplementation.php:34
modules
catalog
lib
grid
panel
ui
item
group
converttoservicegroupchild.php
Создано системой
1.10.0