Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
location.php
1
<?php
8
namespace
Bitrix\Sale\Location\Name
;
9
10
use
Bitrix\Main
;
11
use
Bitrix\Main\Entity
;
12
use
Bitrix\Sale\Location
;
13
use
Bitrix\Main\Localization\Loc
;
14
15
Loc::loadMessages
(__FILE__);
16
33
class
LocationTable
extends
NameEntity
34
{
35
public
static
function
getFilePath
()
36
{
37
return
__FILE__;
38
}
39
40
public
static
function
getTableName
()
41
{
42
return
'b_sale_loc_name'
;
43
}
44
45
public
static
function
add
(array $data)
46
{
47
if
($data[
'NAME'
] <>
''
)
48
{
49
$data[
'NAME_UPPER'
] = ToUpper($data[
'NAME'
]);
// bitrix to upper
50
51
if
(!isset($data[
'NAME_NORM'
]) && isset($data[
'LANGUAGE_ID'
]))
52
{
53
$data[
'NAME_NORM'
] = Location\Normalizer\Builder::build($data[
'LANGUAGE_ID'
])->normalize($data[
'NAME'
]);
54
}
55
}
56
57
return
parent::add($data);
58
}
59
60
public
static
function
update
($primary, array $data)
61
{
62
if
($data[
'NAME'
] <>
''
)
63
{
64
$data[
'NAME_UPPER'
] = ToUpper($data[
'NAME'
]);
// bitrix to upper
65
66
if
(!isset($data[
'NAME_NORM'
]) && isset($data[
'LANGUAGE_ID'
]))
67
{
68
$data[
'NAME_NORM'
] = Location\Normalizer\Builder::build($data[
'LANGUAGE_ID'
])->normalize($data[
'NAME'
]);
69
}
70
}
71
72
return
parent::update($primary, $data);
73
}
74
75
public
static
function
getReferenceFieldName
()
76
{
77
return
'LOCATION_ID'
;
78
}
79
80
public
static
function
getMap
()
81
{
82
return
array(
83
84
'ID'
=> array(
85
'data_type'
=>
'integer'
,
86
'primary'
=>
true
,
87
'autocomplete'
=>
true
,
88
),
89
'NAME'
=> array(
90
'data_type'
=>
'string'
,
91
'required'
=>
true
,
92
'title'
=>
Loc::getMessage
(
'SALE_LOCATION_NAME_LOCATION_ENTITY_NAME_FIELD'
)
93
),
94
'NAME_UPPER'
=> array(
95
'data_type'
=>
'string'
,
96
),
97
'SHORT_NAME'
=> array(
98
'data_type'
=>
'string'
,
99
'title'
=>
Loc::getMessage
(
'SALE_LOCATION_NAME_LOCATION_ENTITY_SHORT_NAME_FIELD'
)
100
),
101
'NAME_NORM'
=> array(
102
'data_type'
=>
'string'
,
103
),
104
'LANGUAGE_ID'
=> array(
105
'data_type'
=>
'string'
,
106
'required'
=>
true
,
107
'title'
=>
Loc::getMessage
(
'SALE_LOCATION_NAME_LOCATION_ENTITY_LANGUAGE_ID_FIELD'
)
108
),
109
110
'LOCATION_ID'
=> array(
111
'data_type'
=>
'integer'
,
112
'required'
=>
true
,
113
'title'
=>
Loc::getMessage
(
'SALE_LOCATION_NAME_LOCATION_ENTITY_LOCATION_ID_FIELD'
)
114
),
115
'LOCATION'
=> array(
116
'data_type'
=>
'Bitrix\Sale\Location\Location'
,
117
'required'
=>
true
,
118
'reference'
=> array(
119
'=this.LOCATION_ID'
=>
'ref.ID'
120
)
121
),
122
123
'CNT'
=> array(
124
'data_type'
=>
'integer'
,
125
'expression'
=> array(
126
'count(*)'
127
)
128
),
129
);
130
}
131
}
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\Entity
Definition
entity.php:26
Bitrix\Sale\Location\LocationTable
Definition
location.php:39
Bitrix\Sale\Location\Name\LocationTable\getMap
static getMap()
Definition
location.php:80
Bitrix\Sale\Location\Name\LocationTable\getFilePath
static getFilePath()
Definition
location.php:35
Bitrix\Sale\Location\Name\LocationTable\add
static add(array $data)
Definition
location.php:45
Bitrix\Sale\Location\Name\LocationTable\getReferenceFieldName
static getReferenceFieldName()
Definition
location.php:75
Bitrix\Sale\Location\Name\LocationTable\update
static update($primary, array $data)
Definition
location.php:60
Bitrix\Sale\Location\Name\LocationTable\getTableName
static getTableName()
Definition
location.php:40
Bitrix\Sale\Location\Name\NameEntity
Definition
nameentity.php:19
Bitrix\Main
Bitrix\Sale\Location\Name
Definition
group.php:8
Bitrix\Sale\Location
modules
sale
lib
location
name
location.php
Создано системой
1.10.0