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