Merge pull request #8139 from scardinius/crm-18413
[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>
916b6181 34 <type>EntityRef</type>
614d72ec 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 <export>false</export>
82 <type>int unsigned</type>
83 <comment>FK to Financial Type for (total_amount - non_deductible_amount).</comment>
6d68a4cb
CW
84 <pseudoconstant>
85 <table>civicrm_financial_type</table>
86 <keyColumn>id</keyColumn>
87 <labelColumn>name</labelColumn>
88 </pseudoconstant>
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>
536f0e02 125 <title>Payment Method</title>
6a488035
TO
126 <type>int unsigned</type>
127 <comment>FK to Payment Instrument</comment>
128 <pseudoconstant>
6d68a4cb 129 <optionGroupName>payment_instrument</optionGroupName>
6a488035 130 </pseudoconstant>
614d72ec 131 <html>
e0991796 132 <type>Select</type>
614d72ec 133 </html>
6a488035 134 <add>1.3</add>
6d68a4cb 135 </field>
6a488035
TO
136 <index>
137 <name>UI_contrib_payment_instrument_id</name>
6d68a4cb 138 <fieldName>payment_instrument_id</fieldName>
6a488035 139 <add>1.6</add>
6d68a4cb
CW
140 </index>
141 <field>
142 <name>receive_date</name>
7bc6b5bb 143 <title>Date Received</title>
6d68a4cb 144 <type>datetime</type>
6a488035
TO
145 <import>true</import>
146 <headerPattern>/receive(.?date)?/i</headerPattern>
147 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
7bc6b5bb 148 <comment>Date contribution was received - not necessarily the creation date of the record</comment>
6d68a4cb 149 <add>1.3</add>
614d72ec 150 <html>
151 <type>Select Date</type>
152 </html>
6d68a4cb
CW
153 </field>
154 <field>
155 <name>non_deductible_amount</name>
6a488035
TO
156 <title>Non-deductible Amount</title>
157 <type>decimal</type>
158 <default>0</default>
159 <import>true</import>
160 <headerPattern>/non?.?deduct/i</headerPattern>
161 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
6d68a4cb
CW
162 <comment>Portion of total amount which is NOT tax deductible. Equal to total_amount for non-deductible financial types.</comment>
163 <add>1.3</add>
614d72ec 164 <html>
165 <type>Text</type>
166 </html>
6a488035 167 </field>
6d68a4cb
CW
168 <field>
169 <name>total_amount</name>
170 <type>decimal</type>
6a488035
TO
171 <required>true</required>
172 <import>true</import>
173 <headerPattern>/^total|(.?^am(ou)?nt)/i</headerPattern>
174 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
6d68a4cb
CW
175 <comment>Total amount of this contribution. Use market value for non-monetary gifts.</comment>
176 <add>1.3</add>
614d72ec 177 <html>
178 <type>Text</type>
179 </html>
6a488035 180 </field>
378bbe51 181 <index>
182 <name>index_total_amount_receive_date</name>
183 <fieldName>total_amount</fieldName>
184 <fieldName>receive_date</fieldName>
185 <add>4.7</add>
186 </index>
6d68a4cb
CW
187 <field>
188 <name>fee_amount</name>
189 <type>decimal</type>
6a488035
TO
190 <import>true</import>
191 <headerPattern>/fee(.?am(ou)?nt)?/i</headerPattern>
192 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
193 <comment>actual processor fee if known - may be 0.</comment>
6d68a4cb 194 <add>1.3</add>
614d72ec 195 <html>
196 <type>Text</type>
197 </html>
6d68a4cb
CW
198 </field>
199 <field>
200 <name>net_amount</name>
201 <type>decimal</type>
6a488035
TO
202 <import>true</import>
203 <headerPattern>/net(.?am(ou)?nt)?/i</headerPattern>
204 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
205 <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 206 <add>1.3</add>
614d72ec 207 <html>
208 <type>Text</type>
209 </html>
6a488035 210 </field>
6d68a4cb
CW
211 <field>
212 <name>trxn_id</name>
6a488035 213 <title>Transaction ID</title>
6d68a4cb
CW
214 <type>varchar</type>
215 <length>255</length>
6a488035
TO
216 <import>true</import>
217 <headerPattern>/tr(ansactio|x)n(.?id)?/i</headerPattern>
218 <comment>unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method</comment>
614d72ec 219 <html>
220 <type>Text</type>
221 </html>
6d68a4cb
CW
222 <add>1.3</add>
223 </field>
224 <field>
225 <name>invoice_id</name>
6a488035 226 <title>Invoice ID</title>
6d68a4cb
CW
227 <type>varchar</type>
228 <length>255</length>
6a488035
TO
229 <import>true</import>
230 <headerPattern>/invoice(.?id)?/i</headerPattern>
231 <comment>unique invoice id, system generated or passed in</comment>
614d72ec 232 <html>
233 <type>Text</type>
b05e6d0d 234 </html>
6d68a4cb 235 <add>1.3</add>
614d72ec 236 </field>
6d68a4cb
CW
237 <field>
238 <name>currency</name>
239 <type>varchar</type>
6a488035
TO
240 <length>3</length>
241 <default>NULL</default>
242 <import>true</import>
243 <headerPattern>/cur(rency)?/i</headerPattern>
244 <dataPattern>/^[A-Z]{3}$/i</dataPattern>
245 <comment>3 character string, value from config setting or input via user.</comment>
bd44e0df
AS
246 <add>1.3</add>
247 <pseudoconstant>
248 <table>civicrm_currency</table>
249 <keyColumn>name</keyColumn>
a38a89fc
CW
250 <labelColumn>full_name</labelColumn>
251 <nameColumn>numeric_code</nameColumn>
bd44e0df 252 </pseudoconstant>
614d72ec 253 <html>
e0991796 254 <type>Select</type>
614d72ec 255 </html>
6d68a4cb
CW
256 </field>
257 <field>
258 <name>cancel_date</name>
259 <type>datetime</type>
6a488035
TO
260 <import>true</import>
261 <headerPattern>/cancel(.?date)?/i</headerPattern>
262 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
6d68a4cb
CW
263 <comment>when was gift cancelled</comment>
264 <add>1.3</add>
614d72ec 265 <html>
266 <type>Select Date</type>
267 </html>
6d68a4cb
CW
268 </field>
269 <field>
270 <name>cancel_reason</name>
271 <type>text</type>
6a488035
TO
272 <import>true</import>
273 <headerPattern>/(cancel.?)?reason/i</headerPattern>
614d72ec 274 <html>
275 <type>Text</type>
276 </html>
b05e6d0d 277 <add>1.3</add>
6d68a4cb
CW
278 </field>
279 <field>
280 <name>receipt_date</name>
281 <type>datetime</type>
6a488035
TO
282 <import>true</import>
283 <headerPattern>/receipt(.?date)?/i</headerPattern>
284 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
285 <comment>when (if) receipt was sent. populated automatically for online donations w/ automatic receipting</comment>
614d72ec 286 <html>
287 <type>Select Date</type>
288 </html>
b05e6d0d 289 <add>1.3</add>
6d68a4cb
CW
290 </field>
291 <field>
6a488035
TO
292 <name>thankyou_date</name>
293 <title>Thank-you Date</title>
6d68a4cb 294 <type>datetime</type>
6a488035
TO
295 <import>true</import>
296 <headerPattern>/thank(s|(.?you))?(.?date)?/i</headerPattern>
297 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
6d68a4cb
CW
298 <comment>when (if) was donor thanked</comment>
299 <add>1.3</add>
614d72ec 300 <html>
301 <type>Select Date</type>
302 </html>
6d68a4cb
CW
303 </field>
304 <field>
6a488035
TO
305 <name>source</name>
306 <uniqueName>contribution_source</uniqueName>
307 <title>Contribution Source</title>
6d68a4cb 308 <type>varchar</type>
6a488035
TO
309 <length>255</length>
310 <import>true</import>
311 <headerPattern>/source/i</headerPattern>
6d68a4cb
CW
312 <comment>Origin of this Contribution.</comment>
313 <add>1.3</add>
614d72ec 314 <html>
315 <type>Text</type>
316 </html>
6d68a4cb 317 </field>
3fe26f4c 318 <index>
319 <name>index_source</name>
320 <fieldName>source</fieldName>
321 <add>4.7</add>
322 </index>
6d68a4cb 323 <field>
6a488035
TO
324 <name>amount_level</name>
325 <title>Amount Label</title>
6d68a4cb 326 <type>text</type>
6a488035 327 <import>true</import>
6d68a4cb 328 <add>1.7</add>
614d72ec 329 <html>
330 <type>Text</type>
331 </html>
6d68a4cb 332 </field>
6a488035
TO
333 <field>
334 <name>note</name>
335 <type>text</type>
336 <comment>Note and/or Comment.</comment>
6a488035
TO
337 <import>true</import>
338 <headerPattern>/Note|Comment/i</headerPattern>
339 <dataPattern>//</dataPattern>
340 <add>1.4</add>
341 <drop>1.7</drop>
342 </field>
343 <index>
344 <name>UI_contrib_trxn_id</name>
345 <fieldName>trxn_id</fieldName>
346 <unique>true</unique>
347 <add>2.1</add>
348 </index>
349 <index>
350 <name>UI_contrib_invoice_id</name>
351 <fieldName>invoice_id</fieldName>
352 <unique>true</unique>
353 <add>2.1</add>
354 </index>
6d68a4cb
CW
355 <field>
356 <name>contribution_recur_id</name>
b05e6d0d 357 <title>Recurring Contribution ID</title>
6d68a4cb
CW
358 <type>int unsigned</type>
359 <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>
360 <add>1.4</add>
361 </field>
362 <foreignKey>
363 <name>contribution_recur_id</name>
364 <table>civicrm_contribution_recur</table>
365 <key>id</key>
366 <add>1.4</add>
6a488035
TO
367 <onDelete>SET NULL</onDelete>
368 </foreignKey>
6d68a4cb
CW
369 <field>
370 <name>is_test</name>
6a488035
TO
371 <title>Test</title>
372 <type>boolean</type>
373 <default>0</default>
374 <import>true</import>
614d72ec 375 <html>
376 <type>CheckBox</type>
377 </html>
6a488035 378 </field>
6d68a4cb
CW
379 <field>
380 <name>is_pay_later</name>
6a488035
TO
381 <title>Is Pay Later</title>
382 <type>boolean</type>
383 <default>0</default>
384 <import>true</import>
6d68a4cb 385 <add>2.1</add>
614d72ec 386 <html>
387 <type>CheckBox</type>
388 </html>
6a488035
TO
389 </field>
390 <field>
391 <name>contribution_status_id</name>
3c151c70 392 <title>Contribution Status ID</title>
6a488035
TO
393 <type>int unsigned</type>
394 <default>1</default>
395 <import>true</import>
396 <export>true</export>
397 <headerPattern>/status/i</headerPattern>
6d68a4cb
CW
398 <pseudoconstant>
399 <optionGroupName>contribution_status</optionGroupName>
400 </pseudoconstant>
614d72ec 401 <html>
e0991796 402 <type>Select</type>
614d72ec 403 </html>
6a488035
TO
404 <add>1.6</add>
405 </field>
6a488035
TO
406 <index>
407 <name>index_contribution_status</name>
408 <fieldName>contribution_status_id</fieldName>
409 <add>1.6</add>
410 </index>
411 <index>
412 <name>received_date</name>
413 <fieldName>receive_date</fieldName>
414 <add>1.6</add>
415 </index>
6d68a4cb
CW
416 <field>
417 <name>address_id</name>
455cfd16 418 <title>Contribution Address</title>
6d68a4cb
CW
419 <type>int unsigned</type>
420 <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>
421 <add>2.2</add>
422 </field>
423 <foreignKey>
424 <name>address_id</name>
425 <table>civicrm_address</table>
426 <key>id</key>
427 <add>2.2</add>
6a488035
TO
428 <onDelete>SET NULL</onDelete>
429 </foreignKey>
6d68a4cb
CW
430 <field>
431 <name>check_number</name>
6a488035
TO
432 <title>Check Number</title>
433 <headerPattern>/check(.?number)?/i</headerPattern>
6d68a4cb 434 <type>varchar</type>
6a488035 435 <length>255</length>
614d72ec 436 <html>
437 <type>Text</type>
54f5e87f 438 <size>6</size>
614d72ec 439 </html>
6a488035 440 <import>true</import>
6d68a4cb
CW
441 <add>2.2</add>
442 </field>
6a488035
TO
443 <index>
444 <name>check_number</name>
445 <fieldName>check_number</fieldName>
446 <add>2.2</add>
447 </index>
6d68a4cb 448 <field>
6a488035
TO
449 <name>campaign_id</name>
450 <uniqueName>contribution_campaign_id</uniqueName>
451 <type>int unsigned</type>
e1ab2e91 452 <title>Campaign</title>
6d68a4cb
CW
453 <import>true</import>
454 <comment>The campaign for which this contribution has been triggered.</comment>
3e3eacd0
CW
455 <pseudoconstant>
456 <table>civicrm_campaign</table>
457 <keyColumn>id</keyColumn>
458 <labelColumn>title</labelColumn>
3e3eacd0 459 </pseudoconstant>
6d68a4cb 460 <add>3.4</add>
614d72ec 461 <html>
462 <type>Select</type>
463 </html>
6d68a4cb 464 </field>
933c5f44 465 <field>
466 <name>creditnote_id</name>
467 <title>Credit Note ID</title>
468 <type>varchar</type>
469 <length>255</length>
470 <import>true</import>
471 <headerPattern>/creditnote(.?id)?/i</headerPattern>
472 <comment>unique credit note id, system generated or passed in</comment>
115fa278 473 <add>4.6</add>
933c5f44 474 <html>
475 <type>Text</type>
476 </html>
477 </field>
8ca47f5c 478 <index>
d9fab10f 479 <name>index_creditnote_id</name>
8ca47f5c 480 <fieldName>creditnote_id</fieldName>
481 <add>4.7</add>
482 </index>
d91b8b33 483 <field>
484 <name>tax_amount</name>
115fa278 485 <title>Tax Amount</title>
d91b8b33 486 <type>decimal</type>
487 <import>true</import>
488 <headerPattern>/tax(.?am(ou)?nt)?/i</headerPattern>
489 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
490 <comment>Total tax amount of this contribution.</comment>
115fa278 491 <add>4.6</add>
d91b8b33 492 <html>
493 <type>Text</type>
494 </html>
495 </field>
6d68a4cb
CW
496 <foreignKey>
497 <name>campaign_id</name>
498 <table>civicrm_campaign</table>
499 <key>id</key>
6a488035
TO
500 <onDelete>SET NULL</onDelete>
501 </foreignKey>
502</table>