1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
location.php
См. документацию.
1
<?php
2
namespace
Bitrix\Sale\Services\Company\Restrictions;
3
4
use Bitrix\Main\Localization\Loc;
5
use Bitrix\Sale\Internals\CollectableEntity;
6
use Bitrix\Sale\Internals\CompanyLocationTable;
7
use Bitrix\Sale\Internals\Entity;
8
use Bitrix\Sale\Location\Tree\NodeNotFoundException;
9
use Bitrix\Sale\Order;
10
use Bitrix\Sale\Services\Base;
11
12
Loc::loadMessages(__FILE__);
13
18
class
Location
extends
Base\Restriction
19
{
20
public
static
$easeSort
= 200;
21
25
public
static
function
getClassTitle
()
26
{
27
return
Loc::getMessage(
"SALE_COMPANY_RULES_BY_LOCATION_TITLE"
);
28
}
29
33
public
static
function
getClassDescription
()
34
{
35
return
Loc::getMessage(
"SALE_COMPANY_RULES_BY_LOCATION_DESC"
);
36
}
37
44
public
static
function
check
(
$params
,
array
$restrictionParams, $serviceId = 0)
45
{
46
if
((
int
)$serviceId <= 0)
47
return
true
;
48
49
if
(!
$params
)
50
return
false
;
51
52
try
53
{
54
return
CompanyLocationTable::checkConnectionExists(
55
intval($serviceId),
56
$params
,
57
array
(
58
'LOCATION_LINK_TYPE'
=>
'AUTO'
59
)
60
);
61
}
62
catch
(
NodeNotFoundException
$e)
63
{
64
return
false
;
65
}
66
}
67
73
protected
static
function
extractParams(
Entity
$entity
)
74
{
75
if
(
$entity
instanceof
CollectableEntity
)
76
{
78
$order
=
$entity
->getCollection()->getOrder();
79
}
80
elseif
(
$entity
instanceof Order)
81
{
83
$order
=
$entity
;
84
}
85
86
if
(!
$order
)
87
return
''
;
88
89
if
(!
$props
=
$order
->getPropertyCollection())
90
return
''
;
91
92
if
(!$locationProp =
$props
->getDeliveryLocation())
93
return
''
;
94
95
if
(!$locationCode = $locationProp->getValue())
96
return
''
;
97
98
return
$locationCode;
99
}
100
106
protected
static
function
prepareParamsForSaving
(
array
$params
=
array
(), $companyId = 0)
107
{
108
if
($companyId > 0)
109
{
110
$arLocation
=
array
();
111
112
if
(!!\
CSaleLocation::isLocationProEnabled
())
113
{
114
if
(
$params
[
"LOCATION"
][
'L'
] <>
''
)
115
{
116
$LOCATION1 = explode(
':'
,
$params
[
"LOCATION"
][
'L'
]);
117
}
118
119
if
(
$params
[
"LOCATION"
][
'G'
] <>
''
)
120
{
121
$LOCATION2 = explode(
':'
,
$params
[
"LOCATION"
][
'G'
]);
122
}
123
}
124
125
if
(isset($LOCATION1) && is_array($LOCATION1) &&
count
($LOCATION1) > 0)
126
{
127
$arLocation
[
"L"
] =
array
();
128
$locationCount =
count
($LOCATION1);
129
130
for
(
$i
= 0;
$i
<$locationCount;
$i
++)
131
if
($LOCATION1[
$i
] <>
''
)
132
{
133
$arLocation
[
"L"
][] = $LOCATION1[
$i
];
134
}
135
}
136
137
if
(isset($LOCATION2) && is_array($LOCATION2) &&
count
($LOCATION2) > 0)
138
{
139
$arLocation
[
"G"
] =
array
();
140
$locationCount =
count
($LOCATION2);
141
142
for
(
$i
= 0;
$i
<$locationCount;
$i
++)
143
if
($LOCATION2[
$i
] <>
''
)
144
{
145
$arLocation
[
"G"
][] = $LOCATION2[
$i
];
146
}
147
148
}
149
150
CompanyLocationTable::resetMultipleForOwner($companyId,
$arLocation
);
151
}
152
153
return
array
();
154
}
155
160
public
static
function
getParamsStructure
(
$entityId
= 0)
161
{
162
163
$result
=
array
(
164
"LOCATION"
=>
array
(
165
"TYPE"
=>
"COMPANY_LOCATION_MULTI"
166
)
167
);
168
169
if
(
$entityId
> 0 )
170
$result
[
"LOCATION"
][
"COMPANY_ID"
] =
$entityId
;
171
172
return
$result
;
173
}
174
180
public
static
function
save
(
array
$fields
, $restrictionId = 0)
181
{
182
$fields
[
"PARAMS"
] = self::prepareParamsForSaving(
$fields
[
"PARAMS"
],
$fields
[
"SERVICE_ID"
]);
183
return
parent::save(
$fields
, $restrictionId);
184
}
185
191
public
static
function
delete
($restrictionId,
$entityId
= 0)
192
{
193
CompanyLocationTable::resetMultipleForOwner(
$entityId
);
194
return
parent::delete($restrictionId);
195
}
196
}
Bitrix\Sale\Internals\CollectableEntity
Определения
collectableentity.php:14
Bitrix\Sale\Location\Tree\NodeNotFoundException
Определения
exception.php:46
Bitrix\Sale\Services\Company\Restrictions\Location\prepareParamsForSaving
static prepareParamsForSaving(array $params=array(), $companyId=0)
Определения
location.php:106
Bitrix\Sale\Services\Company\Restrictions\Location\$easeSort
static $easeSort
Определения
location.php:20
Bitrix\Sale\Services\Company\Restrictions\Location\check
static check($params, array $restrictionParams, $serviceId=0)
Определения
location.php:44
Bitrix\Sale\Services\Company\Restrictions\Location\getClassTitle
static getClassTitle()
Определения
location.php:25
Bitrix\Sale\Services\Company\Restrictions\Location\save
static save(array $fields, $restrictionId=0)
Определения
location.php:180
Bitrix\Sale\Services\Company\Restrictions\Location\getClassDescription
static getClassDescription()
Определения
location.php:33
Bitrix\Sale\Services\Company\Restrictions\Location\getParamsStructure
static getParamsStructure($entityId=0)
Определения
location.php:160
CAllSaleLocation\isLocationProEnabled
static isLocationProEnabled()
Определения
location.php:40
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
$entity
$entity
Определения
group_bizproc_workflow_delete.php:17
Bitrix\Catalog\Restriction
Определения
toolavailabilitymanager.php:3
Bitrix\Main\Entity
Определения
ufield.php:9
Bitrix\Sale\Location
Определения
comparator.php:2
$order
$order
Определения
payment.php:8
$entityId
$entityId
Определения
payment.php:4
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$i
$i
Определения
factura.php:643
count
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения
waybill.php:936
$props
$props
Определения
template.php:269
$params
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения
template.php:799
$arLocation
$arLocation['REGION_NAME']
Определения
options.php:2800
$fields
$fields
Определения
yandex_run.php:501
bitrix
modules
sale
lib
services
company
restrictions
location.php
Создано системой
1.14.0