Add entity paths to schema & APIv4
[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>
8e17d9d3 61 <pseudoconstant>
62 <table>civicrm_price_field</table>
63 <keyColumn>id</keyColumn>
64 <nameColumn>name</nameColumn>
65 <labelColumn>label</labelColumn>
66 </pseudoconstant>
6a488035
TO
67 <!-- changed to not required in 4.3 in order to change ON DELETE CASCADE FK constraint to SET NULL -->
68 <add>1.7</add>
69 </field>
70 <foreignKey>
71 <name>price_field_id</name>
72 <table>civicrm_price_field</table>
73 <key>id</key>
74 <onDelete>SET NULL</onDelete>
75 </foreignKey>
6a488035
TO
76 <field>
77 <name>label</name>
32ac94e8 78 <title>Line Item Label</title>
6a488035
TO
79 <type>varchar</type>
80 <length>255</length>
81 <default>NULL</default>
82 <!-- changed to not required in 4.2.3 -->
83 <comment>descriptive label for item - from price_field_value.label</comment>
84 <add>1.7</add>
614d72ec 85 <html>
86 <type>Text</type>
87 </html>
6a488035
TO
88 </field>
89 <field>
90 <name>qty</name>
32ac94e8 91 <title>Line Item Quantity</title>
4728de9f 92 <type>decimal</type>
6a488035
TO
93 <required>true</required>
94 <comment>How many items ordered</comment>
95 <add>1.7</add>
614d72ec 96 <html>
97 <type>Text</type>
98 </html>
6a488035
TO
99 </field>
100 <field>
101 <name>unit_price</name>
102 <type>decimal</type>
103 <required>true</required>
104 <comment>price of each item</comment>
105 <add>1.7</add>
614d72ec 106 <html>
107 <type>Text</type>
108 </html>
6a488035
TO
109 </field>
110 <field>
111 <name>line_total</name>
32ac94e8 112 <title>Line Item Total</title>
6a488035
TO
113 <type>decimal</type>
114 <required>true</required>
115 <comment>qty * unit_price</comment>
116 <add>1.7</add>
117 </field>
118 <field>
119 <name>participant_count</name>
32ac94e8 120 <title>Line Item Participant Count</title>
6a488035
TO
121 <type>int unsigned</type>
122 <default>NULL</default>
32ac94e8 123 <comment>Participant count for field</comment>
5435b737
EM
124 <html>
125 <type>Text</type>
32ac94e8 126 </html>
6a488035 127 <add>3.2</add>
6cc0b7bd 128
6a488035
TO
129 </field>
130 <index>
131 <name>index_entity</name>
132 <fieldName>entity_table</fieldName>
133 <fieldName>entity_id</fieldName>
134 <add>1.7</add>
135 </index>
136 <index>
137 <name>UI_line_item_value</name>
138 <fieldName>entity_table</fieldName>
139 <fieldName>entity_id</fieldName>
265f68c1 140 <fieldName>contribution_id</fieldName>
6a488035
TO
141 <fieldName>price_field_value_id</fieldName>
142 <fieldName>price_field_id</fieldName>
143 <unique>true</unique>
144 <add>3.3</add>
d3c618dd
DG
145 <change>4.5</change>
146 <!-- Add contribution_id to unique index in 4.5 -->
6a488035
TO
147 </index>
148 <field>
149 <name>price_field_value_id</name>
32ac94e8 150 <title>Line Item Option</title>
6a488035
TO
151 <type>int unsigned</type>
152 <default>NULL</default>
153 <comment>FK to civicrm_price_field_value</comment>
8e17d9d3 154 <pseudoconstant>
155 <table>civicrm_price_field_value</table>
156 <keyColumn>id</keyColumn>
157 <nameColumn>name</nameColumn>
158 <labelColumn>label</labelColumn>
159 </pseudoconstant>
6a488035
TO
160 <add>3.3</add>
161 </field>
162 <foreignKey>
163 <name>price_field_value_id</name>
164 <table>civicrm_price_field_value</table>
165 <key>id</key>
166 <onDelete>SET NULL</onDelete>
167 </foreignKey>
6f3f0f22 168 <field>
169 <name>financial_type_id</name>
8e17d9d3 170 <title>Financial Type ID</title>
6f3f0f22 171 <type>int unsigned</type>
6a488035 172 <default>NULL</default>
6cc0b7bd
EM
173 <pseudoconstant>
174 <table>civicrm_financial_type</table>
175 <keyColumn>id</keyColumn>
176 <labelColumn>name</labelColumn>
177 </pseudoconstant>
6a488035 178 <comment>FK to Financial Type.</comment>
6f3f0f22 179 <add>4.3</add>
614d72ec 180 <html>
181 <type>Select</type>
8e17d9d3 182 <label>Financial Type</label>
614d72ec 183 </html>
6f3f0f22 184 </field>
185 <foreignKey>
186 <name>financial_type_id</name>
187 <table>civicrm_financial_type</table>
188 <key>id</key>
6a488035
TO
189 <onDelete>SET NULL</onDelete>
190 <add>4.3</add>
6f3f0f22 191 </foreignKey>
192 <field>
5afce5ad 193 <name>non_deductible_amount</name>
194 <title>Non-deductible Amount</title>
6f3f0f22 195 <type>decimal</type>
6a488035 196 <default>0.0</default>
5afce5ad 197 <headerPattern>/non?.?deduct/i</headerPattern>
6a488035 198 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
6f3f0f22 199 <required>true</required>
5afce5ad 200 <comment>Portion of total amount which is NOT tax deductible.</comment>
201 <add>4.7</add>
614d72ec 202 <html>
203 <type>Text</type>
204 </html>
6f3f0f22 205 </field>
d91b8b33 206 <field>
207 <name>tax_amount</name>
115fa278 208 <title>Tax Amount</title>
d91b8b33 209 <type>decimal</type>
210 <import>true</import>
211 <headerPattern>/tax(.?am(ou)?nt)?/i</headerPattern>
212 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
213 <comment>tax of each item</comment>
115fa278 214 <add>4.6</add>
d91b8b33 215 <html>
216 <type>Text</type>
217 </html>
218 </field>
6a488035
TO
219</table>
220