Revert "Schema - Fix boolean fields in various tables"
[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 <required>true</required>
385 <import>true</import>
386 <html>
387 <type>CheckBox</type>
388 </html>
389 </field>
390 <field>
391 <name>is_pay_later</name>
392 <title>Is Pay Later</title>
393 <type>boolean</type>
394 <default>0</default>
395 <required>true</required>
396 <import>true</import>
397 <add>2.1</add>
398 <html>
399 <type>CheckBox</type>
400 </html>
401 </field>
402 <field>
403 <name>contribution_status_id</name>
404 <title>Contribution Status ID</title>
405 <type>int unsigned</type>
406 <default>1</default>
407 <import>true</import>
408 <export>true</export>
409 <headerPattern>/status/i</headerPattern>
410 <pseudoconstant>
411 <optionGroupName>contribution_status</optionGroupName>
412 </pseudoconstant>
413 <html>
414 <type>Select</type>
415 <label>Contribution Status</label>
416 </html>
417 <add>1.6</add>
418 </field>
419 <index>
420 <name>index_contribution_status</name>
421 <fieldName>contribution_status_id</fieldName>
422 <add>1.6</add>
423 </index>
424 <index>
425 <name>received_date</name>
426 <fieldName>receive_date</fieldName>
427 <add>1.6</add>
428 </index>
429 <field>
430 <name>address_id</name>
431 <uniqueName>contribution_address_id</uniqueName>
432 <title>Address ID</title>
433 <type>int unsigned</type>
434 <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>
435 <html>
436 <label>Address</label>
437 </html>
438 <add>2.2</add>
439 <export>true</export>
440 </field>
441 <foreignKey>
442 <name>address_id</name>
443 <table>civicrm_address</table>
444 <key>id</key>
445 <add>2.2</add>
446 <onDelete>SET NULL</onDelete>
447 </foreignKey>
448 <field>
449 <name>check_number</name>
450 <title>Check Number</title>
451 <uniqueName>contribution_check_number</uniqueName>
452 <headerPattern>/check(.?number)?/i</headerPattern>
453 <type>varchar</type>
454 <length>255</length>
455 <html>
456 <type>Text</type>
457 <size>6</size>
458 </html>
459 <import>true</import>
460 <add>2.2</add>
461 </field>
462 <index>
463 <name>check_number</name>
464 <fieldName>check_number</fieldName>
465 <add>2.2</add>
466 </index>
467 <field>
468 <name>campaign_id</name>
469 <component>CiviCampaign</component>
470 <uniqueName>contribution_campaign_id</uniqueName>
471 <type>int unsigned</type>
472 <title>Campaign ID</title>
473 <import>true</import>
474 <comment>The campaign for which this contribution has been triggered.</comment>
475 <add>3.4</add>
476 <pseudoconstant>
477 <table>civicrm_campaign</table>
478 <keyColumn>id</keyColumn>
479 <labelColumn>title</labelColumn>
480 <prefetch>FALSE</prefetch>
481 </pseudoconstant>
482 <html>
483 <type>EntityRef</type>
484 <label>Campaign</label>
485 </html>
486 </field>
487 <field>
488 <name>creditnote_id</name>
489 <title>Credit Note ID</title>
490 <type>varchar</type>
491 <length>255</length>
492 <import>true</import>
493 <headerPattern>/creditnote(.?id)?/i</headerPattern>
494 <comment>unique credit note id, system generated or passed in</comment>
495 <add>4.6</add>
496 <html>
497 <type>Text</type>
498 </html>
499 </field>
500 <index>
501 <name>index_creditnote_id</name>
502 <fieldName>creditnote_id</fieldName>
503 <add>4.7</add>
504 </index>
505 <field>
506 <name>tax_amount</name>
507 <title>Tax Amount</title>
508 <type>decimal</type>
509 <import>true</import>
510 <headerPattern>/tax(.?am(ou)?nt)?/i</headerPattern>
511 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
512 <comment>Total tax amount of this contribution.</comment>
513 <add>4.6</add>
514 <html>
515 <type>Text</type>
516 </html>
517 </field>
518 <foreignKey>
519 <name>campaign_id</name>
520 <table>civicrm_campaign</table>
521 <key>id</key>
522 <onDelete>SET NULL</onDelete>
523 </foreignKey>
524 <field>
525 <name>revenue_recognition_date</name>
526 <type>datetime</type>
527 <import>true</import>
528 <headerPattern>/revenue(.?date)?/i</headerPattern>
529 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
530 <comment>Stores the date when revenue should be recognized.</comment>
531 <html>
532 <type>Select Date</type>
533 <formatType>activityDateTime</formatType>
534 <label>Revenue Recognition Date</label>
535 </html>
536 <add>4.7</add>
537 </field>
538 <field>
539 <name>is_template</name>
540 <title>Is a Template Contribution</title>
541 <type>boolean</type>
542 <default>0</default>
543 <required>true</required>
544 <import>true</import>
545 <comment>Shows this is a template for recurring contributions.</comment>
546 <readonly>true</readonly>
547 <html>
548 <type>CheckBox</type>
549 </html>
550 <add>5.20</add>
551 </field>
552 </table>