Merge pull request #14547 from civicrm/5.15
[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 <html>
34 <type>EntityRef</type>
35 </html>
36 <add>1.3</add>
37 </field>
38 <foreignKey>
39 <name>contact_id</name>
40 <table>civicrm_contact</table>
41 <key>id</key>
42 <add>1.3</add>
43 <onDelete>CASCADE</onDelete>
44 </foreignKey>
45 <field>
46 <name>solicitor_id</name>
47 <title>Solicitor ID</title>
48 <type>int unsigned</type>
49 <comment>FK to Solicitor ID</comment>
50 <add>1.4</add>
51 <drop>2.2</drop>
52 </field>
53 <foreignKey>
54 <name>solicitor_id</name>
55 <table>civicrm_contact</table>
56 <key>id</key>
57 <add>1.4</add>
58 <drop>2.2</drop>
59 <onDelete>SET NULL</onDelete>
60 </foreignKey>
61 <field>
62 <name>contribution_type_id</name>
63 <title>Contribution Type</title>
64 <export>false</export>
65 <type>int unsigned</type>
66 <comment>FK to Contribution Type</comment>
67 <add>1.3</add>
68 <drop>4.3</drop>
69 </field>
70 <foreignKey>
71 <name>contribution_type_id</name>
72 <table>civicrm_contribution_type</table>
73 <key>id</key>
74 <add>1.3</add>
75 <drop>4.3</drop>
76 <onDelete>SET NULL</onDelete>
77 </foreignKey>
78 <field>
79 <name>financial_type_id</name>
80 <title>Financial Type</title>
81 <type>int unsigned</type>
82 <comment>FK to Financial Type for (total_amount - non_deductible_amount).</comment>
83 <pseudoconstant>
84 <table>civicrm_financial_type</table>
85 <keyColumn>id</keyColumn>
86 <labelColumn>name</labelColumn>
87 </pseudoconstant>
88 <export>true</export>
89 <html>
90 <type>Select</type>
91 </html>
92 <add>4.3</add>
93 </field>
94 <foreignKey>
95 <name>financial_type_id</name>
96 <table>civicrm_financial_type</table>
97 <key>id</key>
98 <add>4.3</add>
99 </foreignKey>
100 <field>
101 <name>contribution_page_id</name>
102 <title>Contribution Page ID</title>
103 <type>int unsigned</type>
104 <import>true</import>
105 <comment>The Contribution Page which triggered this contribution</comment>
106 <pseudoconstant>
107 <table>civicrm_contribution_page</table>
108 <keyColumn>id</keyColumn>
109 <labelColumn>title</labelColumn>
110 </pseudoconstant>
111 <html>
112 <type>Select</type>
113 </html>
114 <add>1.5</add>
115 </field>
116 <foreignKey>
117 <name>contribution_page_id</name>
118 <table>civicrm_contribution_page</table>
119 <key>id</key>
120 <onDelete>SET NULL</onDelete>
121 </foreignKey>
122 <field>
123 <name>payment_instrument_id</name>
124 <uniqueName>payment_instrument_id</uniqueName>
125 <title>Payment Method ID</title>
126 <type>int unsigned</type>
127 <comment>FK to Payment Instrument</comment>
128 <export>true</export>
129 <headerPattern>/^payment|(p(ayment\s)?instrument)$/i</headerPattern>
130 <pseudoconstant>
131 <optionGroupName>payment_instrument</optionGroupName>
132 </pseudoconstant>
133 <html>
134 <type>Select</type>
135 </html>
136 <add>1.3</add>
137 </field>
138 <index>
139 <name>UI_contrib_payment_instrument_id</name>
140 <fieldName>payment_instrument_id</fieldName>
141 <add>1.6</add>
142 </index>
143 <field>
144 <name>receive_date</name>
145 <title>Date Received</title>
146 <type>datetime</type>
147 <import>true</import>
148 <headerPattern>/receive(.?date)?/i</headerPattern>
149 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
150 <comment>Date contribution was received - not necessarily the creation date of the record</comment>
151 <add>1.3</add>
152 <html>
153 <type>Select Date</type>
154 <formatType>activityDateTime</formatType>
155 </html>
156 </field>
157 <field>
158 <name>non_deductible_amount</name>
159 <title>Non-deductible Amount</title>
160 <type>decimal</type>
161 <default>0</default>
162 <import>true</import>
163 <headerPattern>/non?.?deduct/i</headerPattern>
164 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
165 <comment>Portion of total amount which is NOT tax deductible. Equal to total_amount for non-deductible financial types.</comment>
166 <add>1.3</add>
167 <html>
168 <type>Text</type>
169 </html>
170 </field>
171 <field>
172 <name>total_amount</name>
173 <type>decimal</type>
174 <required>true</required>
175 <import>true</import>
176 <headerPattern>/^total|(.?^am(ou)?nt)/i</headerPattern>
177 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
178 <comment>Total amount of this contribution. Use market value for non-monetary gifts.</comment>
179 <add>1.3</add>
180 <html>
181 <type>Text</type>
182 </html>
183 </field>
184 <index>
185 <name>index_total_amount_receive_date</name>
186 <fieldName>total_amount</fieldName>
187 <fieldName>receive_date</fieldName>
188 <add>4.7</add>
189 </index>
190 <field>
191 <name>fee_amount</name>
192 <type>decimal</type>
193 <import>true</import>
194 <headerPattern>/fee(.?am(ou)?nt)?/i</headerPattern>
195 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
196 <comment>actual processor fee if known - may be 0.</comment>
197 <add>1.3</add>
198 <html>
199 <type>Text</type>
200 </html>
201 </field>
202 <field>
203 <name>net_amount</name>
204 <type>decimal</type>
205 <import>true</import>
206 <headerPattern>/net(.?am(ou)?nt)?/i</headerPattern>
207 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
208 <comment>actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.</comment>
209 <add>1.3</add>
210 <html>
211 <type>Text</type>
212 </html>
213 </field>
214 <field>
215 <name>trxn_id</name>
216 <title>Transaction ID</title>
217 <type>varchar</type>
218 <length>255</length>
219 <import>true</import>
220 <headerPattern>/tr(ansactio|x)n(.?id)?/i</headerPattern>
221 <comment>unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method</comment>
222 <html>
223 <type>Text</type>
224 </html>
225 <add>1.3</add>
226 </field>
227 <field>
228 <name>invoice_id</name>
229 <title>Invoice Reference</title>
230 <type>varchar</type>
231 <length>255</length>
232 <import>true</import>
233 <headerPattern>/invoice(.?id)?/i</headerPattern>
234 <comment>unique invoice id, system generated or passed in</comment>
235 <html>
236 <type>Text</type>
237 </html>
238 <add>1.3</add>
239 </field>
240 <field>
241 <name>invoice_number</name>
242 <title>Invoice Number</title>
243 <type>varchar</type>
244 <length>255</length>
245 <import>true</import>
246 <headerPattern>/invoice(.?number)?/i</headerPattern>
247 <comment>Human readable invoice number</comment>
248 <html>
249 <type>Text</type>
250 </html>
251 <add>4.7</add>
252 </field>
253 <field>
254 <name>currency</name>
255 <type>varchar</type>
256 <length>3</length>
257 <default>NULL</default>
258 <import>true</import>
259 <headerPattern>/cur(rency)?/i</headerPattern>
260 <dataPattern>/^[A-Z]{3}$/i</dataPattern>
261 <comment>3 character string, value from config setting or input via user.</comment>
262 <add>1.3</add>
263 <pseudoconstant>
264 <table>civicrm_currency</table>
265 <keyColumn>name</keyColumn>
266 <labelColumn>full_name</labelColumn>
267 <nameColumn>name</nameColumn>
268 </pseudoconstant>
269 <html>
270 <type>Select</type>
271 </html>
272 </field>
273 <field>
274 <name>cancel_date</name>
275 <title>Cancelled / Refunded Date</title>
276 <type>datetime</type>
277 <import>true</import>
278 <headerPattern>/cancel(.?date)?/i</headerPattern>
279 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
280 <comment>when was gift cancelled</comment>
281 <add>1.3</add>
282 <html>
283 <type>Select Date</type>
284 <formatType>activityDateTime</formatType>
285 </html>
286 <uniqueName>contribution_cancel_date</uniqueName>
287 </field>
288 <field>
289 <name>cancel_reason</name>
290 <type>text</type>
291 <title>Cancellation / Refund Reason</title>
292 <import>true</import>
293 <export>true</export>
294 <headerPattern>/(cancel.?)?reason/i</headerPattern>
295 <html>
296 <type>Text</type>
297 <size>40</size>
298 </html>
299 <add>1.3</add>
300 </field>
301 <field>
302 <name>receipt_date</name>
303 <type>datetime</type>
304 <import>true</import>
305 <headerPattern>/receipt(.?date)?/i</headerPattern>
306 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
307 <comment>when (if) receipt was sent. populated automatically for online donations w/ automatic receipting</comment>
308 <html>
309 <type>Select Date</type>
310 <formatType>activityDateTime</formatType>
311 </html>
312 <add>1.3</add>
313 </field>
314 <field>
315 <name>thankyou_date</name>
316 <title>Thank-you Date</title>
317 <type>datetime</type>
318 <import>true</import>
319 <headerPattern>/thank(s|(.?you))?(.?date)?/i</headerPattern>
320 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
321 <comment>when (if) was donor thanked</comment>
322 <add>1.3</add>
323 <html>
324 <type>Select Date</type>
325 <formatType>activityDateTime</formatType>
326 </html>
327 </field>
328 <field>
329 <name>source</name>
330 <uniqueName>contribution_source</uniqueName>
331 <title>Contribution Source</title>
332 <type>varchar</type>
333 <length>255</length>
334 <import>true</import>
335 <headerPattern>/source/i</headerPattern>
336 <comment>Origin of this Contribution.</comment>
337 <add>1.3</add>
338 <html>
339 <type>Text</type>
340 </html>
341 </field>
342 <index>
343 <name>index_source</name>
344 <fieldName>source</fieldName>
345 <add>4.7</add>
346 </index>
347 <field>
348 <name>amount_level</name>
349 <title>Amount Label</title>
350 <type>text</type>
351 <import>true</import>
352 <add>1.7</add>
353 <html>
354 <type>Text</type>
355 </html>
356 </field>
357 <field>
358 <name>note</name>
359 <type>text</type>
360 <comment>Note and/or Comment.</comment>
361 <import>true</import>
362 <headerPattern>/Note|Comment/i</headerPattern>
363 <dataPattern>//</dataPattern>
364 <add>1.4</add>
365 <drop>1.7</drop>
366 </field>
367 <index>
368 <name>UI_contrib_trxn_id</name>
369 <fieldName>trxn_id</fieldName>
370 <unique>true</unique>
371 <add>2.1</add>
372 </index>
373 <index>
374 <name>UI_contrib_invoice_id</name>
375 <fieldName>invoice_id</fieldName>
376 <unique>true</unique>
377 <add>2.1</add>
378 </index>
379 <field>
380 <name>contribution_recur_id</name>
381 <title>Recurring Contribution ID</title>
382 <type>int unsigned</type>
383 <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>
384 <export>true</export>
385 <add>1.4</add>
386 </field>
387 <foreignKey>
388 <name>contribution_recur_id</name>
389 <table>civicrm_contribution_recur</table>
390 <key>id</key>
391 <add>1.4</add>
392 <onDelete>SET NULL</onDelete>
393 </foreignKey>
394 <field>
395 <name>is_test</name>
396 <title>Test</title>
397 <type>boolean</type>
398 <default>0</default>
399 <import>true</import>
400 <html>
401 <type>CheckBox</type>
402 </html>
403 </field>
404 <field>
405 <name>is_pay_later</name>
406 <title>Is Pay Later</title>
407 <type>boolean</type>
408 <default>0</default>
409 <import>true</import>
410 <add>2.1</add>
411 <html>
412 <type>CheckBox</type>
413 </html>
414 </field>
415 <field>
416 <name>contribution_status_id</name>
417 <title>Contribution Status ID</title>
418 <type>int unsigned</type>
419 <default>1</default>
420 <import>true</import>
421 <export>true</export>
422 <headerPattern>/status/i</headerPattern>
423 <pseudoconstant>
424 <optionGroupName>contribution_status</optionGroupName>
425 </pseudoconstant>
426 <html>
427 <type>Select</type>
428 </html>
429 <add>1.6</add>
430 </field>
431 <index>
432 <name>index_contribution_status</name>
433 <fieldName>contribution_status_id</fieldName>
434 <add>1.6</add>
435 </index>
436 <index>
437 <name>received_date</name>
438 <fieldName>receive_date</fieldName>
439 <add>1.6</add>
440 </index>
441 <field>
442 <name>address_id</name>
443 <uniqueName>contribution_address_id</uniqueName>
444 <title>Contribution Address</title>
445 <type>int unsigned</type>
446 <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>
447 <add>2.2</add>
448 <export>true</export>
449 </field>
450 <foreignKey>
451 <name>address_id</name>
452 <table>civicrm_address</table>
453 <key>id</key>
454 <add>2.2</add>
455 <onDelete>SET NULL</onDelete>
456 </foreignKey>
457 <field>
458 <name>check_number</name>
459 <title>Check Number</title>
460 <uniqueName>contribution_check_number</uniqueName>
461 <headerPattern>/check(.?number)?/i</headerPattern>
462 <type>varchar</type>
463 <length>255</length>
464 <html>
465 <type>Text</type>
466 <size>6</size>
467 </html>
468 <import>true</import>
469 <add>2.2</add>
470 </field>
471 <index>
472 <name>check_number</name>
473 <fieldName>check_number</fieldName>
474 <add>2.2</add>
475 </index>
476 <field>
477 <name>campaign_id</name>
478 <uniqueName>contribution_campaign_id</uniqueName>
479 <type>int unsigned</type>
480 <title>Campaign</title>
481 <import>true</import>
482 <comment>The campaign for which this contribution has been triggered.</comment>
483 <pseudoconstant>
484 <table>civicrm_campaign</table>
485 <keyColumn>id</keyColumn>
486 <labelColumn>title</labelColumn>
487 </pseudoconstant>
488 <add>3.4</add>
489 <html>
490 <type>Select</type>
491 </html>
492 </field>
493 <field>
494 <name>creditnote_id</name>
495 <title>Credit Note ID</title>
496 <type>varchar</type>
497 <length>255</length>
498 <import>true</import>
499 <headerPattern>/creditnote(.?id)?/i</headerPattern>
500 <comment>unique credit note id, system generated or passed in</comment>
501 <add>4.6</add>
502 <html>
503 <type>Text</type>
504 </html>
505 </field>
506 <index>
507 <name>index_creditnote_id</name>
508 <fieldName>creditnote_id</fieldName>
509 <add>4.7</add>
510 </index>
511 <field>
512 <name>tax_amount</name>
513 <title>Tax Amount</title>
514 <type>decimal</type>
515 <import>true</import>
516 <headerPattern>/tax(.?am(ou)?nt)?/i</headerPattern>
517 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
518 <comment>Total tax amount of this contribution.</comment>
519 <add>4.6</add>
520 <html>
521 <type>Text</type>
522 </html>
523 </field>
524 <foreignKey>
525 <name>campaign_id</name>
526 <table>civicrm_campaign</table>
527 <key>id</key>
528 <onDelete>SET NULL</onDelete>
529 </foreignKey>
530 <field>
531 <name>revenue_recognition_date</name>
532 <type>datetime</type>
533 <import>true</import>
534 <headerPattern>/revenue(.?date)?/i</headerPattern>
535 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
536 <comment>Stores the date when revenue should be recognized.</comment>
537 <html>
538 <type>Select Date</type>
539 <formatType>activityDateTime</formatType>
540 </html>
541 <add>4.7</add>
542 </field>
543 </table>