Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
storedocumentelementtable.php
1<?php
2namespace Bitrix\Catalog;
3
12
50{
51 public const EXTRA_RATE_PERCENTAGE = 1;
52 public const EXTRA_RATE_MONETARY = 2;
58 public static function getTableName()
59 {
60 return 'b_catalog_docs_element';
61 }
62
68 public static function getMap()
69 {
70 return [
71 'ID' => new IntegerField(
72 'ID',
73 [
74 'primary' => true,
75 'autocomplete' => true,
76 'title' => Loc::getMessage('INVENTORY_DOCUMENT_ELEMENT_ENTITY_ID_FIELD'),
77 ]
78 ),
79 'DOC_ID' => new IntegerField(
80 'DOC_ID',
81 [
82 'required' => true,
83 'title' => Loc::getMessage('INVENTORY_DOCUMENT_ELEMENT_ENTITY_DOC_ID_FIELD'),
84 ]
85 ),
86 'STORE_FROM' => new IntegerField(
87 'STORE_FROM',
88 [
89 'title' => Loc::getMessage('INVENTORY_DOCUMENT_ELEMENT_ENTITY_STORE_FROM_FIELD'),
90 ]
91 ),
92 'STORE_TO' => new IntegerField(
93 'STORE_TO',
94 [
95 'title' => Loc::getMessage('INVENTORY_DOCUMENT_ELEMENT_ENTITY_STORE_TO_FIELD'),
96 ]
97 ),
98 'ELEMENT_ID' => new IntegerField(
99 'ELEMENT_ID',
100 [
101 'title' => Loc::getMessage('INVENTORY_DOCUMENT_ELEMENT_ENTITY_ELEMENT_ID_FIELD'),
102 ]
103 ),
104 'AMOUNT' => new FloatField(
105 'AMOUNT',
106 [
107 'title' => Loc::getMessage('INVENTORY_DOCUMENT_ELEMENT_ENTITY_AMOUNT_FIELD'),
108 ]
109 ),
110 'PURCHASING_PRICE' => new IntegerField(
111 'PURCHASING_PRICE',
112 [
113 'title' => Loc::getMessage('INVENTORY_DOCUMENT_ELEMENT_ENTITY_PURCHASING_PRICE_FIELD'),
114 ]
115 ),
116 'BASE_PRICE' => new IntegerField(
117 'BASE_PRICE',
118 [
119 'title' => Loc::getMessage('INVENTORY_DOCUMENT_ELEMENT_ENTITY_BASE_PRICE_FIELD'),
120 ]
121 ),
122 'BASE_PRICE_EXTRA' => new FloatField(
123 'BASE_PRICE_EXTRA',
124 [
125 'title' => Loc::getMessage('INVENTORY_DOCUMENT_ELEMENT_ENTITY_BASE_PRICE_EXTRA_FIELD'),
126 ]
127 ),
128 'BASE_PRICE_EXTRA_RATE' => new EnumField(
129 'BASE_PRICE_EXTRA_RATE',
130 [
131 'title' => Loc::getMessage('INVENTORY_DOCUMENT_ELEMENT_ENTITY_BASE_PRICE_EXTRA_RATE_FIELD'),
132 'values' => [
133 self::EXTRA_RATE_PERCENTAGE, self::EXTRA_RATE_MONETARY
134 ],
135 'default_value' => self::EXTRA_RATE_PERCENTAGE,
136 ]
137 ),
138 'COMMENT' => new StringField(
139 'COMMENT',
140 [
141 'title' => Loc::getMessage('INVENTORY_DOCUMENT_ELEMENT_ENTITY_COMMENT_FIELD'),
142 ]
143 ),
144 'ELEMENT' => new Reference(
145 'ELEMENT',
146 '\Bitrix\Iblock\Element',
147 ['=this.ELEMENT_ID' => 'ref.ID'],
148 ['join_type' => 'LEFT']
149 ),
150 'PRODUCT' => new Reference(
151 'PRODUCT',
152 '\Bitrix\Catalog\Product',
153 ['=this.ELEMENT_ID' => 'ref.ID'],
154 ['join_type' => 'LEFT']
155 ),
156 'DOCUMENT' => new Reference(
157 'DOCUMENT',
158 '\Bitrix\Catalog\StoreDocument',
159 ['=this.DOC_ID' => 'ref.ID'],
160 ['join_type' => 'LEFT']
161 ),
162 'STORE_FROM_REF' => new Reference(
163 'STORE_FROM_REF',
164 '\Bitrix\Catalog\StoreTable',
165 ['=this.STORE_FROM' => 'ref.ID'],
166 ['join_type' => 'LEFT']
167 ),
168 'STORE_TO_REF' => new Reference(
169 'STORE_TO_REF',
170 '\Bitrix\Catalog\StoreTable',
171 ['=this.STORE_TO' => 'ref.ID'],
172 ['join_type' => 'LEFT']
173 ),
174 ];
175 }
176
184 public static function deleteByDocument(int $id): void
185 {
186 if ($id <= 0)
187 {
188 return;
189 }
190
192 $helper = $conn->getSqlHelper();
193 $conn->queryExecute(
194 'delete from ' . $helper->quote(self::getTableName())
195 . ' where ' . $helper->quote('DOC_ID') . ' = ' . $id
196 );
197 unset($helper, $conn);
198 }
199}
static getConnection($name="")
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29