Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
bypersontype.php
1
<?php
2
3
namespace
Bitrix\Sale\Delivery\Restrictions
;
4
5
use
Bitrix\Sale\Internals\CollectableEntity
;
6
use
Bitrix\Sale\Internals\Entity
;
7
use
Bitrix\Sale\Internals\PersonTypeTable
;
8
use
Bitrix\Sale\ShipmentCollection
;
9
use
Bitrix\Main\Localization\Loc
;
10
use
Bitrix\Sale\Order
;
11
12
Loc::loadMessages
(__FILE__);
13
14
class
ByPersonType
extends
Base
15
{
22
public
static
function
check
($personTypeId, array $params, $deliveryId = 0)
23
{
24
if
(is_array($params) && isset($params[
'PERSON_TYPE_ID'
]))
25
{
26
return
in_array($personTypeId, $params[
'PERSON_TYPE_ID'
]);
27
}
28
29
return
true
;
30
}
31
36
public
static
function
extractParams(
Entity
$entity)
37
{
38
if
($entity instanceof
CollectableEntity
)
39
{
41
$collection = $entity->getCollection();
42
44
$order = $collection->getOrder();
45
}
46
elseif ($entity instanceof
Order
)
47
{
49
$order = $entity;
50
}
51
52
if
(!$order)
53
return
false
;
54
55
$personTypeId = $order->getPersonTypeId();
56
return
$personTypeId;
57
}
58
62
public
static
function
getClassTitle
()
63
{
64
return
Loc::getMessage
(
'SALE_DLVR_RSTR_BY_PERSON_TYPE'
);
65
}
66
70
public
static
function
getClassDescription
()
71
{
72
return
Loc::getMessage
(
'SALE_DLVR_RSTR_BY_PERSON_TYPE_DESC'
);
73
}
74
79
public
static
function
getParamsStructure
($deliveryId = 0)
80
{
81
$personTypeList = array();
82
83
$dbRes = \Bitrix\Sale\PersonType::getList();
84
85
while
($personType = $dbRes->fetch())
86
$personTypeList[$personType[
"ID"
]] = $personType[
"NAME"
].
" ("
.$personType[
"ID"
].
")"
;
87
88
return
array(
89
"PERSON_TYPE_ID"
=> array(
90
"TYPE"
=>
"ENUM"
,
91
'MULTIPLE'
=>
'Y'
,
92
"LABEL"
=>
Loc::getMessage
(
"SALE_DLVR_RSTR_BY_PERSON_TYPE_NAME"
),
93
"OPTIONS"
=> $personTypeList
94
)
95
);
96
}
97
102
public
static
function
getSeverity
($mode)
103
{
104
return
Manager::SEVERITY_STRICT
;
105
}
106
}
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\Delivery\ExtraServices\Base
Definition
base.php:10
Bitrix\Sale\Delivery\Restrictions\ByPersonType
Definition
bypersontype.php:15
Bitrix\Sale\Delivery\Restrictions\ByPersonType\check
static check($personTypeId, array $params, $deliveryId=0)
Definition
bypersontype.php:22
Bitrix\Sale\Delivery\Restrictions\ByPersonType\getParamsStructure
static getParamsStructure($deliveryId=0)
Definition
bypersontype.php:79
Bitrix\Sale\Delivery\Restrictions\ByPersonType\getClassTitle
static getClassTitle()
Definition
bypersontype.php:62
Bitrix\Sale\Delivery\Restrictions\ByPersonType\getClassDescription
static getClassDescription()
Definition
bypersontype.php:70
Bitrix\Sale\Delivery\Restrictions\ByPersonType\getSeverity
static getSeverity($mode)
Definition
bypersontype.php:102
Bitrix\Sale\Helpers\Order
Definition
order.php:10
Bitrix\Sale\Internals\CollectableEntity
Definition
collectableentity.php:14
Bitrix\Sale\Internals\PersonTypeTable
Definition
persontype.php:44
Bitrix\Sale\Services\Base\RestrictionManager\SEVERITY_STRICT
const SEVERITY_STRICT
Definition
restrictionmanager.php:31
Bitrix\Sale\ShipmentCollection
Definition
shipmentcollection.php:20
Bitrix\Sale\Delivery\Restrictions
Definition
base.php:2
modules
sale
lib
delivery
restrictions
bypersontype.php
Создано системой
1.10.0