Merge pull request #7019 from jitendrapurohit/CRM-17395
[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>Autocomplete-Select</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 ID</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 <field>
313 <name>amount_level</name>
314 <title>Amount Label</title>
315 <type>text</type>
316 <import>true</import>
317 <add>1.7</add>
318 <html>
319 <type>Text</type>
320 </html>
321 </field>
322 <field>
323 <name>note</name>
324 <type>text</type>
325 <comment>Note and/or Comment.</comment>
326 <import>true</import>
327 <headerPattern>/Note|Comment/i</headerPattern>
328 <dataPattern>//</dataPattern>
329 <add>1.4</add>
330 <drop>1.7</drop>
331 </field>
332 <index>
333 <name>UI_contrib_trxn_id</name>
334 <fieldName>trxn_id</fieldName>
335 <unique>true</unique>
336 <add>2.1</add>
337 </index>
338 <index>
339 <name>UI_contrib_invoice_id</name>
340 <fieldName>invoice_id</fieldName>
341 <unique>true</unique>
342 <add>2.1</add>
343 </index>
344 <field>
345 <name>contribution_recur_id</name>
346 <title>Recurring Contribution ID</title>
347 <type>int unsigned</type>
348 <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>
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 <title>Contribution Address</title>
408 <type>int unsigned</type>
409 <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>
410 <add>2.2</add>
411 </field>
412 <foreignKey>
413 <name>address_id</name>
414 <table>civicrm_address</table>
415 <key>id</key>
416 <add>2.2</add>
417 <onDelete>SET NULL</onDelete>
418 </foreignKey>
419 <field>
420 <name>check_number</name>
421 <title>Check Number</title>
422 <headerPattern>/check(.?number)?/i</headerPattern>
423 <type>varchar</type>
424 <length>255</length>
425 <html>
426 <type>Text</type>
427 <size>6</size>
428 </html>
429 <import>true</import>
430 <add>2.2</add>
431 </field>
432 <index>
433 <name>check_number</name>
434 <fieldName>check_number</fieldName>
435 <add>2.2</add>
436 </index>
437 <field>
438 <name>campaign_id</name>
439 <uniqueName>contribution_campaign_id</uniqueName>
440 <type>int unsigned</type>
441 <title>Campaign</title>
442 <import>true</import>
443 <comment>The campaign for which this contribution has been triggered.</comment>
444 <pseudoconstant>
445 <table>civicrm_campaign</table>
446 <keyColumn>id</keyColumn>
447 <labelColumn>title</labelColumn>
448 </pseudoconstant>
449 <add>3.4</add>
450 <html>
451 <type>Select</type>
452 </html>
453 </field>
454 <field>
455 <name>creditnote_id</name>
456 <title>Credit Note ID</title>
457 <type>varchar</type>
458 <length>255</length>
459 <import>true</import>
460 <headerPattern>/creditnote(.?id)?/i</headerPattern>
461 <comment>unique credit note id, system generated or passed in</comment>
462 <add>4.6</add>
463 <html>
464 <type>Text</type>
465 </html>
466 </field>
467 <field>
468 <name>tax_amount</name>
469 <title>Tax Amount</title>
470 <type>decimal</type>
471 <import>true</import>
472 <headerPattern>/tax(.?am(ou)?nt)?/i</headerPattern>
473 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
474 <comment>Total tax amount of this contribution.</comment>
475 <add>4.6</add>
476 <html>
477 <type>Text</type>
478 </html>
479 </field>
480 <foreignKey>
481 <name>campaign_id</name>
482 <table>civicrm_campaign</table>
483 <key>id</key>
484 <onDelete>SET NULL</onDelete>
485 </foreignKey>
486 </table>