Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
entitytype.php
1
<?php
2
namespace
Bitrix\Sale\Services\Company\Restrictions
;
3
4
use
Bitrix\Main\Localization\Loc
;
5
use
Bitrix\Sale\Order
;
6
use
Bitrix\Sale\Payment
;
7
use
Bitrix\Sale\PaymentCollection
;
8
use
Bitrix\Sale\Services\Base\Restriction
;
9
use
Bitrix\Sale\Internals
;
10
use
Bitrix\Sale\Services\Company
;
11
use
Bitrix\Sale\Shipment
;
12
use
Bitrix\Sale\ShipmentCollection
;
13
14
Loc::loadMessages
(__FILE__);
15
16
class
EntityType
extends
Restriction
17
{
18
const
ENTITY_NONE
=
'N'
;
19
const
ENTITY_PAYMENT
=
'P'
;
20
const
ENTITY_SHIPMENT
=
'S'
;
21
const
ENTITY_ORDER
=
'O'
;
22
26
public
static
function
getClassTitle
()
27
{
28
return
Loc::getMessage
(
'SALE_COMPANY_RULES_BY_ENTITY_TITLE'
);
29
}
30
34
public
static
function
getClassDescription
()
35
{
36
return
Loc::getMessage
(
'SALE_COMPANY_RULES_BY_ENTITY_DESC'
);
37
}
38
39
44
public
static
function
getParamsStructure
($entityId = 0)
45
{
46
return
array(
47
"ENTITY_TYPE"
=> array(
48
"TYPE"
=>
"ENUM"
,
49
"LABEL"
=>
Loc::getMessage
(
"SALE_COMPANY_RULES_BY_ENTITY"
),
50
"OPTIONS"
=> array(
51
self::ENTITY_NONE =>
Loc::getMessage
(
'SALE_COMPANY_RULES_BY_ENTITY_NONE'
),
52
self::ENTITY_PAYMENT =>
Loc::getMessage
(
'SALE_COMPANY_RULES_BY_ENTITY_PAYMENT'
),
53
self::ENTITY_SHIPMENT =>
Loc::getMessage
(
'SALE_COMPANY_RULES_BY_ENTITY_SHIPMENT'
),
54
self::ENTITY_ORDER =>
Loc::getMessage
(
'SALE_COMPANY_RULES_BY_ENTITY_ORDER'
),
55
)
56
)
57
);
58
}
59
60
65
protected
static
function
extractParams
(Internals\
Entity
$entity)
66
{
68
if
($entity instanceof
Payment
)
69
return
self::ENTITY_PAYMENT
;
70
71
if
($entity instanceof
Shipment
)
72
return
self::ENTITY_SHIPMENT
;
73
74
if
($entity instanceof
Order
)
75
return
self::ENTITY_ORDER
;
76
77
return
self::ENTITY_NONE
;
78
}
79
86
public
static
function
check
($params, array $restrictionParams, $serviceId = 0)
87
{
88
return
$params == $restrictionParams[
'ENTITY_TYPE'
];
89
}
90
95
public
static
function
getSeverity
($mode)
96
{
97
return
Company\Restrictions\Manager::SEVERITY_STRICT;
98
}
99
}
Bitrix\Catalog\Model\Entity
Definition
entity.php:12
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Sale\Helpers\Order
Definition
order.php:10
Bitrix\Sale\PaymentCollection
Definition
paymentcollection.php:18
Bitrix\Sale\Payment
Definition
payment.php:19
Bitrix\Sale\Services\Base\Restriction
Definition
restriction.php:17
Bitrix\Sale\Services\Base\Restriction\extractParams
static extractParams(Entity $entity)
Definition
restriction.php:115
Bitrix\Sale\Services\Company\Restrictions\EntityType
Definition
entitytype.php:17
Bitrix\Sale\Services\Company\Restrictions\EntityType\ENTITY_NONE
const ENTITY_NONE
Definition
entitytype.php:18
Bitrix\Sale\Services\Company\Restrictions\EntityType\ENTITY_PAYMENT
const ENTITY_PAYMENT
Definition
entitytype.php:19
Bitrix\Sale\Services\Company\Restrictions\EntityType\check
static check($params, array $restrictionParams, $serviceId=0)
Definition
entitytype.php:86
Bitrix\Sale\Services\Company\Restrictions\EntityType\ENTITY_ORDER
const ENTITY_ORDER
Definition
entitytype.php:21
Bitrix\Sale\Services\Company\Restrictions\EntityType\getClassTitle
static getClassTitle()
Definition
entitytype.php:26
Bitrix\Sale\Services\Company\Restrictions\EntityType\getClassDescription
static getClassDescription()
Definition
entitytype.php:34
Bitrix\Sale\Services\Company\Restrictions\EntityType\ENTITY_SHIPMENT
const ENTITY_SHIPMENT
Definition
entitytype.php:20
Bitrix\Sale\Services\Company\Restrictions\EntityType\getParamsStructure
static getParamsStructure($entityId=0)
Definition
entitytype.php:44
Bitrix\Sale\Services\Company\Restrictions\EntityType\getSeverity
static getSeverity($mode)
Definition
entitytype.php:95
Bitrix\Sale\ShipmentCollection
Definition
shipmentcollection.php:20
Bitrix\Sale\Shipment
Definition
shipment.php:21
Bitrix\Sale\Internals
Definition
accountnumber.php:3
Bitrix\Sale\Services\Company\Restrictions
Definition
currency.php:2
Bitrix\Sale\Services\Company
Definition
manager.php:2
modules
sale
lib
services
company
restrictions
entitytype.php
Создано системой
1.10.0