Refactored out of CRM_Core_PseudoConstant: ufGroup(), currencySymbols(). CRM-12464
[civicrm-core.git] / xml / schema / Contribute / Contribution.xml
1 <?xml version="1.0" encoding="iso-8859-1" ?>
2
3 <table>
4 <base>CRM/Contribute</base>
5 <class>Contribution</class>
6 <name>civicrm_contribution</name>
7 <add>1.3</add>
8 <log>true</log>
9 <field>
10 <name>id</name>
11 <uniqueName>contribution_id</uniqueName>
12 <type>int unsigned</type>
13 <required>true</required>
14 <import>true</import>
15 <title>Contribution ID</title>
16 <comment>Contribution ID</comment>
17 <add>1.3</add>
18 </field>
19 <primaryKey>
20 <name>id</name>
21 <autoincrement>true</autoincrement>
22 </primaryKey>
23 <field>
24 <name>contact_id</name>
25 <uniqueName>contribution_contact_id</uniqueName>
26 <title>Contact ID</title>
27 <type>int unsigned</type>
28 <required>true</required>
29 <import>true</import>
30 <headerPattern>/contact(.?id)?/i</headerPattern>
31 <dataPattern>/^\d+$/</dataPattern>
32 <comment>FK to Contact ID</comment>
33 <add>1.3</add>
34 </field>
35 <foreignKey>
36 <name>contact_id</name>
37 <table>civicrm_contact</table>
38 <key>id</key>
39 <add>1.3</add>
40 <onDelete>CASCADE</onDelete>
41 </foreignKey>
42 <field>
43 <name>solicitor_id</name>
44 <title>Solicitor ID</title>
45 <type>int unsigned</type>
46 <comment>FK to Solicitor ID</comment>
47 <add>1.4</add>
48 <drop>2.2</drop>
49 </field>
50 <foreignKey>
51 <name>solicitor_id</name>
52 <table>civicrm_contact</table>
53 <key>id</key>
54 <add>1.4</add>
55 <drop>2.2</drop>
56 <onDelete>SET NULL</onDelete>
57 </foreignKey>
58 <field>
59 <name>contribution_type_id</name>
60 <title>Contribution Type</title>
61 <export>false</export>
62 <type>int unsigned</type>
63 <comment>FK to Contribution Type</comment>
64 <add>1.3</add>
65 <drop>4.3</drop>
66 </field>
67 <foreignKey>
68 <name>contribution_type_id</name>
69 <table>civicrm_contribution_type</table>
70 <key>id</key>
71 <add>1.3</add>
72 <drop>4.3</drop>
73 <onDelete>SET NULL</onDelete>
74 </foreignKey>
75 <field>
76 <name>financial_type_id</name>
77 <title>Financial Type</title>
78 <export>false</export>
79 <type>int unsigned</type>
80 <comment>FK to Financial Type for (total_amount - non_deductible_amount).</comment>
81 <add>4.3</add>
82 </field>
83 <foreignKey>
84 <name>financial_type_id</name>
85 <table>civicrm_financial_type</table>
86 <key>id</key>
87 <add>4.3</add>
88 </foreignKey>
89 <field>
90 <name>contribution_page_id</name>
91 <title>Contribution Page</title>
92 <type>int unsigned</type>
93 <import>true</import>
94 <comment>The Contribution Page which triggered this contribution</comment>
95 <add>1.5</add>
96 </field>
97 <foreignKey>
98 <name>contribution_page_id</name>
99 <table>civicrm_contribution_page</table>
100 <key>id</key>
101 <onDelete>SET NULL</onDelete>
102 </foreignKey>
103 <field>
104 <name>payment_instrument_id</name>
105 <uniqueName>contribution_payment_instrument_id</uniqueName>
106 <title>Payment Instrument</title>
107 <type>int unsigned</type>
108 <comment>FK to Payment Instrument</comment>
109 <pseudoconstant>
110 <name>paymentInstrument</name>
111 <optionGroupName>paymentInstrument</optionGroupName>
112 <class>CRM_Contribute_PseudoConstant</class>
113 </pseudoconstant>
114 <add>1.3</add>
115 </field>
116 <index>
117 <name>UI_contrib_payment_instrument_id</name>
118 <fieldName>payment_instrument_id</fieldName>
119 <add>1.6</add>
120 </index>
121 <field>
122 <name>receive_date</name>
123 <type>datetime</type>
124 <import>true</import>
125 <headerPattern>/receive(.?date)?/i</headerPattern>
126 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
127 <comment>when was gift received</comment>
128 <add>1.3</add>
129 </field>
130 <field>
131 <name>non_deductible_amount</name>
132 <title>Non-deductible Amount</title>
133 <type>decimal</type>
134 <default>0</default>
135 <import>true</import>
136 <headerPattern>/non?.?deduct/i</headerPattern>
137 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
138 <comment>Portion of total amount which is NOT tax deductible. Equal to total_amount for non-deductible financial types.</comment>
139 <add>1.3</add>
140 </field>
141 <field>
142 <name>total_amount</name>
143 <type>decimal</type>
144 <required>true</required>
145 <import>true</import>
146 <headerPattern>/^total|(.?^am(ou)?nt)/i</headerPattern>
147 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
148 <comment>Total amount of this contribution. Use market value for non-monetary gifts.</comment>
149 <add>1.3</add>
150 </field>
151 <field>
152 <name>fee_amount</name>
153 <type>decimal</type>
154 <import>true</import>
155 <headerPattern>/fee(.?am(ou)?nt)?/i</headerPattern>
156 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
157 <comment>actual processor fee if known - may be 0.</comment>
158 <add>1.3</add>
159 </field>
160 <field>
161 <name>net_amount</name>
162 <type>decimal</type>
163 <import>true</import>
164 <headerPattern>/net(.?am(ou)?nt)?/i</headerPattern>
165 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
166 <comment>actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.</comment>
167 <add>1.3</add>
168 </field>
169 <field>
170 <name>trxn_id</name>
171 <title>Transaction ID</title>
172 <type>varchar</type>
173 <length>255</length>
174 <import>true</import>
175 <headerPattern>/tr(ansactio|x)n(.?id)?/i</headerPattern>
176 <comment>unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method</comment>
177 <add>1.3</add>
178 </field>
179 <field>
180 <name>invoice_id</name>
181 <title>Invoice ID</title>
182 <type>varchar</type>
183 <length>255</length>
184 <import>true</import>
185 <headerPattern>/invoice(.?id)?/i</headerPattern>
186 <comment>unique invoice id, system generated or passed in</comment>
187 <add>1.3</add>
188 </field>
189 <field>
190 <name>currency</name>
191 <type>varchar</type>
192 <length>3</length>
193 <default>NULL</default>
194 <import>true</import>
195 <headerPattern>/cur(rency)?/i</headerPattern>
196 <dataPattern>/^[A-Z]{3}$/i</dataPattern>
197 <comment>3 character string, value from config setting or input via user.</comment>
198 <add>1.3</add>
199 <pseudoconstant>
200 <table>civicrm_currency</table>
201 <keyColumn>name</keyColumn>
202 <labelColumn>symbol</labelColumn>
203 </pseudoconstant>
204 </field>
205 <field>
206 <name>cancel_date</name>
207 <type>datetime</type>
208 <import>true</import>
209 <headerPattern>/cancel(.?date)?/i</headerPattern>
210 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
211 <comment>when was gift cancelled</comment>
212 <add>1.3</add>
213 </field>
214 <field>
215 <name>cancel_reason</name>
216 <type>text</type>
217 <import>true</import>
218 <headerPattern>/(cancel.?)?reason/i</headerPattern>
219 <add>1.3</add>
220 </field>
221 <field>
222 <name>receipt_date</name>
223 <type>datetime</type>
224 <import>true</import>
225 <headerPattern>/receipt(.?date)?/i</headerPattern>
226 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
227 <comment>when (if) receipt was sent. populated automatically for online donations w/ automatic receipting</comment>
228 <add>1.3</add>
229 </field>
230 <field>
231 <name>thankyou_date</name>
232 <title>Thank-you Date</title>
233 <type>datetime</type>
234 <import>true</import>
235 <headerPattern>/thank(s|(.?you))?(.?date)?/i</headerPattern>
236 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
237 <comment>when (if) was donor thanked</comment>
238 <add>1.3</add>
239 </field>
240 <field>
241 <name>source</name>
242 <uniqueName>contribution_source</uniqueName>
243 <title>Contribution Source</title>
244 <type>varchar</type>
245 <length>255</length>
246 <import>true</import>
247 <headerPattern>/source/i</headerPattern>
248 <comment>Origin of this Contribution.</comment>
249 <add>1.3</add>
250 </field>
251 <field>
252 <name>amount_level</name>
253 <title>Amount Label</title>
254 <type>text</type>
255 <import>true</import>
256 <add>1.7</add>
257 </field>
258 <field>
259 <name>note</name>
260 <type>text</type>
261 <comment>Note and/or Comment.</comment>
262 <htmlType>textarea</htmlType>
263 <rows>4</rows>
264 <cols>80</cols>
265 <import>true</import>
266 <headerPattern>/Note|Comment/i</headerPattern>
267 <dataPattern>//</dataPattern>
268 <add>1.4</add>
269 <drop>1.7</drop>
270 </field>
271 <index>
272 <name>UI_contrib_trxn_id</name>
273 <fieldName>trxn_id</fieldName>
274 <unique>true</unique>
275 <add>2.1</add>
276 </index>
277 <index>
278 <name>UI_contrib_invoice_id</name>
279 <fieldName>invoice_id</fieldName>
280 <unique>true</unique>
281 <add>2.1</add>
282 </index>
283 <field>
284 <name>contribution_recur_id</name>
285 <type>int unsigned</type>
286 <comment>Conditional foreign key to civicrm_contribution_recur id. Each contribution made in connection with a recurring contribution carries a foreign key to the recurring contribution record. This assumes we can track these processor initiated events.</comment>
287 <add>1.4</add>
288 </field>
289 <foreignKey>
290 <name>contribution_recur_id</name>
291 <table>civicrm_contribution_recur</table>
292 <key>id</key>
293 <add>1.4</add>
294 <onDelete>SET NULL</onDelete>
295 </foreignKey>
296 <field>
297 <name>honor_contact_id</name>
298 <title>Honor Contact</title>
299 <type>int unsigned</type>
300 <comment>FK to contact ID</comment>
301 <add>1.3</add>
302 </field>
303 <foreignKey>
304 <name>honor_contact_id</name>
305 <table>civicrm_contact</table>
306 <key>id</key>
307 <add>1.6</add>
308 <onDelete>SET NULL</onDelete>
309 </foreignKey>
310 <field>
311 <name>is_test</name>
312 <title>Test</title>
313 <type>boolean</type>
314 <default>0</default>
315 <import>true</import>
316 </field>
317 <field>
318 <name>is_pay_later</name>
319 <title>Is Pay Later</title>
320 <type>boolean</type>
321 <default>0</default>
322 <import>true</import>
323 <add>2.1</add>
324 </field>
325 <field>
326 <name>contribution_status_id</name>
327 <title>Contribution Status</title>
328 <type>int unsigned</type>
329 <default>1</default>
330 <import>true</import>
331 <export>true</export>
332 <headerPattern>/status/i</headerPattern>
333 <add>1.6</add>
334 </field>
335 <field>
336 <name>honor_type_id</name>
337 <title>Honor Type</title>
338 <type>int unsigned</type>
339 <comment>Implicit FK to civicrm_option_value.</comment>
340 <add>2.0</add>
341 <onDelete>SET NULL</onDelete>
342 <pseudoconstant>
343 <optionGroupName>honor_type</optionGroupName>
344 </pseudoconstant>
345 </field>
346 <index>
347 <name>index_contribution_status</name>
348 <fieldName>contribution_status_id</fieldName>
349 <add>1.6</add>
350 </index>
351 <index>
352 <name>received_date</name>
353 <fieldName>receive_date</fieldName>
354 <add>1.6</add>
355 </index>
356 <field>
357 <name>address_id</name>
358 <type>int unsigned</type>
359 <comment>Conditional foreign key to civicrm_address.id. We insert an address record for each contribution when we have associated billing name and address data.</comment>
360 <add>2.2</add>
361 </field>
362 <foreignKey>
363 <name>address_id</name>
364 <table>civicrm_address</table>
365 <key>id</key>
366 <add>2.2</add>
367 <onDelete>SET NULL</onDelete>
368 </foreignKey>
369 <field>
370 <name>check_number</name>
371 <title>Check Number</title>
372 <headerPattern>/check(.?number)?/i</headerPattern>
373 <type>varchar</type>
374 <length>255</length>
375 <size>SIX</size>
376 <import>true</import>
377 <add>2.2</add>
378 </field>
379 <index>
380 <name>check_number</name>
381 <fieldName>check_number</fieldName>
382 <add>2.2</add>
383 </index>
384 <field>
385 <name>campaign_id</name>
386 <uniqueName>contribution_campaign_id</uniqueName>
387 <type>int unsigned</type>
388 <title>Campaign ID</title>
389 <import>true</import>
390 <comment>The campaign for which this contribution has been triggered.</comment>
391 <add>3.4</add>
392 </field>
393 <foreignKey>
394 <name>campaign_id</name>
395 <table>civicrm_campaign</table>
396 <key>id</key>
397 <onDelete>SET NULL</onDelete>
398 </foreignKey>
399 </table>