Merge pull request #21307 from civicrm/5.41
[civicrm-core.git] / xml / schema / Price / LineItem.xml
1 <?xml version="1.0" encoding="iso-8859-1" ?>
2
3 <table>
4 <base>CRM/Price</base>
5 <class>LineItem</class>
6 <name>civicrm_line_item</name>
7 <add>1.7</add>
8 <log>true</log>
9 <component>CiviContribute</component>
10 <field>
11 <name>id</name>
12 <title>Line Item ID</title>
13 <type>int unsigned</type>
14 <required>true</required>
15 <comment>Line Item</comment>
16 <html>
17 <type>Number</type>
18 </html>
19 <add>1.7</add>
20 </field>
21 <primaryKey>
22 <name>id</name>
23 <autoincrement>true</autoincrement>
24 </primaryKey>
25 <field>
26 <name>entity_table</name>
27 <title>Line Item Entity Type</title>
28 <type>varchar</type>
29 <length>64</length>
30 <required>true</required>
31 <pseudoconstant>
32 <callback>CRM_Price_BAO_LineItem::entityTables</callback>
33 </pseudoconstant>
34 <comment>May contain civicrm_contribution, civicrm_participant or civicrm_membership</comment>
35 <add>1.7</add>
36 </field>
37 <field>
38 <name>entity_id</name>
39 <title>Line Item Entity</title>
40 <type>int unsigned</type>
41 <required>true</required>
42 <comment>entry in table</comment>
43 <add>1.7</add>
44 </field>
45 <dynamicForeignKey>
46 <idColumn>entity_id</idColumn>
47 <typeColumn>entity_table</typeColumn>
48 <add>1.7</add>
49 </dynamicForeignKey>
50 <field>
51 <name>contribution_id</name>
52 <title>Contribution ID</title>
53 <type>int unsigned</type>
54 <comment>FK to civicrm_contribution</comment>
55 <html>
56 <label>Contribution</label>
57 </html>
58 <add>4.5</add>
59 </field>
60 <foreignKey>
61 <name>contribution_id</name>
62 <table>civicrm_contribution</table>
63 <key>id</key>
64 <onDelete>SET NULL</onDelete>
65 </foreignKey>
66 <field>
67 <name>price_field_id</name>
68 <title>Price Field ID</title>
69 <type>int unsigned</type>
70 <comment>FK to civicrm_price_field</comment>
71 <pseudoconstant>
72 <table>civicrm_price_field</table>
73 <keyColumn>id</keyColumn>
74 <nameColumn>name</nameColumn>
75 <labelColumn>label</labelColumn>
76 </pseudoconstant>
77 <!-- changed to not required in 4.3 in order to change ON DELETE CASCADE FK constraint to SET NULL -->
78 <html>
79 <label>Price Field</label>
80 </html>
81 <add>1.7</add>
82 </field>
83 <foreignKey>
84 <name>price_field_id</name>
85 <table>civicrm_price_field</table>
86 <key>id</key>
87 <onDelete>SET NULL</onDelete>
88 </foreignKey>
89 <field>
90 <name>label</name>
91 <title>Line Item Label</title>
92 <type>varchar</type>
93 <length>255</length>
94 <default>NULL</default>
95 <!-- changed to not required in 4.2.3 -->
96 <comment>descriptive label for item - from price_field_value.label</comment>
97 <add>1.7</add>
98 <html>
99 <type>Text</type>
100 </html>
101 </field>
102 <field>
103 <name>qty</name>
104 <title>Line Item Quantity</title>
105 <type>decimal</type>
106 <required>true</required>
107 <comment>How many items ordered</comment>
108 <add>1.7</add>
109 <html>
110 <type>Text</type>
111 </html>
112 </field>
113 <field>
114 <name>unit_price</name>
115 <type>decimal</type>
116 <required>true</required>
117 <comment>price of each item</comment>
118 <add>1.7</add>
119 <html>
120 <type>Text</type>
121 <label>Unit Price</label>
122 </html>
123 </field>
124 <field>
125 <name>line_total</name>
126 <title>Line Item Total</title>
127 <type>decimal</type>
128 <required>true</required>
129 <comment>qty * unit_price</comment>
130 <add>1.7</add>
131 </field>
132 <field>
133 <name>participant_count</name>
134 <title>Line Item Participant Count</title>
135 <type>int unsigned</type>
136 <default>NULL</default>
137 <comment>Participant count for field</comment>
138 <html>
139 <type>Text</type>
140 </html>
141 <add>3.2</add>
142
143 </field>
144 <index>
145 <name>UI_line_item_value</name>
146 <fieldName>entity_id</fieldName>
147 <fieldName>entity_table</fieldName>
148 <fieldName>contribution_id</fieldName>
149 <fieldName>price_field_value_id</fieldName>
150 <fieldName>price_field_id</fieldName>
151 <unique>true</unique>
152 <add>3.3</add>
153 <change>4.5</change>
154 <!-- Add contribution_id to unique index in 4.5 -->
155 </index>
156 <field>
157 <name>price_field_value_id</name>
158 <title>Option ID</title>
159 <type>int unsigned</type>
160 <default>NULL</default>
161 <comment>FK to civicrm_price_field_value</comment>
162 <pseudoconstant>
163 <table>civicrm_price_field_value</table>
164 <keyColumn>id</keyColumn>
165 <nameColumn>name</nameColumn>
166 <labelColumn>label</labelColumn>
167 </pseudoconstant>
168 <html>
169 <label>Option</label>
170 </html>
171 <add>3.3</add>
172 </field>
173 <foreignKey>
174 <name>price_field_value_id</name>
175 <table>civicrm_price_field_value</table>
176 <key>id</key>
177 <onDelete>SET NULL</onDelete>
178 </foreignKey>
179 <field>
180 <name>financial_type_id</name>
181 <title>Financial Type ID</title>
182 <type>int unsigned</type>
183 <default>NULL</default>
184 <pseudoconstant>
185 <table>civicrm_financial_type</table>
186 <keyColumn>id</keyColumn>
187 <labelColumn>name</labelColumn>
188 </pseudoconstant>
189 <comment>FK to Financial Type.</comment>
190 <add>4.3</add>
191 <html>
192 <type>Select</type>
193 <label>Financial Type</label>
194 </html>
195 </field>
196 <foreignKey>
197 <name>financial_type_id</name>
198 <table>civicrm_financial_type</table>
199 <key>id</key>
200 <onDelete>SET NULL</onDelete>
201 <add>4.3</add>
202 </foreignKey>
203 <field>
204 <name>non_deductible_amount</name>
205 <title>Non-deductible Amount</title>
206 <type>decimal</type>
207 <default>0.0</default>
208 <headerPattern>/non?.?deduct/i</headerPattern>
209 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
210 <required>true</required>
211 <comment>Portion of total amount which is NOT tax deductible.</comment>
212 <add>4.7</add>
213 <html>
214 <type>Text</type>
215 </html>
216 </field>
217 <field>
218 <name>tax_amount</name>
219 <title>Tax Amount</title>
220 <type>decimal</type>
221 <import>true</import>
222 <headerPattern>/tax(.?am(ou)?nt)?/i</headerPattern>
223 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
224 <comment>tax of each item</comment>
225 <add>4.6</add>
226 <html>
227 <type>Text</type>
228 </html>
229 </field>
230 <field>
231 <name>membership_num_terms</name>
232 <title>Number of membership terms purchased</title>
233 <type>int unsigned</type>
234 <default>NULL</default>
235 <comment>Number of terms for this membership (only supported in Order->Payment flow). If the field is NULL it means unknown and it will be assumed to be 1 during payment.create if entity_table is civicrm_membership</comment>
236 <add>5.40</add>
237 </field>
238 </table>