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