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