Merge pull request #21966 from mattwire/eventnopricesetcurrency
[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 <description>Financial records consisting of transactions, line-items, etc.</description>
8 <add>1.3</add>
9 <log>true</log>
10 <icon>fa-credit-card</icon>
11 <component>CiviContribute</component>
12 <paths>
13 <add>civicrm/contribute/add?reset=1&amp;action=add&amp;context=standalone</add>
14 <view>civicrm/contact/view/contribution?reset=1&amp;action=view&amp;id=[id]</view>
15 <update>civicrm/contact/view/contribution?reset=1&amp;action=update&amp;id=[id]</update>
16 <delete>civicrm/contact/view/contribution?reset=1&amp;action=delete&amp;id=[id]</delete>
17 </paths>
18 <field>
19 <name>id</name>
20 <uniqueName>contribution_id</uniqueName>
21 <type>int unsigned</type>
22 <required>true</required>
23 <import>true</import>
24 <title>Contribution ID</title>
25 <comment>Contribution ID</comment>
26 <html>
27 <type>Number</type>
28 </html>
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>
37 <uniqueName>contribution_contact_id</uniqueName>
38 <title>Contact ID</title>
39 <type>int unsigned</type>
40 <required>true</required>
41 <import>true</import>
42 <headerPattern>/contact(.?id)?/i</headerPattern>
43 <dataPattern>/^\d+$/</dataPattern>
44 <comment>FK to Contact ID</comment>
45 <html>
46 <type>EntityRef</type>
47 <label>Contact</label>
48 </html>
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>
56 <onDelete>CASCADE</onDelete>
57 </foreignKey>
58 <field>
59 <name>financial_type_id</name>
60 <title>Financial Type ID</title>
61 <type>int unsigned</type>
62 <comment>FK to Financial Type for (total_amount - non_deductible_amount).</comment>
63 <pseudoconstant>
64 <table>civicrm_financial_type</table>
65 <keyColumn>id</keyColumn>
66 <labelColumn>name</labelColumn>
67 </pseudoconstant>
68 <export>true</export>
69 <html>
70 <type>Select</type>
71 <label>Financial Type</label>
72 </html>
73 <add>4.3</add>
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>
83 <title>Contribution Page ID</title>
84 <type>int unsigned</type>
85 <import>true</import>
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>
92 <html>
93 <type>Select</type>
94 <label>Contribution Page</label>
95 </html>
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>
102 <onDelete>SET NULL</onDelete>
103 </foreignKey>
104 <field>
105 <name>payment_instrument_id</name>
106 <uniqueName>payment_instrument_id</uniqueName>
107 <title>Payment Method ID</title>
108 <type>int unsigned</type>
109 <comment>FK to Payment Instrument</comment>
110 <export>true</export>
111 <headerPattern>/^payment|(p(ayment\s)?instrument)$/i</headerPattern>
112 <pseudoconstant>
113 <optionGroupName>payment_instrument</optionGroupName>
114 </pseudoconstant>
115 <html>
116 <type>Select</type>
117 <label>Payment Method</label>
118 </html>
119 <add>1.3</add>
120 </field>
121 <index>
122 <name>UI_contrib_payment_instrument_id</name>
123 <fieldName>payment_instrument_id</fieldName>
124 <add>1.6</add>
125 </index>
126 <field>
127 <name>receive_date</name>
128 <title>Date Received</title>
129 <type>datetime</type>
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>
133 <comment>Date contribution was received - not necessarily the creation date of the record</comment>
134 <add>1.3</add>
135 <html>
136 <type>Select Date</type>
137 <formatType>activityDateTime</formatType>
138 </html>
139 </field>
140 <field>
141 <name>non_deductible_amount</name>
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>
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>
150 <html>
151 <type>Text</type>
152 </html>
153 </field>
154 <field>
155 <name>total_amount</name>
156 <type>decimal</type>
157 <required>true</required>
158 <import>true</import>
159 <headerPattern>/^total|(.?^am(ou)?nt)/i</headerPattern>
160 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
161 <comment>Total amount of this contribution. Use market value for non-monetary gifts.</comment>
162 <add>1.3</add>
163 <html>
164 <type>Text</type>
165 <label>Total Amount</label>
166 </html>
167 </field>
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>
174 <field>
175 <name>fee_amount</name>
176 <type>decimal</type>
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>
181 <add>1.3</add>
182 <html>
183 <type>Text</type>
184 <label>Fee Amount</label>
185 </html>
186 </field>
187 <field>
188 <name>net_amount</name>
189 <type>decimal</type>
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>
194 <add>1.3</add>
195 <html>
196 <type>Text</type>
197 <label>Net Amount</label>
198 </html>
199 </field>
200 <field>
201 <name>trxn_id</name>
202 <title>Transaction ID</title>
203 <type>varchar</type>
204 <length>255</length>
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>
208 <readonly>true</readonly>
209 <html>
210 <type>Text</type>
211 </html>
212 <add>1.3</add>
213 </field>
214 <field>
215 <name>invoice_id</name>
216 <title>Invoice Reference</title>
217 <type>varchar</type>
218 <length>255</length>
219 <import>true</import>
220 <headerPattern>/invoice(.?id)?/i</headerPattern>
221 <comment>unique invoice id, system generated or passed in</comment>
222 <readonly>true</readonly>
223 <html>
224 <type>Text</type>
225 </html>
226 <add>1.3</add>
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>
241 <field>
242 <name>currency</name>
243 <type>varchar</type>
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>
250 <add>1.3</add>
251 <pseudoconstant>
252 <table>civicrm_currency</table>
253 <keyColumn>name</keyColumn>
254 <labelColumn>full_name</labelColumn>
255 <nameColumn>name</nameColumn>
256 <abbrColumn>symbol</abbrColumn>
257 </pseudoconstant>
258 <html>
259 <type>Select</type>
260 <label>Currency</label>
261 </html>
262 </field>
263 <field>
264 <name>cancel_date</name>
265 <title>Cancelled / Refunded Date</title>
266 <type>datetime</type>
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>
270 <comment>when was gift cancelled</comment>
271 <add>1.3</add>
272 <html>
273 <type>Select Date</type>
274 <formatType>activityDateTime</formatType>
275 </html>
276 <uniqueName>contribution_cancel_date</uniqueName>
277 </field>
278 <field>
279 <name>cancel_reason</name>
280 <type>text</type>
281 <title>Cancellation / Refund Reason</title>
282 <import>true</import>
283 <export>true</export>
284 <headerPattern>/(cancel.?)?reason/i</headerPattern>
285 <html>
286 <type>Text</type>
287 <size>40</size>
288 </html>
289 <add>1.3</add>
290 </field>
291 <field>
292 <name>receipt_date</name>
293 <type>datetime</type>
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>
298 <html>
299 <type>Select Date</type>
300 <formatType>activityDateTime</formatType>
301 <label>Receipt Date</label>
302 </html>
303 <add>1.3</add>
304 </field>
305 <field>
306 <name>thankyou_date</name>
307 <title>Thank-you Date</title>
308 <type>datetime</type>
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>
312 <comment>when (if) was donor thanked</comment>
313 <add>1.3</add>
314 <html>
315 <type>Select Date</type>
316 <formatType>activityDateTime</formatType>
317 </html>
318 </field>
319 <field>
320 <name>source</name>
321 <uniqueName>contribution_source</uniqueName>
322 <title>Contribution Source</title>
323 <type>varchar</type>
324 <length>255</length>
325 <import>true</import>
326 <headerPattern>/source/i</headerPattern>
327 <comment>Origin of this Contribution.</comment>
328 <add>1.3</add>
329 <html>
330 <type>Text</type>
331 </html>
332 </field>
333 <index>
334 <name>index_source</name>
335 <fieldName>source</fieldName>
336 <add>4.7</add>
337 </index>
338 <field>
339 <name>amount_level</name>
340 <title>Amount Label</title>
341 <type>text</type>
342 <import>true</import>
343 <add>1.7</add>
344 <html>
345 <type>Text</type>
346 </html>
347 </field>
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>
360 <field>
361 <name>contribution_recur_id</name>
362 <title>Recurring Contribution ID</title>
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>
365 <export>true</export>
366 <readonly>true</readonly>
367 <html>
368 <label>Recurring Contribution</label>
369 </html>
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>
377 <onDelete>SET NULL</onDelete>
378 </foreignKey>
379 <field>
380 <name>is_test</name>
381 <title>Test</title>
382 <type>boolean</type>
383 <default>0</default>
384 <import>true</import>
385 <html>
386 <type>CheckBox</type>
387 </html>
388 </field>
389 <field>
390 <name>is_pay_later</name>
391 <title>Is Pay Later</title>
392 <type>boolean</type>
393 <default>0</default>
394 <import>true</import>
395 <add>2.1</add>
396 <html>
397 <type>CheckBox</type>
398 </html>
399 </field>
400 <field>
401 <name>contribution_status_id</name>
402 <title>Contribution Status ID</title>
403 <type>int unsigned</type>
404 <default>1</default>
405 <import>true</import>
406 <export>true</export>
407 <headerPattern>/status/i</headerPattern>
408 <pseudoconstant>
409 <optionGroupName>contribution_status</optionGroupName>
410 </pseudoconstant>
411 <html>
412 <type>Select</type>
413 <label>Contribution Status</label>
414 </html>
415 <add>1.6</add>
416 </field>
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>
427 <field>
428 <name>address_id</name>
429 <uniqueName>contribution_address_id</uniqueName>
430 <title>Address ID</title>
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>
433 <html>
434 <label>Address</label>
435 </html>
436 <add>2.2</add>
437 <export>true</export>
438 </field>
439 <foreignKey>
440 <name>address_id</name>
441 <table>civicrm_address</table>
442 <key>id</key>
443 <add>2.2</add>
444 <onDelete>SET NULL</onDelete>
445 </foreignKey>
446 <field>
447 <name>check_number</name>
448 <title>Check Number</title>
449 <uniqueName>contribution_check_number</uniqueName>
450 <headerPattern>/check(.?number)?/i</headerPattern>
451 <type>varchar</type>
452 <length>255</length>
453 <html>
454 <type>Text</type>
455 <size>6</size>
456 </html>
457 <import>true</import>
458 <add>2.2</add>
459 </field>
460 <index>
461 <name>check_number</name>
462 <fieldName>check_number</fieldName>
463 <add>2.2</add>
464 </index>
465 <field>
466 <name>campaign_id</name>
467 <component>CiviCampaign</component>
468 <uniqueName>contribution_campaign_id</uniqueName>
469 <type>int unsigned</type>
470 <title>Campaign ID</title>
471 <import>true</import>
472 <comment>The campaign for which this contribution has been triggered.</comment>
473 <add>3.4</add>
474 <pseudoconstant>
475 <table>civicrm_campaign</table>
476 <keyColumn>id</keyColumn>
477 <labelColumn>title</labelColumn>
478 <prefetch>FALSE</prefetch>
479 </pseudoconstant>
480 <html>
481 <type>EntityRef</type>
482 <label>Campaign</label>
483 </html>
484 </field>
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>
493 <add>4.6</add>
494 <html>
495 <type>Text</type>
496 </html>
497 </field>
498 <index>
499 <name>index_creditnote_id</name>
500 <fieldName>creditnote_id</fieldName>
501 <add>4.7</add>
502 </index>
503 <field>
504 <name>tax_amount</name>
505 <title>Tax Amount</title>
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>
511 <add>4.6</add>
512 <html>
513 <type>Text</type>
514 </html>
515 </field>
516 <foreignKey>
517 <name>campaign_id</name>
518 <table>civicrm_campaign</table>
519 <key>id</key>
520 <onDelete>SET NULL</onDelete>
521 </foreignKey>
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>
531 <formatType>activityDateTime</formatType>
532 <label>Revenue Recognition Date</label>
533 </html>
534 <add>4.7</add>
535 </field>
536 <field>
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>
543 <readonly>true</readonly>
544 <html>
545 <type>CheckBox</type>
546 </html>
547 <add>5.20</add>
548 </field>
549 </table>