Merge pull request #15526 from civicrm/5.19
[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>
7 <add>1.3</add>
6a488035 8 <log>true</log>
6d68a4cb
CW
9 <field>
10 <name>id</name>
6a488035 11 <uniqueName>contribution_id</uniqueName>
6d68a4cb 12 <type>int unsigned</type>
6a488035 13 <required>true</required>
6d68a4cb 14 <import>true</import>
6a488035 15 <title>Contribution ID</title>
6d68a4cb
CW
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>
6a488035
TO
25 <uniqueName>contribution_contact_id</uniqueName>
26 <title>Contact ID</title>
6d68a4cb
CW
27 <type>int unsigned</type>
28 <required>true</required>
6a488035
TO
29 <import>true</import>
30 <headerPattern>/contact(.?id)?/i</headerPattern>
31 <dataPattern>/^\d+$/</dataPattern>
6d68a4cb 32 <comment>FK to Contact ID</comment>
614d72ec 33 <html>
c6821d8d
MWMC
34 <type>EntityRef</type>
35 </html>
6d68a4cb
CW
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>
6a488035 43 <onDelete>CASCADE</onDelete>
6d68a4cb
CW
44 </foreignKey>
45 <field>
46 <name>solicitor_id</name>
6a488035 47 <title>Solicitor ID</title>
6d68a4cb
CW
48 <type>int unsigned</type>
49 <comment>FK to Solicitor ID</comment>
50 <add>1.4</add>
6a488035 51 <drop>2.2</drop>
6d68a4cb
CW
52 </field>
53 <foreignKey>
54 <name>solicitor_id</name>
55 <table>civicrm_contact</table>
56 <key>id</key>
57 <add>1.4</add>
6a488035
TO
58 <drop>2.2</drop>
59 <onDelete>SET NULL</onDelete>
6d68a4cb
CW
60 </foreignKey>
61 <field>
62 <name>contribution_type_id</name>
6a488035
TO
63 <title>Contribution Type</title>
64 <export>false</export>
65 <type>int unsigned</type>
66 <comment>FK to Contribution Type</comment>
6d68a4cb
CW
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>
6a488035 76 <onDelete>SET NULL</onDelete>
6d68a4cb
CW
77 </foreignKey>
78 <field>
6a488035 79 <name>financial_type_id</name>
bed339f2 80 <title>Financial Type</title>
6a488035
TO
81 <type>int unsigned</type>
82 <comment>FK to Financial Type for (total_amount - non_deductible_amount).</comment>
6d68a4cb
CW
83 <pseudoconstant>
84 <table>civicrm_financial_type</table>
85 <keyColumn>id</keyColumn>
86 <labelColumn>name</labelColumn>
87 </pseudoconstant>
3123273f 88 <export>true</export>
614d72ec 89 <html>
e0991796 90 <type>Select</type>
614d72ec 91 </html>
6a488035 92 <add>4.3</add>
6d68a4cb
CW
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>
3c151c70 102 <title>Contribution Page ID</title>
6a488035
TO
103 <type>int unsigned</type>
104 <import>true</import>
6d68a4cb
CW
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>
614d72ec 111 <html>
e0991796 112 <type>Select</type>
614d72ec 113 </html>
6d68a4cb
CW
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>
6a488035
TO
120 <onDelete>SET NULL</onDelete>
121 </foreignKey>
6d68a4cb 122 <field>
6a488035 123 <name>payment_instrument_id</name>
8fb22579 124 <uniqueName>payment_instrument_id</uniqueName>
9d5c7f14 125 <title>Payment Method ID</title>
6a488035
TO
126 <type>int unsigned</type>
127 <comment>FK to Payment Instrument</comment>
9d5c7f14 128 <export>true</export>
129 <headerPattern>/^payment|(p(ayment\s)?instrument)$/i</headerPattern>
6a488035 130 <pseudoconstant>
6d68a4cb 131 <optionGroupName>payment_instrument</optionGroupName>
6a488035 132 </pseudoconstant>
614d72ec 133 <html>
e0991796 134 <type>Select</type>
614d72ec 135 </html>
6a488035 136 <add>1.3</add>
6d68a4cb 137 </field>
6a488035
TO
138 <index>
139 <name>UI_contrib_payment_instrument_id</name>
6d68a4cb 140 <fieldName>payment_instrument_id</fieldName>
6a488035 141 <add>1.6</add>
6d68a4cb
CW
142 </index>
143 <field>
144 <name>receive_date</name>
7bc6b5bb 145 <title>Date Received</title>
6d68a4cb 146 <type>datetime</type>
6a488035
TO
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>
7bc6b5bb 150 <comment>Date contribution was received - not necessarily the creation date of the record</comment>
6d68a4cb 151 <add>1.3</add>
614d72ec 152 <html>
153 <type>Select Date</type>
24317d89 154 <formatType>activityDateTime</formatType>
614d72ec 155 </html>
6d68a4cb
CW
156 </field>
157 <field>
158 <name>non_deductible_amount</name>
6a488035
TO
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>
6d68a4cb
CW
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>
614d72ec 167 <html>
168 <type>Text</type>
169 </html>
6a488035 170 </field>
6d68a4cb
CW
171 <field>
172 <name>total_amount</name>
173 <type>decimal</type>
6a488035
TO
174 <required>true</required>
175 <import>true</import>
176 <headerPattern>/^total|(.?^am(ou)?nt)/i</headerPattern>
177 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
6d68a4cb
CW
178 <comment>Total amount of this contribution. Use market value for non-monetary gifts.</comment>
179 <add>1.3</add>
614d72ec 180 <html>
181 <type>Text</type>
182 </html>
6a488035 183 </field>
378bbe51 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>
6d68a4cb
CW
190 <field>
191 <name>fee_amount</name>
192 <type>decimal</type>
6a488035
TO
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>
6d68a4cb 197 <add>1.3</add>
614d72ec 198 <html>
199 <type>Text</type>
200 </html>
6d68a4cb
CW
201 </field>
202 <field>
203 <name>net_amount</name>
204 <type>decimal</type>
6a488035
TO
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>
6d68a4cb 209 <add>1.3</add>
614d72ec 210 <html>
211 <type>Text</type>
212 </html>
6a488035 213 </field>
6d68a4cb
CW
214 <field>
215 <name>trxn_id</name>
6a488035 216 <title>Transaction ID</title>
6d68a4cb
CW
217 <type>varchar</type>
218 <length>255</length>
6a488035
TO
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>
614d72ec 222 <html>
223 <type>Text</type>
224 </html>
6d68a4cb
CW
225 <add>1.3</add>
226 </field>
227 <field>
228 <name>invoice_id</name>
9cad3ff4 229 <title>Invoice Reference</title>
6d68a4cb
CW
230 <type>varchar</type>
231 <length>255</length>
6a488035
TO
232 <import>true</import>
233 <headerPattern>/invoice(.?id)?/i</headerPattern>
234 <comment>unique invoice id, system generated or passed in</comment>
614d72ec 235 <html>
236 <type>Text</type>
b05e6d0d 237 </html>
6d68a4cb 238 <add>1.3</add>
9cad3ff4
CW
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>
6d68a4cb
CW
253 <field>
254 <name>currency</name>
255 <type>varchar</type>
6a488035
TO
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>
bd44e0df
AS
262 <add>1.3</add>
263 <pseudoconstant>
264 <table>civicrm_currency</table>
265 <keyColumn>name</keyColumn>
a38a89fc 266 <labelColumn>full_name</labelColumn>
c3de5c5a 267 <nameColumn>name</nameColumn>
a8fdb24e 268 <abbrColumn>symbol</abbrColumn>
bd44e0df 269 </pseudoconstant>
614d72ec 270 <html>
e0991796 271 <type>Select</type>
614d72ec 272 </html>
6d68a4cb
CW
273 </field>
274 <field>
275 <name>cancel_date</name>
6e7cc0f5 276 <title>Cancelled / Refunded Date</title>
6d68a4cb 277 <type>datetime</type>
6a488035
TO
278 <import>true</import>
279 <headerPattern>/cancel(.?date)?/i</headerPattern>
280 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
6d68a4cb
CW
281 <comment>when was gift cancelled</comment>
282 <add>1.3</add>
614d72ec 283 <html>
284 <type>Select Date</type>
24317d89 285 <formatType>activityDateTime</formatType>
614d72ec 286 </html>
6e7cc0f5 287 <uniqueName>contribution_cancel_date</uniqueName>
6d68a4cb
CW
288 </field>
289 <field>
290 <name>cancel_reason</name>
291 <type>text</type>
927898c5 292 <title>Cancellation / Refund Reason</title>
6a488035 293 <import>true</import>
927898c5 294 <export>true</export>
6a488035 295 <headerPattern>/(cancel.?)?reason/i</headerPattern>
614d72ec 296 <html>
297 <type>Text</type>
927898c5 298 <size>40</size>
614d72ec 299 </html>
b05e6d0d 300 <add>1.3</add>
6d68a4cb
CW
301 </field>
302 <field>
303 <name>receipt_date</name>
304 <type>datetime</type>
6a488035
TO
305 <import>true</import>
306 <headerPattern>/receipt(.?date)?/i</headerPattern>
307 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
308 <comment>when (if) receipt was sent. populated automatically for online donations w/ automatic receipting</comment>
614d72ec 309 <html>
310 <type>Select Date</type>
24317d89 311 <formatType>activityDateTime</formatType>
614d72ec 312 </html>
b05e6d0d 313 <add>1.3</add>
6d68a4cb
CW
314 </field>
315 <field>
6a488035
TO
316 <name>thankyou_date</name>
317 <title>Thank-you Date</title>
6d68a4cb 318 <type>datetime</type>
6a488035
TO
319 <import>true</import>
320 <headerPattern>/thank(s|(.?you))?(.?date)?/i</headerPattern>
321 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
6d68a4cb
CW
322 <comment>when (if) was donor thanked</comment>
323 <add>1.3</add>
614d72ec 324 <html>
325 <type>Select Date</type>
24317d89 326 <formatType>activityDateTime</formatType>
614d72ec 327 </html>
6d68a4cb
CW
328 </field>
329 <field>
6a488035
TO
330 <name>source</name>
331 <uniqueName>contribution_source</uniqueName>
332 <title>Contribution Source</title>
6d68a4cb 333 <type>varchar</type>
6a488035
TO
334 <length>255</length>
335 <import>true</import>
336 <headerPattern>/source/i</headerPattern>
6d68a4cb
CW
337 <comment>Origin of this Contribution.</comment>
338 <add>1.3</add>
614d72ec 339 <html>
340 <type>Text</type>
341 </html>
6d68a4cb 342 </field>
3fe26f4c 343 <index>
344 <name>index_source</name>
345 <fieldName>source</fieldName>
346 <add>4.7</add>
347 </index>
6d68a4cb 348 <field>
6a488035
TO
349 <name>amount_level</name>
350 <title>Amount Label</title>
6d68a4cb 351 <type>text</type>
6a488035 352 <import>true</import>
6d68a4cb 353 <add>1.7</add>
614d72ec 354 <html>
355 <type>Text</type>
356 </html>
6d68a4cb 357 </field>
6a488035
TO
358 <field>
359 <name>note</name>
360 <type>text</type>
361 <comment>Note and/or Comment.</comment>
6a488035
TO
362 <import>true</import>
363 <headerPattern>/Note|Comment/i</headerPattern>
364 <dataPattern>//</dataPattern>
365 <add>1.4</add>
366 <drop>1.7</drop>
367 </field>
368 <index>
369 <name>UI_contrib_trxn_id</name>
370 <fieldName>trxn_id</fieldName>
371 <unique>true</unique>
372 <add>2.1</add>
373 </index>
374 <index>
375 <name>UI_contrib_invoice_id</name>
376 <fieldName>invoice_id</fieldName>
377 <unique>true</unique>
378 <add>2.1</add>
379 </index>
6d68a4cb
CW
380 <field>
381 <name>contribution_recur_id</name>
b05e6d0d 382 <title>Recurring Contribution ID</title>
6d68a4cb
CW
383 <type>int unsigned</type>
384 <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 385 <export>true</export>
6d68a4cb
CW
386 <add>1.4</add>
387 </field>
388 <foreignKey>
389 <name>contribution_recur_id</name>
390 <table>civicrm_contribution_recur</table>
391 <key>id</key>
392 <add>1.4</add>
6a488035
TO
393 <onDelete>SET NULL</onDelete>
394 </foreignKey>
6d68a4cb
CW
395 <field>
396 <name>is_test</name>
6a488035
TO
397 <title>Test</title>
398 <type>boolean</type>
399 <default>0</default>
400 <import>true</import>
614d72ec 401 <html>
402 <type>CheckBox</type>
403 </html>
6a488035 404 </field>
6d68a4cb
CW
405 <field>
406 <name>is_pay_later</name>
6a488035
TO
407 <title>Is Pay Later</title>
408 <type>boolean</type>
409 <default>0</default>
410 <import>true</import>
6d68a4cb 411 <add>2.1</add>
614d72ec 412 <html>
413 <type>CheckBox</type>
414 </html>
6a488035
TO
415 </field>
416 <field>
417 <name>contribution_status_id</name>
3c151c70 418 <title>Contribution Status ID</title>
6a488035
TO
419 <type>int unsigned</type>
420 <default>1</default>
421 <import>true</import>
422 <export>true</export>
423 <headerPattern>/status/i</headerPattern>
6d68a4cb
CW
424 <pseudoconstant>
425 <optionGroupName>contribution_status</optionGroupName>
426 </pseudoconstant>
614d72ec 427 <html>
e0991796 428 <type>Select</type>
614d72ec 429 </html>
6a488035
TO
430 <add>1.6</add>
431 </field>
6a488035
TO
432 <index>
433 <name>index_contribution_status</name>
434 <fieldName>contribution_status_id</fieldName>
435 <add>1.6</add>
436 </index>
437 <index>
438 <name>received_date</name>
439 <fieldName>receive_date</fieldName>
440 <add>1.6</add>
441 </index>
6d68a4cb
CW
442 <field>
443 <name>address_id</name>
3123273f 444 <uniqueName>contribution_address_id</uniqueName>
455cfd16 445 <title>Contribution Address</title>
6d68a4cb
CW
446 <type>int unsigned</type>
447 <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>
448 <add>2.2</add>
3123273f 449 <export>true</export>
6d68a4cb
CW
450 </field>
451 <foreignKey>
452 <name>address_id</name>
453 <table>civicrm_address</table>
454 <key>id</key>
455 <add>2.2</add>
6a488035
TO
456 <onDelete>SET NULL</onDelete>
457 </foreignKey>
6d68a4cb
CW
458 <field>
459 <name>check_number</name>
6a488035 460 <title>Check Number</title>
7bc1d4da 461 <uniqueName>contribution_check_number</uniqueName>
6a488035 462 <headerPattern>/check(.?number)?/i</headerPattern>
6d68a4cb 463 <type>varchar</type>
6a488035 464 <length>255</length>
614d72ec 465 <html>
466 <type>Text</type>
54f5e87f 467 <size>6</size>
614d72ec 468 </html>
6a488035 469 <import>true</import>
6d68a4cb
CW
470 <add>2.2</add>
471 </field>
6a488035
TO
472 <index>
473 <name>check_number</name>
474 <fieldName>check_number</fieldName>
475 <add>2.2</add>
476 </index>
6d68a4cb 477 <field>
6a488035
TO
478 <name>campaign_id</name>
479 <uniqueName>contribution_campaign_id</uniqueName>
480 <type>int unsigned</type>
e1ab2e91 481 <title>Campaign</title>
6d68a4cb
CW
482 <import>true</import>
483 <comment>The campaign for which this contribution has been triggered.</comment>
3e3eacd0
CW
484 <pseudoconstant>
485 <table>civicrm_campaign</table>
486 <keyColumn>id</keyColumn>
487 <labelColumn>title</labelColumn>
3e3eacd0 488 </pseudoconstant>
6d68a4cb 489 <add>3.4</add>
614d72ec 490 <html>
491 <type>Select</type>
492 </html>
6d68a4cb 493 </field>
933c5f44 494 <field>
495 <name>creditnote_id</name>
496 <title>Credit Note ID</title>
497 <type>varchar</type>
498 <length>255</length>
499 <import>true</import>
500 <headerPattern>/creditnote(.?id)?/i</headerPattern>
501 <comment>unique credit note id, system generated or passed in</comment>
115fa278 502 <add>4.6</add>
933c5f44 503 <html>
504 <type>Text</type>
505 </html>
506 </field>
8ca47f5c 507 <index>
d9fab10f 508 <name>index_creditnote_id</name>
8ca47f5c 509 <fieldName>creditnote_id</fieldName>
510 <add>4.7</add>
511 </index>
d91b8b33 512 <field>
513 <name>tax_amount</name>
115fa278 514 <title>Tax Amount</title>
d91b8b33 515 <type>decimal</type>
516 <import>true</import>
517 <headerPattern>/tax(.?am(ou)?nt)?/i</headerPattern>
518 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
519 <comment>Total tax amount of this contribution.</comment>
115fa278 520 <add>4.6</add>
d91b8b33 521 <html>
522 <type>Text</type>
523 </html>
524 </field>
6d68a4cb
CW
525 <foreignKey>
526 <name>campaign_id</name>
527 <table>civicrm_campaign</table>
528 <key>id</key>
6a488035
TO
529 <onDelete>SET NULL</onDelete>
530 </foreignKey>
fb89c341
PN
531 <field>
532 <name>revenue_recognition_date</name>
533 <type>datetime</type>
534 <import>true</import>
535 <headerPattern>/revenue(.?date)?/i</headerPattern>
536 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
537 <comment>Stores the date when revenue should be recognized.</comment>
538 <html>
539 <type>Select Date</type>
24317d89 540 <formatType>activityDateTime</formatType>
fb89c341
PN
541 </html>
542 <add>4.7</add>
543 </field>
dc396835
AS
544 <field>
545 <name>is_template</name>
546 <title>Is a Template Contribution</title>
547 <type>boolean</type>
548 <default>0</default>
549 <import>true</import>
550 <comment>Shows this is a template for recurring contributions.</comment>
551 <html>
552 <type>CheckBox</type>
553 </html>
554 <add>5.20</add>
555 </field>
6a488035 556</table>