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