Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
company.php
1
<?php
2
namespace
Bitrix\Sale\Cashbox\Restrictions
;
3
4
use
Bitrix\Main\Localization\Loc
;
5
use
Bitrix\Sale\Internals\Entity
;
6
use
Bitrix\Sale
;
7
use
Bitrix\Sale\Services\Base\Restriction
;
8
9
Loc::loadMessages
(__FILE__);
10
15
class
Company
extends
Restriction
16
{
17
public
static
$easeSort
= 200;
18
protected
static
$preparedData
= array();
19
23
public
static
function
getClassTitle
()
24
{
25
return
Loc::getMessage
(
"SALE_CASHBOX_RSTR_BY_COMPANY_TITLE"
);
26
}
27
31
public
static
function
getClassDescription
()
32
{
33
return
Loc::getMessage
(
"SALE_CASHBOX_RSTR_BY_COMPANY_DESC"
);
34
}
35
42
public
static
function
check
($params, array $restrictionParams, $serviceId = 0)
43
{
44
if
(is_array($restrictionParams) && isset($restrictionParams[
'COMPANY'
]))
45
{
46
$diff = array_diff($params, $restrictionParams[
'COMPANY'
]);
47
return
empty($diff);
48
}
49
50
return
true
;
51
}
52
57
protected
static
function
extractParams
(
Entity
$entity)
58
{
59
$result = array();
60
61
if
($entity instanceof
Sale
\
Payment
||
62
$entity instanceof
Sale
\
Shipment
||
63
$entity instanceof
Sale
\
Order
64
)
65
{
66
$result[] = $entity->getField(
'COMPANY_ID'
);
67
}
68
69
return
$result;
70
}
71
75
protected
static
function
getCompanyList
()
76
{
77
static
$result =
null
;
78
79
if
($result !==
null
)
80
return
$result;
81
82
$result = array();
83
84
$dbResultList = Sale\Services\Company\Manager::getList(array(
85
'select'
=> array(
"ID"
,
"NAME"
,
"ACTIVE"
),
86
'filter'
=> array(
"ACTIVE"
=>
"Y"
),
87
'order'
=> array(
"SORT"
=>
"ASC"
,
"NAME"
=>
"ASC"
)
88
));
89
90
while
($item = $dbResultList->fetch())
91
$result[$item[
"ID"
]] = $item[
"NAME"
];
92
93
return
$result;
94
}
95
100
public
static
function
getParamsStructure
($entityId = 0)
101
{
102
$result = array(
103
"COMPANY"
=> array(
104
"TYPE"
=>
"ENUM"
,
105
'MULTIPLE'
=>
'Y'
,
106
"LABEL"
=>
Loc::getMessage
(
"SALE_CASHBOX_RSTR_BY_COMPANY"
),
107
"OPTIONS"
=> self::getCompanyList()
108
)
109
);
110
111
return
$result;
112
}
113
118
public
static
function
getSeverity
($mode)
119
{
120
return
Manager::SEVERITY_STRICT;
121
}
122
126
public
static
function
isAvailable
()
127
{
128
return
IsModuleInstalled(
'crm'
) ? false :
true
;
129
}
130
131
}
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\Cashbox\Restrictions\Company
Definition
company.php:16
Bitrix\Sale\Cashbox\Restrictions\Company\extractParams
static extractParams(Entity $entity)
Definition
company.php:57
Bitrix\Sale\Cashbox\Restrictions\Company\getCompanyList
static getCompanyList()
Definition
company.php:75
Bitrix\Sale\Cashbox\Restrictions\Company\$easeSort
static $easeSort
Definition
company.php:17
Bitrix\Sale\Cashbox\Restrictions\Company\check
static check($params, array $restrictionParams, $serviceId=0)
Definition
company.php:42
Bitrix\Sale\Cashbox\Restrictions\Company\getClassTitle
static getClassTitle()
Definition
company.php:23
Bitrix\Sale\Cashbox\Restrictions\Company\$preparedData
static $preparedData
Definition
company.php:18
Bitrix\Sale\Cashbox\Restrictions\Company\isAvailable
static isAvailable()
Definition
company.php:126
Bitrix\Sale\Cashbox\Restrictions\Company\getClassDescription
static getClassDescription()
Definition
company.php:31
Bitrix\Sale\Cashbox\Restrictions\Company\getParamsStructure
static getParamsStructure($entityId=0)
Definition
company.php:100
Bitrix\Sale\Cashbox\Restrictions\Company\getSeverity
static getSeverity($mode)
Definition
company.php:118
Bitrix\Sale\Helpers\Order
Definition
order.php:10
Bitrix\Sale\Payment
Definition
payment.php:19
Bitrix\Sale\Services\Base\Restriction
Definition
restriction.php:17
Bitrix\Sale\Shipment
Definition
shipment.php:21
Bitrix\Sale\Cashbox\Restrictions
Definition
company.php:2
Bitrix\Sale
Sale
modules
sale
lib
cashbox
restrictions
company.php
Создано системой
1.10.0