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