Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
elementbatchitem.php
1
<?php
2
namespace
Bitrix\Catalog\Product\Store\BatchBalancer\Entity
;
3
4
use Bitrix\Catalog\EO_StoreBatch_Collection;
5
use Bitrix\Catalog\EO_StoreBatchDocumentElement;
6
use
Bitrix\Catalog\StoreDocumentElementTable
;
7
use
Bitrix\Catalog\StoreDocumentTable
;
8
use
Bitrix\Catalog\StoreBatchTable
;
9
use
Bitrix\Currency\CurrencyManager
;
10
use
Bitrix\Main\ArgumentException
;
11
use
Bitrix\Main\Error
;
12
use
Bitrix\Main\Loader
;
13
use
Bitrix\Main\ObjectPropertyException
;
14
use
Bitrix\Main\Result
;
15
use
Bitrix\Main\SystemException
;
16
use
Bitrix\Sale\Internals\ShipmentItemStoreTable
;
17
use phpDocumentor\Reflection\Types\Boolean;
18
24
class
ElementBatchItem
implements
InventoryTreeItem
25
{
26
private
EO_StoreBatchDocumentElement $bindingElement;
27
private
int
$storeId;
28
private
string
$storeItemHash;
29
30
public
function
__construct
(EO_StoreBatchDocumentElement $bindingElement,
int
$storeId)
31
{
32
$this->bindingElement = $bindingElement;
33
34
$this->storeId = $storeId;
35
}
36
37
public
function
getElement
(): EO_StoreBatchDocumentElement
38
{
39
return
$this->bindingElement;
40
}
41
42
public
function
isArrivalElement
(): bool
43
{
44
return
$this->bindingElement->getAmount() > 0;
45
}
46
47
public
function
getStoreId
(): int
48
{
49
return
$this->storeId;
50
}
51
52
public
function
setStoreItemHash
(
string
$storeItemHash): void
53
{
54
$this->storeItemHash = $storeItemHash;
55
}
56
57
public
function
getStoreItemHash
(): string
58
{
59
return
$this->storeItemHash;
60
}
61
62
public
function
getAmount
(): float
63
{
64
return
abs($this->bindingElement->getAmount());
65
}
66
67
public
function
save
():
Result
68
{
69
if
(empty($this->bindingElement->getProductBatchId()))
70
{
71
$result =
new
Result
();
72
$result->addError(
new
Error
(
'Empty store batch'
));
73
74
return
$result;
75
}
76
77
return
$this->bindingElement->save();
78
}
79
}
Bitrix\Catalog\Product\Store\BatchBalancer\Entity\ElementBatchItem
Definition
elementbatchitem.php:25
Bitrix\Catalog\Product\Store\BatchBalancer\Entity\ElementBatchItem\getStoreId
getStoreId()
Definition
elementbatchitem.php:47
Bitrix\Catalog\Product\Store\BatchBalancer\Entity\ElementBatchItem\getStoreItemHash
getStoreItemHash()
Definition
elementbatchitem.php:57
Bitrix\Catalog\Product\Store\BatchBalancer\Entity\ElementBatchItem\getAmount
getAmount()
Definition
elementbatchitem.php:62
Bitrix\Catalog\Product\Store\BatchBalancer\Entity\ElementBatchItem\setStoreItemHash
setStoreItemHash(string $storeItemHash)
Definition
elementbatchitem.php:52
Bitrix\Catalog\Product\Store\BatchBalancer\Entity\ElementBatchItem\__construct
__construct(EO_StoreBatchDocumentElement $bindingElement, int $storeId)
Definition
elementbatchitem.php:30
Bitrix\Catalog\Product\Store\BatchBalancer\Entity\ElementBatchItem\getElement
getElement()
Definition
elementbatchitem.php:37
Bitrix\Catalog\Product\Store\BatchBalancer\Entity\ElementBatchItem\save
save()
Definition
elementbatchitem.php:67
Bitrix\Catalog\Product\Store\BatchBalancer\Entity\ElementBatchItem\isArrivalElement
isArrivalElement()
Definition
elementbatchitem.php:42
Bitrix\Catalog\StoreBatchTable
Definition
storebatchtable.php:27
Bitrix\Catalog\StoreDocumentElementTable
Definition
storedocumentelementtable.php:50
Bitrix\Catalog\StoreDocumentTable
Definition
storedocumenttable.php:65
Bitrix\Currency\CurrencyManager
Definition
currencymanager.php:15
Bitrix\Main\ArgumentException
Definition
exception.php:34
Bitrix\Main\Error
Definition
error.php:14
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Main\ORM\Data\Result
Definition
result.php:16
Bitrix\Main\ObjectPropertyException
Definition
exception.php:181
Bitrix\Main\Result
Definition
result.php:14
Bitrix\Main\SystemException
Definition
exception.php:8
Bitrix\Sale\Internals\ShipmentItemStoreTable
Definition
shipmentitemstore.php:41
Bitrix\Catalog\Product\Store\BatchBalancer\Entity\InventoryTreeItem
Definition
inventorytreeitem.php:12
Bitrix\Catalog\Product\Store\BatchBalancer\Entity
Definition
elementbatchitem.php:2
modules
catalog
lib
product
store
batchbalancer
entity
elementbatchitem.php
Создано системой
1.10.0