Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
orderround.php
1
<?php
2
namespace
Bitrix\Sale\Internals
;
3
4
use
Bitrix\Main
,
5
Bitrix\Main\Localization\Loc
;
6
Loc::loadMessages
(__FILE__);
7
40
class
OrderRoundTable
extends
Main\Entity\DataManager
41
{
42
const
ENTITY_TYPE_BASKET_ITEM
= 0x0001;
44
const
ENTITY_TYPE_BASKET
=
self::ENTITY_TYPE_BASKET_ITEM
;
45
51
public
static
function
getTableName
()
52
{
53
return
'b_sale_order_round'
;
54
}
55
61
public
static
function
getMap
()
62
{
63
return
array(
64
'ID'
=>
new
Main\
Entity
\
IntegerField
(
'ID'
, array(
65
'primary'
=>
true
,
66
'autocomplete'
=>
true
,
67
'title'
=>
Loc::getMessage
(
'ORDER_ROUND_ENTITY_ID_FIELD'
)
68
)),
69
'ORDER_ID'
=>
new
Main\
Entity
\
IntegerField
(
'ORDER_ID'
, array(
70
'required'
=>
true
,
71
'title'
=>
Loc::getMessage
(
'ORDER_ROUND_ENTITY_ORDER_ID_FIELD'
)
72
)),
73
'APPLY_BLOCK_COUNTER'
=>
new
Main\
Entity
\
IntegerField
(
'APPLY_BLOCK_COUNTER'
, array(
74
'required'
=>
true
,
75
)),
76
'ORDER_ROUND'
=>
new
Main\
Entity
\
BooleanField
(
'ORDER_ROUND'
, array(
77
'required'
=>
true
,
78
'values'
=> array(
'N'
,
'Y'
),
79
'default_value'
=>
'Y'
,
80
'title'
=>
Loc::getMessage
(
'ORDER_ROUND_ENTITY_ORDER_ROUND_FIELD'
)
81
)),
82
'ENTITY_TYPE'
=>
new
Main\
Entity
\
EnumField
(
'ENTITY_TYPE'
, array(
83
'required'
=>
true
,
84
'values'
=> array(self::ENTITY_TYPE_BASKET_ITEM),
85
'title'
=>
Loc::getMessage
(
'ORDER_ROUND_ENTITY_ENTITY_TYPE_FIELD'
)
86
)),
87
'ENTITY_ID'
=>
new
Main\
Entity
\
IntegerField
(
'ENTITY_ID'
, array(
88
'required'
=>
true
,
89
'title'
=>
Loc::getMessage
(
'ORDER_ROUND_ENTITY_ENTITY_ID_FIELD'
)
90
)),
91
'ENTITY_VALUE'
=>
new
Main\
Entity
\
StringField
(
'ENTITY_VALUE'
, array(
92
'validation'
=> array(__CLASS__,
'validateEntityValue'
),
93
'title'
=>
Loc::getMessage
(
'ORDER_ROUND_ENTITY_ENTITY_VALUE_FIELD'
)
94
)),
95
'APPLY'
=>
new
Main\
Entity
\
BooleanField
(
'APPLY'
, array(
96
'required'
=>
true
,
97
'values'
=> array(
'N'
,
'Y'
),
98
'title'
=>
Loc::getMessage
(
'ORDER_ROUND_ENTITY_APPLY_FIELD'
)
99
)),
100
'ROUND_RULE'
=>
new
Main\
Entity
\
TextField
(
'ROUND_RULE'
, array(
101
'required'
=>
true
,
102
'serialized'
=>
true
103
))
104
);
105
}
106
112
public
static
function
validateEntityValue
()
113
{
114
return
array(
115
new
Main\
Entity
\Validator\Length(
null
, 255),
116
);
117
}
118
125
public
static
function
clearByOrder
($order)
126
{
127
$order = (int)$order;
128
if
($order <= 0)
129
return
false
;
130
131
$conn = Main\Application::getConnection();
132
$helper = $conn->getSqlHelper();
133
$conn->queryExecute(
'delete from '
.$helper->quote(self::getTableName()).
' where '
.$helper->quote(
'ORDER_ID'
).
' = '
.$order);
134
unset($helper, $conn);
135
136
return
true
;
137
}
138
}
Bitrix\Catalog\Model\Entity
Definition
entity.php:12
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Main\ORM\Fields\BooleanField
Definition
booleanfield.php:20
Bitrix\Main\ORM\Fields\EnumField
Definition
enumfield.php:20
Bitrix\Main\ORM\Fields\IntegerField
Definition
integerfield.php:20
Bitrix\Main\ORM\Fields\StringField
Definition
stringfield.php:20
Bitrix\Main\ORM\Fields\TextField
Definition
textfield.php:20
Bitrix\Sale\Internals\OrderRoundTable
Definition
orderround.php:41
Bitrix\Sale\Internals\OrderRoundTable\getMap
static getMap()
Definition
orderround.php:61
Bitrix\Sale\Internals\OrderRoundTable\ENTITY_TYPE_BASKET
const ENTITY_TYPE_BASKET
Definition
orderround.php:44
Bitrix\Sale\Internals\OrderRoundTable\clearByOrder
static clearByOrder($order)
Definition
orderround.php:125
Bitrix\Sale\Internals\OrderRoundTable\ENTITY_TYPE_BASKET_ITEM
const ENTITY_TYPE_BASKET_ITEM
Definition
orderround.php:42
Bitrix\Sale\Internals\OrderRoundTable\validateEntityValue
static validateEntityValue()
Definition
orderround.php:112
Bitrix\Sale\Internals\OrderRoundTable\getTableName
static getTableName()
Definition
orderround.php:51
Bitrix\Main
Bitrix\Sale\Internals
Definition
accountnumber.php:3
modules
sale
lib
internals
orderround.php
Создано системой
1.10.0