1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
payableshipmentitem.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Sale;
4
5
use Bitrix\Main;
6
use Bitrix\Sale\Internals\CollectableEntity;
7
8
Main\Localization\Loc::loadMessages
(__FILE__);
9
14
class
PayableShipmentItem
extends
PayableItem
15
{
16
public
static
function
getRegistryEntity
() : string
17
{
18
return
Registry::ENTITY_PAYABLE_SHIPMENT
;
19
}
20
21
public
static
function
getEntityType
() : string
22
{
23
return
Registry::ENTITY_SHIPMENT
;
24
}
25
26
public
function
getPrice
(): float
27
{
29
$shipment = $this->
getEntityObject
();
30
31
if
($shipment)
32
{
33
return
$shipment->getPrice();
34
}
35
36
return
0;
37
}
38
39
public
function
getEntityObject
()
40
{
41
if
($this->item ===
null
)
42
{
44
$payment
= $this->collection->getPayment();
45
46
$this->item =
$payment
->getOrder()->getShipmentCollection()->getItemById(
47
$this->getField(
'ENTITY_ID'
)
48
);
49
}
50
51
return
$this->item
;
52
}
53
54
public
static
function
create
(
PayableItemCollection
$collection
,
CollectableEntity
$entity)
55
{
56
if
(!$entity instanceof
Shipment
)
57
{
58
throw
new
Main\SystemException
(
59
Main
\
Localization
\Loc::getMessage(
60
'SALE_PAYABLE_ITEM_INCOMPATIBLE_TYPE'
,
61
[
'#CLASS#'
=> Shipment::class]
62
)
63
);
64
}
65
66
$item
= parent::create(
$collection
, $entity);
67
68
$item
->setFieldNoDemand(
'QUANTITY'
, 1);
69
70
return
$item
;
71
}
72
73
protected
function
onFieldModify
(
$name
, $oldValue, $value)
74
{
75
if
(
$name
===
'QUANTITY'
)
76
{
77
if
($value !== 1)
78
{
79
$result =
new
Result
();
80
81
return
$result->addError(
82
new
Main
\
Error
(
83
Main
\
Localization
\Loc::getMessage(
'SALE_PAYABLE_ITEM_SHIPMENT_QUANTITY_ERROR'
)
84
)
85
);
86
}
87
}
88
89
return
parent::onFieldModify(
$name
, $oldValue, $value);
90
}
91
97
public
static
function
getEntityEventName
()
98
{
99
return
'SalePayableShipmentEntity'
;
100
}
101
102
}
Bitrix\Main\Error
Определения
error.php:15
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Определения
loc.php:65
Bitrix\Main\SystemException
Определения
SystemException.php:9
Bitrix\Sale\Internals\CollectableEntity
Определения
collectableentity.php:14
Bitrix\Sale\Internals\CollectableEntity\$collection
$collection
Определения
collectableentity.php:16
Bitrix\Sale\PayableItemCollection
Определения
payableitemcollection.php:15
Bitrix\Sale\PayableItem
Определения
payableitem.php:14
Bitrix\Sale\PayableItem\getEntityObject
getEntityObject()
Bitrix\Sale\PayableItem\getPrice
getPrice()
Bitrix\Sale\PayableItem\$item
$item
Определения
payableitem.php:20
Bitrix\Sale\PayableShipmentItem
Определения
payableshipmentitem.php:15
Bitrix\Sale\PayableShipmentItem\onFieldModify
onFieldModify($name, $oldValue, $value)
Определения
payableshipmentitem.php:73
Bitrix\Sale\PayableShipmentItem\getRegistryEntity
static getRegistryEntity()
Определения
payableshipmentitem.php:16
Bitrix\Sale\PayableShipmentItem\create
static create(PayableItemCollection $collection, CollectableEntity $entity)
Определения
payableshipmentitem.php:54
Bitrix\Sale\PayableShipmentItem\getEntityType
static getEntityType()
Определения
payableshipmentitem.php:21
Bitrix\Sale\PayableShipmentItem\getEntityEventName
static getEntityEventName()
Определения
payableshipmentitem.php:97
Bitrix\Sale\Registry\ENTITY_PAYABLE_SHIPMENT
const ENTITY_PAYABLE_SHIPMENT
Определения
registry.php:24
Bitrix\Sale\Registry\ENTITY_SHIPMENT
const ENTITY_SHIPMENT
Определения
registry.php:19
Bitrix\Sale\Shipment
Определения
shipment.php:21
$name
$name
Определения
menu_edit.php:35
Bitrix\Main\Localization
Определения
culture.php:8
Bitrix\Main
Bitrix\Sale\Discount\Result
Определения
compatibleformat.php:2
$payment
$payment
Определения
payment.php:14
bitrix
modules
sale
lib
payableshipmentitem.php
Создано системой
1.14.0