1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
base.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Sale\Delivery\ExtraServices
;
4
5
use
Bitrix\Main\ArgumentNullException
;
6
use
Bitrix\Sale\Internals\Input
;
7
use
Bitrix\Sale\Shipment
;
8
9
abstract
class
Base
10
{
11
protected
$id
;
12
protected
$code
;
13
protected
$name
=
''
;
14
protected
$description
=
''
;
15
protected
$className
= __CLASS__;
16
protected
$params
=
array
();
17
protected
$rights
=
array
(
18
Manager::RIGHTS_ADMIN_IDX
=>
'N'
,
19
Manager::RIGHTS_MANAGER_IDX
=>
'N'
,
20
Manager::RIGHTS_CLIENT_IDX
=>
'N'
21
);
22
protected
$deliveryId
= 0;
23
protected
$initial
=
''
;
24
protected
$active
=
false
;
25
protected
$sort
= 100;
26
protected
$value
=
null
;
27
protected
$currency
=
''
;
28
protected
$operatingCurrency
=
''
;
29
30
abstract
public
static
function
getClassTitle
();
31
32
public
function
__construct
(
$id
,
array
$initParams,
$currency
,
$value
=
null
,
array
$additionalParams =
array
())
33
{
34
if
(
$id
==
''
)
35
{
36
throw
new
ArgumentNullException
(
'id'
);
37
}
38
39
$initParams[
'CODE'
] ??=
''
;
40
$initParams[
'NAME'
] ??=
''
;
41
$initParams[
'DESCRIPTION'
] ??=
null
;
42
$initParams[
'PARAMS'
] ??= [];
43
if
(!is_array($initParams[
'PARAMS'
]))
44
{
45
$initParams[
'PARAMS'
] = [];
46
}
47
$initParams[
'DELIVERY_ID'
] ??=
null
;
48
$initParams[
'INIT_VALUE'
] ??=
null
;
49
$initParams[
'ACTIVE'
] = (string)($initParams[
'ACTIVE'
] ??
'N'
);
50
$initParams[
'SORT'
] ??=
null
;
51
52
$this->
id
=
$id
;
53
$this->code = $initParams[
'CODE'
];
54
$this->name = $initParams[
'NAME'
];
55
$this->description = $initParams[
'DESCRIPTION'
];
56
$this->className = $initParams[
'CLASS_NAME'
];
57
$this->params = $initParams[
'PARAMS'
];
58
$this->rights = $initParams[
'RIGHTS'
];
59
$this->deliveryId = $initParams[
'DELIVERY_ID'
];
60
$this->initial = $initParams[
'INIT_VALUE'
];
61
$this->active = $initParams[
'ACTIVE'
];
62
$this->sort = $initParams[
'SORT'
];
63
64
$this->currency =
$currency
;
65
$this->operatingCurrency =
$currency
;
66
67
if
(
$value
!==
null
)
68
{
69
$this->
setValue
(
$value
);
70
}
71
elseif
($this->initial !==
null
)
72
{
73
$this->
setValue
($this->initial);
74
}
75
}
76
77
public
function
setValue
(
$value
)
78
{
79
$this->value =
$value
;
80
}
81
82
public
function
getName
()
83
{
84
return
$this->name
;
85
}
86
87
public
function
getDescription
()
88
{
89
return
$this->description
;
90
}
91
92
public
function
getValue
()
93
{
94
return
$this->value;
95
}
96
97
public
function
getEditControl
($prefix =
''
,
$value
=
false
)
98
{
99
if
($prefix <>
''
)
100
$name
= $prefix;
101
else
102
$name
= $this->id;
103
104
if
(!
$value
)
105
$value
= $this->value;
106
107
return
Input\Manager::getEditHtml
(
$name
, $this->params,
$value
);
108
}
109
110
public
function
getViewControl
()
111
{
112
return
Input\Manager::getViewHtml
($this->params, $this->value);
113
}
114
120
121
public
function
getPrice
()
122
{
123
$result
=
false
;
124
125
if
(isset($this->params[
'PRICE'
]))
126
$result
= $this->
convertToOperatingCurrency
($this->params[
'PRICE'
]);
127
128
return
$result
;
129
}
130
131
protected
function
convertToOtherCurrency
(
$value
,
$currency
)
132
{
133
$result
= floatval(
$value
);
134
135
if
(
$result
<= 0)
136
return
$value
;
137
138
if
($this->currency ==
''
||
$currency
==
''
)
139
return
$value
;
140
141
if
($this->currency ==
$currency
)
142
return
$value
;
143
144
static
$rates =
null
;
145
146
if
($rates ===
null
)
147
{
148
if
(\
Bitrix
\
Main
\Loader::includeModule(
'currency'
))
149
$rates = new \CCurrencyRates;
150
else
151
$rates =
false
;
152
}
153
154
if
($rates)
155
$result
= $rates->convertCurrency(
$result
, $this->currency,
$currency
);
156
else
157
$result
=
$value
;
158
159
return
$result
;
160
}
161
162
protected
function
convertToOperatingCurrency
(
$value
)
163
{
164
return
$this->
convertToOtherCurrency
(
$value
, $this->operatingCurrency);
165
}
166
167
public
static
function
prepareParamsToSave
(
array
$params
)
168
{
169
return
$params
;
170
}
171
172
public
function
canUserEditValue
()
173
{
174
return
$this->rights[
Manager::RIGHTS_CLIENT_IDX
] ==
'Y'
;
175
}
176
177
public
function
canManagerEditValue
()
178
{
179
return
$this->rights[
Manager::RIGHTS_MANAGER_IDX
] ==
'Y'
;
180
}
181
182
public
function
getAdminDefaultControl
($prefix =
''
,
$value
=
false
)
183
{
184
return
$this->
getEditControl
($prefix,
$value
);
185
}
186
187
public
static
function
getAdminParamsControl
(
$name
,
array
$params
,
$currency
=
''
)
188
{
189
return
false
;
190
}
191
192
public
function
isStore
()
193
{
194
return
$this->className ==
'\Bitrix\Sale\Delivery\ExtraServices\Store'
;
195
}
196
197
public
function
getParams
()
198
{
199
return
$this->params
;
200
}
201
202
public
static
function
isInner
()
203
{
204
return
false
;
205
}
206
207
public
function
setOperatingCurrency
(
$currency
)
208
{
209
$this->operatingCurrency =
$currency
;
210
}
211
212
public
function
getOperatingCurrency
()
213
{
214
return
$this->operatingCurrency;
215
}
216
217
public
function
getCode
()
218
{
219
return
$this->code
;
220
}
221
222
public
function
getId
()
223
{
224
return
$this->id;
225
}
226
227
public
function
getCostShipment
(
Shipment
$shipment =
null
)
228
{
229
return
$this->
getCost
();
230
}
231
237
public
function
getCost
()
238
{
239
return
0;
240
}
241
242
public
static
function
isEmbeddedOnly
()
243
{
244
return
false
;
245
}
246
247
public
function
getPriceShipment
(
Shipment
$shipment =
null
)
248
{
249
return
$this->
getPrice
();
250
}
251
255
public
function
getDisplayValue
(): ?string
256
{
257
return
is_null($this->value) ? null : (string)$this->value;
258
}
259
263
public
function
getInitial
()
264
{
265
return
$this->initial;
266
}
267
}
Bitrix\Main\ArgumentNullException
Определения
ArgumentNullException.php:9
Bitrix\Sale\Delivery\ExtraServices\Base\$operatingCurrency
$operatingCurrency
Определения
base.php:28
Bitrix\Sale\Delivery\ExtraServices\Base\$value
$value
Определения
base.php:26
Bitrix\Sale\Delivery\ExtraServices\Base\getDisplayValue
getDisplayValue()
Определения
base.php:255
Bitrix\Sale\Delivery\ExtraServices\Base\getId
getId()
Определения
base.php:222
Bitrix\Sale\Delivery\ExtraServices\Base\getDescription
getDescription()
Определения
base.php:87
Bitrix\Sale\Delivery\ExtraServices\Base\getOperatingCurrency
getOperatingCurrency()
Определения
base.php:212
Bitrix\Sale\Delivery\ExtraServices\Base\$currency
$currency
Определения
base.php:27
Bitrix\Sale\Delivery\ExtraServices\Base\getPrice
getPrice()
Определения
base.php:121
Bitrix\Sale\Delivery\ExtraServices\Base\getName
getName()
Определения
base.php:82
Bitrix\Sale\Delivery\ExtraServices\Base\$deliveryId
$deliveryId
Определения
base.php:22
Bitrix\Sale\Delivery\ExtraServices\Base\setOperatingCurrency
setOperatingCurrency($currency)
Определения
base.php:207
Bitrix\Sale\Delivery\ExtraServices\Base\$sort
$sort
Определения
base.php:25
Bitrix\Sale\Delivery\ExtraServices\Base\getEditControl
getEditControl($prefix='', $value=false)
Определения
base.php:97
Bitrix\Sale\Delivery\ExtraServices\Base\convertToOtherCurrency
convertToOtherCurrency($value, $currency)
Определения
base.php:131
Bitrix\Sale\Delivery\ExtraServices\Base\isStore
isStore()
Определения
base.php:192
Bitrix\Sale\Delivery\ExtraServices\Base\getCost
getCost()
Определения
base.php:237
Bitrix\Sale\Delivery\ExtraServices\Base\isInner
static isInner()
Определения
base.php:202
Bitrix\Sale\Delivery\ExtraServices\Base\getClassTitle
static getClassTitle()
Bitrix\Sale\Delivery\ExtraServices\Base\setValue
setValue($value)
Определения
base.php:77
Bitrix\Sale\Delivery\ExtraServices\Base\$code
$code
Определения
base.php:12
Bitrix\Sale\Delivery\ExtraServices\Base\$rights
$rights
Определения
base.php:17
Bitrix\Sale\Delivery\ExtraServices\Base\getAdminDefaultControl
getAdminDefaultControl($prefix='', $value=false)
Определения
base.php:182
Bitrix\Sale\Delivery\ExtraServices\Base\$description
$description
Определения
base.php:14
Bitrix\Sale\Delivery\ExtraServices\Base\convertToOperatingCurrency
convertToOperatingCurrency($value)
Определения
base.php:162
Bitrix\Sale\Delivery\ExtraServices\Base\isEmbeddedOnly
static isEmbeddedOnly()
Определения
base.php:242
Bitrix\Sale\Delivery\ExtraServices\Base\getAdminParamsControl
static getAdminParamsControl($name, array $params, $currency='')
Определения
base.php:187
Bitrix\Sale\Delivery\ExtraServices\Base\$initial
$initial
Определения
base.php:23
Bitrix\Sale\Delivery\ExtraServices\Base\getPriceShipment
getPriceShipment(Shipment $shipment=null)
Определения
base.php:247
Bitrix\Sale\Delivery\ExtraServices\Base\canManagerEditValue
canManagerEditValue()
Определения
base.php:177
Bitrix\Sale\Delivery\ExtraServices\Base\$active
$active
Определения
base.php:24
Bitrix\Sale\Delivery\ExtraServices\Base\$name
$name
Определения
base.php:13
Bitrix\Sale\Delivery\ExtraServices\Base\getCode
getCode()
Определения
base.php:217
Bitrix\Sale\Delivery\ExtraServices\Base\prepareParamsToSave
static prepareParamsToSave(array $params)
Определения
base.php:167
Bitrix\Sale\Delivery\ExtraServices\Base\getInitial
getInitial()
Определения
base.php:263
Bitrix\Sale\Delivery\ExtraServices\Base\getValue
getValue()
Определения
base.php:92
Bitrix\Sale\Delivery\ExtraServices\Base\canUserEditValue
canUserEditValue()
Определения
base.php:172
Bitrix\Sale\Delivery\ExtraServices\Base\getViewControl
getViewControl()
Определения
base.php:110
Bitrix\Sale\Delivery\ExtraServices\Base\$className
$className
Определения
base.php:15
Bitrix\Sale\Delivery\ExtraServices\Base\__construct
__construct($id, array $initParams, $currency, $value=null, array $additionalParams=array())
Определения
base.php:32
Bitrix\Sale\Delivery\ExtraServices\Base\getParams
getParams()
Определения
base.php:197
Bitrix\Sale\Delivery\ExtraServices\Base\$id
$id
Определения
base.php:11
Bitrix\Sale\Delivery\ExtraServices\Base\$params
$params
Определения
base.php:16
Bitrix\Sale\Delivery\ExtraServices\Base\getCostShipment
getCostShipment(Shipment $shipment=null)
Определения
base.php:227
Bitrix\Sale\Delivery\ExtraServices\Manager\RIGHTS_CLIENT_IDX
const RIGHTS_CLIENT_IDX
Определения
manager.php:26
Bitrix\Sale\Delivery\ExtraServices\Manager\RIGHTS_ADMIN_IDX
const RIGHTS_ADMIN_IDX
Определения
manager.php:24
Bitrix\Sale\Delivery\ExtraServices\Manager\RIGHTS_MANAGER_IDX
const RIGHTS_MANAGER_IDX
Определения
manager.php:25
Bitrix\Sale\Internals\Input\Manager\getEditHtml
static getEditHtml($name, array $input, $value=null)
Определения
input.php:88
Bitrix\Sale\Internals\Input\Manager\getViewHtml
static getViewHtml(array $input, $value=null)
Определения
input.php:70
Bitrix\Sale\Shipment
Определения
shipment.php:21
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
$description
if(Loader::includeModule( 'bitrix24')) elseif(Loader::includeModule('intranet') &&CIntranetUtils::getPortalZone() !=='ru') $description
Определения
.description.php:24
$code
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения
options.php:195
$name
$name
Определения
menu_edit.php:35
Bitrix\Main
Bitrix\Sale\Delivery\ExtraServices
Определения
base.php:3
Bitrix\Sale\Internals\Input
Определения
input.php:3
Bitrix\Sale\Services\Base
Определения
concreteproductrestriction.php:3
Bitrix
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$params
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения
template.php:799
bitrix
modules
sale
lib
delivery
extra_services
base.php
Создано системой
1.14.0