Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
location.php
1<?php
9
10use Bitrix\Main;
14
15Loc::loadMessages(__FILE__);
16
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}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
static update($primary, array $data)
Definition location.php:60