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