Merge pull request #7661 from agileware/crm-17848
[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 <field>
10 <name>id</name>
11 <uniqueName>contribution_id</uniqueName>
12 <type>int unsigned</type>
13 <required>true</required>
14 <import>true</import>
15 <title>Contribution ID</title>
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>
25 <uniqueName>contribution_contact_id</uniqueName>
26 <title>Contact ID</title>
27 <type>int unsigned</type>
28 <required>true</required>
29 <import>true</import>
30 <headerPattern>/contact(.?id)?/i</headerPattern>
31 <dataPattern>/^\d+$/</dataPattern>
32 <comment>FK to Contact ID</comment>
33 <html>
34 <type>EntityRef</type>
35 </html>
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>
43 <onDelete>CASCADE</onDelete>
44 </foreignKey>
45 <field>
46 <name>solicitor_id</name>
47 <title>Solicitor ID</title>
48 <type>int unsigned</type>
49 <comment>FK to Solicitor ID</comment>
50 <add>1.4</add>
51 <drop>2.2</drop>
52 </field>
53 <foreignKey>
54 <name>solicitor_id</name>
55 <table>civicrm_contact</table>
56 <key>id</key>
57 <add>1.4</add>
58 <drop>2.2</drop>
59 <onDelete>SET NULL</onDelete>
60 </foreignKey>
61 <field>
62 <name>contribution_type_id</name>
63 <title>Contribution Type</title>
64 <export>false</export>
65 <type>int unsigned</type>
66 <comment>FK to Contribution Type</comment>
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>
76 <onDelete>SET NULL</onDelete>
77 </foreignKey>
78 <field>
79 <name>financial_type_id</name>
80 <title>Financial Type</title>
81 <export>false</export>
82 <type>int unsigned</type>
83 <comment>FK to Financial Type for (total_amount - non_deductible_amount).</comment>
84 <pseudoconstant>
85 <table>civicrm_financial_type</table>
86 <keyColumn>id</keyColumn>
87 <labelColumn>name</labelColumn>
88 </pseudoconstant>
89 <html>
90 <type>Select</type>
91 </html>
92 <add>4.3</add>
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>
102 <title>Contribution Page ID</title>
103 <type>int unsigned</type>
104 <import>true</import>
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>
111 <html>
112 <type>Select</type>
113 </html>
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>
120 <onDelete>SET NULL</onDelete>
121 </foreignKey>
122 <field>
123 <name>payment_instrument_id</name>
124 <uniqueName>payment_instrument_id</uniqueName>
125 <title>Payment Method</title>
126 <type>int unsigned</type>
127 <comment>FK to Payment Instrument</comment>
128 <pseudoconstant>
129 <optionGroupName>payment_instrument</optionGroupName>
130 </pseudoconstant>
131 <html>
132 <type>Select</type>
133 </html>
134 <add>1.3</add>
135 </field>
136 <index>
137 <name>UI_contrib_payment_instrument_id</name>
138 <fieldName>payment_instrument_id</fieldName>
139 <add>1.6</add>
140 </index>
141 <field>
142 <name>receive_date</name>
143 <title>Date Received</title>
144 <type>datetime</type>
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>
148 <comment>Date contribution was received - not necessarily the creation date of the record</comment>
149 <add>1.3</add>
150 <html>
151 <type>Select Date</type>
152 </html>
153 </field>
154 <field>
155 <name>non_deductible_amount</name>
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>
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>
164 <html>
165 <type>Text</type>
166 </html>
167 </field>
168 <field>
169 <name>total_amount</name>
170 <type>decimal</type>
171 <required>true</required>
172 <import>true</import>
173 <headerPattern>/^total|(.?^am(ou)?nt)/i</headerPattern>
174 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
175 <comment>Total amount of this contribution. Use market value for non-monetary gifts.</comment>
176 <add>1.3</add>
177 <html>
178 <type>Text</type>
179 </html>
180 </field>
181 <field>
182 <name>fee_amount</name>
183 <type>decimal</type>
184 <import>true</import>
185 <headerPattern>/fee(.?am(ou)?nt)?/i</headerPattern>
186 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
187 <comment>actual processor fee if known - may be 0.</comment>
188 <add>1.3</add>
189 <html>
190 <type>Text</type>
191 </html>
192 </field>
193 <field>
194 <name>net_amount</name>
195 <type>decimal</type>
196 <import>true</import>
197 <headerPattern>/net(.?am(ou)?nt)?/i</headerPattern>
198 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
199 <comment>actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.</comment>
200 <add>1.3</add>
201 <html>
202 <type>Text</type>
203 </html>
204 </field>
205 <field>
206 <name>trxn_id</name>
207 <title>Transaction ID</title>
208 <type>varchar</type>
209 <length>255</length>
210 <import>true</import>
211 <headerPattern>/tr(ansactio|x)n(.?id)?/i</headerPattern>
212 <comment>unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method</comment>
213 <html>
214 <type>Text</type>
215 </html>
216 <add>1.3</add>
217 </field>
218 <field>
219 <name>invoice_id</name>
220 <title>Invoice ID</title>
221 <type>varchar</type>
222 <length>255</length>
223 <import>true</import>
224 <headerPattern>/invoice(.?id)?/i</headerPattern>
225 <comment>unique invoice id, system generated or passed in</comment>
226 <html>
227 <type>Text</type>
228 </html>
229 <add>1.3</add>
230 </field>
231 <field>
232 <name>currency</name>
233 <type>varchar</type>
234 <length>3</length>
235 <default>NULL</default>
236 <import>true</import>
237 <headerPattern>/cur(rency)?/i</headerPattern>
238 <dataPattern>/^[A-Z]{3}$/i</dataPattern>
239 <comment>3 character string, value from config setting or input via user.</comment>
240 <add>1.3</add>
241 <pseudoconstant>
242 <table>civicrm_currency</table>
243 <keyColumn>name</keyColumn>
244 <labelColumn>full_name</labelColumn>
245 <nameColumn>numeric_code</nameColumn>
246 </pseudoconstant>
247 <html>
248 <type>Select</type>
249 </html>
250 </field>
251 <field>
252 <name>cancel_date</name>
253 <type>datetime</type>
254 <import>true</import>
255 <headerPattern>/cancel(.?date)?/i</headerPattern>
256 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
257 <comment>when was gift cancelled</comment>
258 <add>1.3</add>
259 <html>
260 <type>Select Date</type>
261 </html>
262 </field>
263 <field>
264 <name>cancel_reason</name>
265 <type>text</type>
266 <import>true</import>
267 <headerPattern>/(cancel.?)?reason/i</headerPattern>
268 <html>
269 <type>Text</type>
270 </html>
271 <add>1.3</add>
272 </field>
273 <field>
274 <name>receipt_date</name>
275 <type>datetime</type>
276 <import>true</import>
277 <headerPattern>/receipt(.?date)?/i</headerPattern>
278 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
279 <comment>when (if) receipt was sent. populated automatically for online donations w/ automatic receipting</comment>
280 <html>
281 <type>Select Date</type>
282 </html>
283 <add>1.3</add>
284 </field>
285 <field>
286 <name>thankyou_date</name>
287 <title>Thank-you Date</title>
288 <type>datetime</type>
289 <import>true</import>
290 <headerPattern>/thank(s|(.?you))?(.?date)?/i</headerPattern>
291 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
292 <comment>when (if) was donor thanked</comment>
293 <add>1.3</add>
294 <html>
295 <type>Select Date</type>
296 </html>
297 </field>
298 <field>
299 <name>source</name>
300 <uniqueName>contribution_source</uniqueName>
301 <title>Contribution Source</title>
302 <type>varchar</type>
303 <length>255</length>
304 <import>true</import>
305 <headerPattern>/source/i</headerPattern>
306 <comment>Origin of this Contribution.</comment>
307 <add>1.3</add>
308 <html>
309 <type>Text</type>
310 </html>
311 </field>
312 <index>
313 <name>index_source</name>
314 <fieldName>source</fieldName>
315 <add>4.7</add>
316 </index>
317 <field>
318 <name>amount_level</name>
319 <title>Amount Label</title>
320 <type>text</type>
321 <import>true</import>
322 <add>1.7</add>
323 <html>
324 <type>Text</type>
325 </html>
326 </field>
327 <field>
328 <name>note</name>
329 <type>text</type>
330 <comment>Note and/or Comment.</comment>
331 <import>true</import>
332 <headerPattern>/Note|Comment/i</headerPattern>
333 <dataPattern>//</dataPattern>
334 <add>1.4</add>
335 <drop>1.7</drop>
336 </field>
337 <index>
338 <name>UI_contrib_trxn_id</name>
339 <fieldName>trxn_id</fieldName>
340 <unique>true</unique>
341 <add>2.1</add>
342 </index>
343 <index>
344 <name>UI_contrib_invoice_id</name>
345 <fieldName>invoice_id</fieldName>
346 <unique>true</unique>
347 <add>2.1</add>
348 </index>
349 <field>
350 <name>contribution_recur_id</name>
351 <title>Recurring Contribution ID</title>
352 <type>int unsigned</type>
353 <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>
354 <add>1.4</add>
355 </field>
356 <foreignKey>
357 <name>contribution_recur_id</name>
358 <table>civicrm_contribution_recur</table>
359 <key>id</key>
360 <add>1.4</add>
361 <onDelete>SET NULL</onDelete>
362 </foreignKey>
363 <field>
364 <name>is_test</name>
365 <title>Test</title>
366 <type>boolean</type>
367 <default>0</default>
368 <import>true</import>
369 <html>
370 <type>CheckBox</type>
371 </html>
372 </field>
373 <field>
374 <name>is_pay_later</name>
375 <title>Is Pay Later</title>
376 <type>boolean</type>
377 <default>0</default>
378 <import>true</import>
379 <add>2.1</add>
380 <html>
381 <type>CheckBox</type>
382 </html>
383 </field>
384 <field>
385 <name>contribution_status_id</name>
386 <title>Contribution Status ID</title>
387 <type>int unsigned</type>
388 <default>1</default>
389 <import>true</import>
390 <export>true</export>
391 <headerPattern>/status/i</headerPattern>
392 <pseudoconstant>
393 <optionGroupName>contribution_status</optionGroupName>
394 </pseudoconstant>
395 <html>
396 <type>Select</type>
397 </html>
398 <add>1.6</add>
399 </field>
400 <index>
401 <name>index_contribution_status</name>
402 <fieldName>contribution_status_id</fieldName>
403 <add>1.6</add>
404 </index>
405 <index>
406 <name>received_date</name>
407 <fieldName>receive_date</fieldName>
408 <add>1.6</add>
409 </index>
410 <field>
411 <name>address_id</name>
412 <title>Contribution Address</title>
413 <type>int unsigned</type>
414 <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>
415 <add>2.2</add>
416 </field>
417 <foreignKey>
418 <name>address_id</name>
419 <table>civicrm_address</table>
420 <key>id</key>
421 <add>2.2</add>
422 <onDelete>SET NULL</onDelete>
423 </foreignKey>
424 <field>
425 <name>check_number</name>
426 <title>Check Number</title>
427 <headerPattern>/check(.?number)?/i</headerPattern>
428 <type>varchar</type>
429 <length>255</length>
430 <html>
431 <type>Text</type>
432 <size>6</size>
433 </html>
434 <import>true</import>
435 <add>2.2</add>
436 </field>
437 <index>
438 <name>check_number</name>
439 <fieldName>check_number</fieldName>
440 <add>2.2</add>
441 </index>
442 <field>
443 <name>campaign_id</name>
444 <uniqueName>contribution_campaign_id</uniqueName>
445 <type>int unsigned</type>
446 <title>Campaign</title>
447 <import>true</import>
448 <comment>The campaign for which this contribution has been triggered.</comment>
449 <pseudoconstant>
450 <table>civicrm_campaign</table>
451 <keyColumn>id</keyColumn>
452 <labelColumn>title</labelColumn>
453 </pseudoconstant>
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 </table>