Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
userconsent.php
1
<?php
2
3
namespace
Bitrix\Sale
;
4
5
use
Bitrix\Main\EventResult
;
6
use
Bitrix\Main\Localization\Loc
;
7
use
Bitrix\Sale\Services\Company\Manager
;
8
9
class
UserConsent
10
{
11
const
PROVIDER_CODE
=
'sale/order'
;
12
const
DATA_PROVIDER_CODE
=
'sale/company'
;
13
19
public
static
function
onProviderList
()
20
{
21
$parameters = array(
22
array(
23
'CODE'
=> self::PROVIDER_CODE,
24
'NAME'
=>
Loc::getMessage
(
'SALE_USER_CONSENT_PROVIDER_NAME'
),
25
'DATA'
=>
function
($id =
null
)
26
{
27
return
array(
28
'NAME'
=>
Loc::getMessage
(
'SALE_USER_CONSENT_PROVIDER_ITEM_NAME'
, array(
'%id%'
=> $id)),
29
'URL'
=> str_replace(
'%id%'
, $id,
'/bitrix/admin/sale_order_view.php?ID=%id%'
)
30
);
31
}
32
)
33
);
34
35
return
new
EventResult
(EventResult::SUCCESS, $parameters,
'sale'
);
36
}
37
43
public
static
function
onDataProviderList
()
44
{
45
$parameters = array(
46
array(
47
'CODE'
=> self::DATA_PROVIDER_CODE,
48
'NAME'
=>
Loc::getMessage
(
'SALE_USER_CONSENT_DATA_PROVIDER_NAME'
),
49
'EDIT_URL'
=>
'/bitrix/admin/sale_company.php'
,
50
'DATA'
=>
function
()
51
{
52
$data = array();
53
$companyNames = array();
54
$companyAddresses = array();
55
56
$dbRes = Manager::getList(array(
57
'select'
=> array(
'NAME'
,
'ADDRESS'
),
58
'filter'
=> array(
'ACTIVE'
=>
'Y'
),
59
'order'
=> array(
'SORT'
=>
'ASC'
,
'ID'
=>
'ASC'
)
60
));
61
while
($company = $dbRes->fetch())
62
{
63
$companyNames[] = $company[
'NAME'
];
64
$companyAddresses[] = $company[
'ADDRESS'
];
65
}
66
67
if
(!empty($companyNames))
68
{
69
$data = array(
70
'COMPANY_NAME'
=> implode(
'; '
, $companyNames),
71
'COMPANY_ADDRESS'
=> implode(
'; '
, $companyAddresses)
72
);
73
}
74
75
return
$data;
76
}
77
)
78
);
79
80
return
new
EventResult
(EventResult::SUCCESS, $parameters,
'sale'
);
81
}
82
}
Bitrix\Catalog\Model\EventResult
Definition
eventresult.php:7
Bitrix\Main\EventResult
Definition
eventresult.php:5
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\Sale\Cashbox\Manager
Definition
manager.php:22
Bitrix\Sale\UserConsent
Definition
userconsent.php:10
Bitrix\Sale\UserConsent\DATA_PROVIDER_CODE
const DATA_PROVIDER_CODE
Definition
userconsent.php:12
Bitrix\Sale\UserConsent\onProviderList
static onProviderList()
Definition
userconsent.php:19
Bitrix\Sale\UserConsent\PROVIDER_CODE
const PROVIDER_CODE
Definition
userconsent.php:11
Bitrix\Sale\UserConsent\onDataProviderList
static onDataProviderList()
Definition
userconsent.php:43
Bitrix\Sale
modules
sale
lib
userconsent.php
Создано системой
1.10.0