Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
StoreDocument.php
1
<?php
2
3
namespace
Bitrix\Catalog\Access\Model
;
4
5
use
Bitrix\Catalog\StoreDocumentTable
;
6
use
Bitrix\Main\Access\AccessibleItem
;
7
8
class
StoreDocument
implements
AccessibleItem
9
{
10
public
const
TYPE_ARRIVAL
=
StoreDocumentTable::TYPE_ARRIVAL
;
11
public
const
TYPE_STORE_ADJUSTMENT
=
StoreDocumentTable::TYPE_STORE_ADJUSTMENT
;
12
public
const
TYPE_MOVING
=
StoreDocumentTable::TYPE_MOVING
;
13
public
const
TYPE_DEDUCT
=
StoreDocumentTable::TYPE_DEDUCT
;
14
public
const
TYPE_SALES_ORDERS
=
StoreDocumentTable::TYPE_SALES_ORDERS
;
15
16
private
int
$id;
17
private
?
string
$type;
18
22
public
function
__construct
(
int
$id)
23
{
24
$this->
id
= $id;
25
}
26
32
public
static
function
createFromId
(
int
$itemId):
StoreDocument
33
{
34
return
new
static
($itemId);
35
}
36
44
public
static
function
createFromArray
(array $fields):
StoreDocument
45
{
46
$self =
new
static
(
47
(int)($fields[
'ID'
] ?? 0)
48
);
49
$self->type = $fields[
'DOC_TYPE'
] ??
null
;
50
51
return
$self;
52
}
53
63
public
static
function
createForSaleRealization
(
int
$id):
StoreDocument
64
{
65
$self =
new
static
($id);
66
$self->type =
self::TYPE_SALES_ORDERS
;
67
68
return
$self;
69
}
70
74
public
function
getId
(): int
75
{
76
return
$this->id;
77
}
78
84
public
function
getType
(): ?string
85
{
86
if
(!isset($this->type))
87
{
88
$row =
StoreDocumentTable::getRow
([
89
'select'
=> [
90
'DOC_TYPE'
,
91
],
92
'filter'
=> [
93
'=ID'
=> $this->
getId
(),
94
],
95
]);
96
97
if
($row[
'DOC_TYPE'
])
98
{
99
$this->type = (string)$row[
'DOC_TYPE'
];
100
}
101
else
102
{
103
$this->type =
null
;
104
}
105
}
106
107
return
$this->type;
108
}
109
}
Bitrix\Catalog\Access\Model\StoreDocument
Definition
StoreDocument.php:9
Bitrix\Catalog\Access\Model\StoreDocument\getId
getId()
Definition
StoreDocument.php:74
Bitrix\Catalog\Access\Model\StoreDocument\createForSaleRealization
static createForSaleRealization(int $id)
Definition
StoreDocument.php:63
Bitrix\Catalog\Access\Model\StoreDocument\createFromArray
static createFromArray(array $fields)
Definition
StoreDocument.php:44
Bitrix\Catalog\Access\Model\StoreDocument\TYPE_MOVING
const TYPE_MOVING
Definition
StoreDocument.php:12
Bitrix\Catalog\Access\Model\StoreDocument\TYPE_STORE_ADJUSTMENT
const TYPE_STORE_ADJUSTMENT
Definition
StoreDocument.php:11
Bitrix\Catalog\Access\Model\StoreDocument\TYPE_SALES_ORDERS
const TYPE_SALES_ORDERS
Definition
StoreDocument.php:14
Bitrix\Catalog\Access\Model\StoreDocument\TYPE_ARRIVAL
const TYPE_ARRIVAL
Definition
StoreDocument.php:10
Bitrix\Catalog\Access\Model\StoreDocument\getType
getType()
Definition
StoreDocument.php:84
Bitrix\Catalog\Access\Model\StoreDocument\TYPE_DEDUCT
const TYPE_DEDUCT
Definition
StoreDocument.php:13
Bitrix\Catalog\Access\Model\StoreDocument\createFromId
static createFromId(int $itemId)
Definition
StoreDocument.php:32
Bitrix\Catalog\Access\Model\StoreDocument\__construct
__construct(int $id)
Definition
StoreDocument.php:22
Bitrix\Catalog\StoreDocumentTable
Definition
storedocumenttable.php:65
Bitrix\Catalog\StoreDocumentTable\TYPE_MOVING
const TYPE_MOVING
Definition
storedocumenttable.php:68
Bitrix\Catalog\StoreDocumentTable\TYPE_STORE_ADJUSTMENT
const TYPE_STORE_ADJUSTMENT
Definition
storedocumenttable.php:67
Bitrix\Catalog\StoreDocumentTable\TYPE_SALES_ORDERS
const TYPE_SALES_ORDERS
Definition
storedocumenttable.php:72
Bitrix\Catalog\StoreDocumentTable\TYPE_ARRIVAL
const TYPE_ARRIVAL
Definition
storedocumenttable.php:66
Bitrix\Catalog\StoreDocumentTable\TYPE_DEDUCT
const TYPE_DEDUCT
Definition
storedocumenttable.php:70
Bitrix\Main\ORM\Data\DataManager\getRow
static getRow(array $parameters)
Definition
datamanager.php:410
Bitrix\Main\Access\AccessibleItem
Definition
accessibleitem.php:13
Bitrix\Catalog\Access\Model
Definition
StoreDocument.php:3
modules
catalog
lib
Access
Model
StoreDocument.php
Создано системой
1.10.0