Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
status.php
1
<?php
8
namespace
Bitrix\Sale\Internals
;
9
10
use
Bitrix\Main
;
11
use
Bitrix\Main\Localization\Loc
;
12
29
class
StatusTable
extends
Main\Entity\DataManager
30
{
31
public
const
TYPE_ORDER
=
'O'
;
32
public
const
TYPE_SHIPMENT
=
'D'
;
33
34
public
static
function
getTableName
()
35
{
36
return
'b_sale_status'
;
37
}
38
39
public
static
function
getMap
()
40
{
41
return
array(
42
43
new
Main\
Entity
\
StringField
(
'ID'
, array(
44
'primary'
=>
true
,
45
'validation'
=>
function
()
46
{
47
return
array(
48
new
Main\
Entity
\Validator\RegExp(
'/^[A-Za-z]{1,2}$/'
),
49
new
Main\
Entity
\Validator\Unique,
50
);
51
},
52
'title'
=>
Loc::getMessage
(
'B_SALE_STATUS_ID'
),
53
)),
54
55
new
Main\Entity\BooleanField(
'TYPE'
, array(
56
'default_value'
=> self::TYPE_ORDER,
57
'values'
=> array(self::TYPE_ORDER, self::TYPE_SHIPMENT),
58
'title'
=>
Loc::getMessage
(
'B_SALE_STATUS_TYPE'
),
59
)),
60
61
new
Main\Entity\IntegerField(
'SORT'
, array(
62
'default_value'
=> 100,
63
'format'
=>
'/^[0-9]{1,11}$/'
,
64
'title'
=>
Loc::getMessage
(
'B_SALE_STATUS_SORT'
),
65
)),
66
67
new
Main\Entity\BooleanField(
'NOTIFY'
, array(
68
'default_value'
=>
'Y'
,
69
'values'
=> array(
'N'
,
'Y'
),
70
'title'
=>
Loc::getMessage
(
'B_SALE_STATUS_NOTIFY'
),
71
)),
72
73
new
Main\Entity\StringField(
'COLOR'
, array(
74
'title'
=>
Loc::getMessage
(
'B_SALE_STATUS_COLOR'
),
75
)),
76
77
new
Main\Entity\StringField(
'XML_ID'
, array(
78
'title'
=>
Loc::getMessage
(
'B_SALE_STATUS_XML_ID'
),
79
)),
80
81
new
Main\ORM\Fields\Relations\Reference
(
82
'STATUS_LANG'
,
83
StatusLangTable::class,
84
Main\ORM\
Query
\Join::on(
'this.ID'
,
'ref.STATUS_ID'
),
85
array(
'join_type'
=>
'left'
)
86
)
87
);
88
}
89
99
public
static
function
update
($primary, array $data)
100
{
101
$result = parent::update($primary, $data);
102
if
(Main\
Config
\Option::get(
'sale'
,
'expiration_processing_events'
,
'N'
) ===
'Y'
)
103
{
104
foreach
(GetModuleEvents(
"sale"
,
"OnStatusUpdate"
,
true
) as $event)
105
{
106
ExecuteModuleEventEx($event, array($primary, $data));
107
}
108
}
109
110
return
$result;
111
}
112
121
public
static
function
add
(array $data)
122
{
123
$result = parent::add($data);
124
if
(Main\
Config
\Option::get(
'sale'
,
'expiration_processing_events'
,
'N'
) ===
'Y'
)
125
{
126
$id = $result->getId();
127
foreach
(GetModuleEvents(
"sale"
,
"OnStatusAdd"
,
true
) as $event)
128
{
129
ExecuteModuleEventEx($event, array($id, $data));
130
}
131
}
132
133
return
$result;
134
}
135
139
public
static
function
generateXmlId
()
140
{
141
return
uniqid(
'bx_'
);
142
}
143
}
Bitrix\Catalog\Model\Entity
Definition
entity.php:12
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Main\ORM\Fields\Relations\Reference
Definition
reference.php:26
Bitrix\Main\ORM\Fields\StringField
Definition
stringfield.php:20
Bitrix\Main\ORM\Query\Query
Definition
query.php:118
Bitrix\Sale\Internals\StatusTable
Definition
status.php:30
Bitrix\Sale\Internals\StatusTable\getMap
static getMap()
Definition
status.php:39
Bitrix\Sale\Internals\StatusTable\TYPE_ORDER
const TYPE_ORDER
Definition
status.php:31
Bitrix\Sale\Internals\StatusTable\add
static add(array $data)
Definition
status.php:121
Bitrix\Sale\Internals\StatusTable\generateXmlId
static generateXmlId()
Definition
status.php:139
Bitrix\Sale\Internals\StatusTable\TYPE_SHIPMENT
const TYPE_SHIPMENT
Definition
status.php:32
Bitrix\Sale\Internals\StatusTable\update
static update($primary, array $data)
Definition
status.php:99
Bitrix\Sale\Internals\StatusTable\getTableName
static getTableName()
Definition
status.php:34
Bitrix\Main\Config
Definition
configuration.php:2
Bitrix\Main
Bitrix\Sale\Internals
Definition
accountnumber.php:3
modules
sale
lib
internals
status.php
Создано системой
1.10.0