Merge pull request #19057 from ixiam/dev/core#2173
[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 <add>1.7</add>
17 </field>
18 <primaryKey>
19 <name>id</name>
20 <autoincrement>true</autoincrement>
21 </primaryKey>
22 <field>
23 <name>entity_table</name>
24 <title>Line Item Entity Type</title>
25 <type>varchar</type>
26 <length>64</length>
27 <required>true</required>
28 <comment>table which has the transaction</comment>
29 <add>1.7</add>
30 </field>
31 <field>
32 <name>entity_id</name>
33 <title>Line Item Entity</title>
34 <type>int unsigned</type>
35 <required>true</required>
36 <comment>entry in table</comment>
37 <add>1.7</add>
38 </field>
39 <dynamicForeignKey>
40 <idColumn>entity_id</idColumn>
41 <typeColumn>entity_table</typeColumn>
42 <add>1.7</add>
43 </dynamicForeignKey>
44 <field>
45 <name>contribution_id</name>
46 <title>Line Item Contribution</title>
47 <type>int unsigned</type>
48 <comment>FK to civicrm_contribution</comment>
49 <add>4.5</add>
50 </field>
51 <foreignKey>
52 <name>contribution_id</name>
53 <table>civicrm_contribution</table>
54 <key>id</key>
55 <onDelete>SET NULL</onDelete>
56 </foreignKey>
57 <field>
58 <name>price_field_id</name>
59 <title>Line Item Price Field</title>
60 <type>int unsigned</type>
61 <comment>FK to civicrm_price_field</comment>
62 <pseudoconstant>
63 <table>civicrm_price_field</table>
64 <keyColumn>id</keyColumn>
65 <nameColumn>name</nameColumn>
66 <labelColumn>label</labelColumn>
67 </pseudoconstant>
68 <!-- changed to not required in 4.3 in order to change ON DELETE CASCADE FK constraint to SET NULL -->
69 <add>1.7</add>
70 </field>
71 <foreignKey>
72 <name>price_field_id</name>
73 <table>civicrm_price_field</table>
74 <key>id</key>
75 <onDelete>SET NULL</onDelete>
76 </foreignKey>
77 <field>
78 <name>label</name>
79 <title>Line Item Label</title>
80 <type>varchar</type>
81 <length>255</length>
82 <default>NULL</default>
83 <!-- changed to not required in 4.2.3 -->
84 <comment>descriptive label for item - from price_field_value.label</comment>
85 <add>1.7</add>
86 <html>
87 <type>Text</type>
88 </html>
89 </field>
90 <field>
91 <name>qty</name>
92 <title>Line Item Quantity</title>
93 <type>decimal</type>
94 <required>true</required>
95 <comment>How many items ordered</comment>
96 <add>1.7</add>
97 <html>
98 <type>Text</type>
99 </html>
100 </field>
101 <field>
102 <name>unit_price</name>
103 <type>decimal</type>
104 <required>true</required>
105 <comment>price of each item</comment>
106 <add>1.7</add>
107 <html>
108 <type>Text</type>
109 </html>
110 </field>
111 <field>
112 <name>line_total</name>
113 <title>Line Item Total</title>
114 <type>decimal</type>
115 <required>true</required>
116 <comment>qty * unit_price</comment>
117 <add>1.7</add>
118 </field>
119 <field>
120 <name>participant_count</name>
121 <title>Line Item Participant Count</title>
122 <type>int unsigned</type>
123 <default>NULL</default>
124 <comment>Participant count for field</comment>
125 <html>
126 <type>Text</type>
127 </html>
128 <add>3.2</add>
129
130 </field>
131 <index>
132 <name>index_entity</name>
133 <fieldName>entity_table</fieldName>
134 <fieldName>entity_id</fieldName>
135 <add>1.7</add>
136 </index>
137 <index>
138 <name>UI_line_item_value</name>
139 <fieldName>entity_table</fieldName>
140 <fieldName>entity_id</fieldName>
141 <fieldName>contribution_id</fieldName>
142 <fieldName>price_field_value_id</fieldName>
143 <fieldName>price_field_id</fieldName>
144 <unique>true</unique>
145 <add>3.3</add>
146 <change>4.5</change>
147 <!-- Add contribution_id to unique index in 4.5 -->
148 </index>
149 <field>
150 <name>price_field_value_id</name>
151 <title>Line Item Option</title>
152 <type>int unsigned</type>
153 <default>NULL</default>
154 <comment>FK to civicrm_price_field_value</comment>
155 <pseudoconstant>
156 <table>civicrm_price_field_value</table>
157 <keyColumn>id</keyColumn>
158 <nameColumn>name</nameColumn>
159 <labelColumn>label</labelColumn>
160 </pseudoconstant>
161 <add>3.3</add>
162 </field>
163 <foreignKey>
164 <name>price_field_value_id</name>
165 <table>civicrm_price_field_value</table>
166 <key>id</key>
167 <onDelete>SET NULL</onDelete>
168 </foreignKey>
169 <field>
170 <name>financial_type_id</name>
171 <title>Financial Type ID</title>
172 <type>int unsigned</type>
173 <default>NULL</default>
174 <pseudoconstant>
175 <table>civicrm_financial_type</table>
176 <keyColumn>id</keyColumn>
177 <labelColumn>name</labelColumn>
178 </pseudoconstant>
179 <comment>FK to Financial Type.</comment>
180 <add>4.3</add>
181 <html>
182 <type>Select</type>
183 <label>Financial Type</label>
184 </html>
185 </field>
186 <foreignKey>
187 <name>financial_type_id</name>
188 <table>civicrm_financial_type</table>
189 <key>id</key>
190 <onDelete>SET NULL</onDelete>
191 <add>4.3</add>
192 </foreignKey>
193 <field>
194 <name>non_deductible_amount</name>
195 <title>Non-deductible Amount</title>
196 <type>decimal</type>
197 <default>0.0</default>
198 <headerPattern>/non?.?deduct/i</headerPattern>
199 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
200 <required>true</required>
201 <comment>Portion of total amount which is NOT tax deductible.</comment>
202 <add>4.7</add>
203 <html>
204 <type>Text</type>
205 </html>
206 </field>
207 <field>
208 <name>tax_amount</name>
209 <title>Tax Amount</title>
210 <type>decimal</type>
211 <import>true</import>
212 <headerPattern>/tax(.?am(ou)?nt)?/i</headerPattern>
213 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
214 <comment>tax of each item</comment>
215 <add>4.6</add>
216 <html>
217 <type>Text</type>
218 </html>
219 </field>
220 </table>
221