Merge pull request #814 from eileenmcnaughton/CRM-12642
[civicrm-core.git] / xml / schema / Contribute / Contribution.xml
CommitLineData
6d68a4cb 1<?xml version="1.0" encoding="iso-8859-1" ?>
6a488035 2
6d68a4cb
CW
3<table>
4 <base>CRM/Contribute</base>
5 <class>Contribution</class>
6 <name>civicrm_contribution</name>
7 <add>1.3</add>
6a488035 8 <log>true</log>
6d68a4cb
CW
9 <field>
10 <name>id</name>
6a488035 11 <uniqueName>contribution_id</uniqueName>
6d68a4cb 12 <type>int unsigned</type>
6a488035 13 <required>true</required>
6d68a4cb 14 <import>true</import>
6a488035 15 <title>Contribution ID</title>
6d68a4cb
CW
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>
6a488035
TO
25 <uniqueName>contribution_contact_id</uniqueName>
26 <title>Contact ID</title>
6d68a4cb
CW
27 <type>int unsigned</type>
28 <required>true</required>
6a488035
TO
29 <import>true</import>
30 <headerPattern>/contact(.?id)?/i</headerPattern>
31 <dataPattern>/^\d+$/</dataPattern>
6d68a4cb
CW
32 <comment>FK to Contact ID</comment>
33 <add>1.3</add>
34 </field>
35 <foreignKey>
36 <name>contact_id</name>
37 <table>civicrm_contact</table>
38 <key>id</key>
39 <add>1.3</add>
6a488035 40 <onDelete>CASCADE</onDelete>
6d68a4cb
CW
41 </foreignKey>
42 <field>
43 <name>solicitor_id</name>
6a488035 44 <title>Solicitor ID</title>
6d68a4cb
CW
45 <type>int unsigned</type>
46 <comment>FK to Solicitor ID</comment>
47 <add>1.4</add>
6a488035 48 <drop>2.2</drop>
6d68a4cb
CW
49 </field>
50 <foreignKey>
51 <name>solicitor_id</name>
52 <table>civicrm_contact</table>
53 <key>id</key>
54 <add>1.4</add>
6a488035
TO
55 <drop>2.2</drop>
56 <onDelete>SET NULL</onDelete>
6d68a4cb
CW
57 </foreignKey>
58 <field>
59 <name>contribution_type_id</name>
6a488035
TO
60 <title>Contribution Type</title>
61 <export>false</export>
62 <type>int unsigned</type>
63 <comment>FK to Contribution Type</comment>
6d68a4cb
CW
64 <add>1.3</add>
65 <drop>4.3</drop>
66 </field>
67 <foreignKey>
68 <name>contribution_type_id</name>
69 <table>civicrm_contribution_type</table>
70 <key>id</key>
71 <add>1.3</add>
72 <drop>4.3</drop>
6a488035 73 <onDelete>SET NULL</onDelete>
6d68a4cb
CW
74 </foreignKey>
75 <field>
6a488035
TO
76 <name>financial_type_id</name>
77 <title>Financial Type</title>
78 <export>false</export>
79 <type>int unsigned</type>
80 <comment>FK to Financial Type for (total_amount - non_deductible_amount).</comment>
6d68a4cb
CW
81 <pseudoconstant>
82 <table>civicrm_financial_type</table>
83 <keyColumn>id</keyColumn>
84 <labelColumn>name</labelColumn>
85 </pseudoconstant>
6a488035 86 <add>4.3</add>
6d68a4cb
CW
87 </field>
88 <foreignKey>
89 <name>financial_type_id</name>
90 <table>civicrm_financial_type</table>
91 <key>id</key>
92 <add>4.3</add>
93 </foreignKey>
94 <field>
95 <name>contribution_page_id</name>
6a488035
TO
96 <title>Contribution Page</title>
97 <type>int unsigned</type>
98 <import>true</import>
6d68a4cb
CW
99 <comment>The Contribution Page which triggered this contribution</comment>
100 <pseudoconstant>
101 <table>civicrm_contribution_page</table>
102 <keyColumn>id</keyColumn>
103 <labelColumn>title</labelColumn>
104 </pseudoconstant>
105 <add>1.5</add>
106 </field>
107 <foreignKey>
108 <name>contribution_page_id</name>
109 <table>civicrm_contribution_page</table>
110 <key>id</key>
6a488035
TO
111 <onDelete>SET NULL</onDelete>
112 </foreignKey>
6d68a4cb 113 <field>
6a488035
TO
114 <name>payment_instrument_id</name>
115 <uniqueName>contribution_payment_instrument_id</uniqueName>
116 <title>Payment Instrument</title>
117 <type>int unsigned</type>
118 <comment>FK to Payment Instrument</comment>
119 <pseudoconstant>
6d68a4cb 120 <optionGroupName>payment_instrument</optionGroupName>
6a488035
TO
121 </pseudoconstant>
122 <add>1.3</add>
6d68a4cb 123 </field>
6a488035
TO
124 <index>
125 <name>UI_contrib_payment_instrument_id</name>
6d68a4cb 126 <fieldName>payment_instrument_id</fieldName>
6a488035 127 <add>1.6</add>
6d68a4cb
CW
128 </index>
129 <field>
130 <name>receive_date</name>
131 <type>datetime</type>
6a488035
TO
132 <import>true</import>
133 <headerPattern>/receive(.?date)?/i</headerPattern>
134 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
6d68a4cb
CW
135 <comment>when was gift received</comment>
136 <add>1.3</add>
137 </field>
138 <field>
139 <name>non_deductible_amount</name>
6a488035
TO
140 <title>Non-deductible Amount</title>
141 <type>decimal</type>
142 <default>0</default>
143 <import>true</import>
144 <headerPattern>/non?.?deduct/i</headerPattern>
145 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
6d68a4cb
CW
146 <comment>Portion of total amount which is NOT tax deductible. Equal to total_amount for non-deductible financial types.</comment>
147 <add>1.3</add>
6a488035 148 </field>
6d68a4cb
CW
149 <field>
150 <name>total_amount</name>
151 <type>decimal</type>
6a488035
TO
152 <required>true</required>
153 <import>true</import>
154 <headerPattern>/^total|(.?^am(ou)?nt)/i</headerPattern>
155 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
6d68a4cb
CW
156 <comment>Total amount of this contribution. Use market value for non-monetary gifts.</comment>
157 <add>1.3</add>
6a488035 158 </field>
6d68a4cb
CW
159 <field>
160 <name>fee_amount</name>
161 <type>decimal</type>
6a488035
TO
162 <import>true</import>
163 <headerPattern>/fee(.?am(ou)?nt)?/i</headerPattern>
164 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
165 <comment>actual processor fee if known - may be 0.</comment>
6d68a4cb
CW
166 <add>1.3</add>
167 </field>
168 <field>
169 <name>net_amount</name>
170 <type>decimal</type>
6a488035
TO
171 <import>true</import>
172 <headerPattern>/net(.?am(ou)?nt)?/i</headerPattern>
173 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
174 <comment>actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.</comment>
6d68a4cb 175 <add>1.3</add>
6a488035 176 </field>
6d68a4cb
CW
177 <field>
178 <name>trxn_id</name>
6a488035 179 <title>Transaction ID</title>
6d68a4cb
CW
180 <type>varchar</type>
181 <length>255</length>
6a488035
TO
182 <import>true</import>
183 <headerPattern>/tr(ansactio|x)n(.?id)?/i</headerPattern>
184 <comment>unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method</comment>
6d68a4cb
CW
185 <add>1.3</add>
186 </field>
187 <field>
188 <name>invoice_id</name>
6a488035 189 <title>Invoice ID</title>
6d68a4cb
CW
190 <type>varchar</type>
191 <length>255</length>
6a488035
TO
192 <import>true</import>
193 <headerPattern>/invoice(.?id)?/i</headerPattern>
194 <comment>unique invoice id, system generated or passed in</comment>
6d68a4cb
CW
195 <add>1.3</add>
196 </field>
197 <field>
198 <name>currency</name>
199 <type>varchar</type>
6a488035
TO
200 <length>3</length>
201 <default>NULL</default>
202 <import>true</import>
203 <headerPattern>/cur(rency)?/i</headerPattern>
204 <dataPattern>/^[A-Z]{3}$/i</dataPattern>
205 <comment>3 character string, value from config setting or input via user.</comment>
bd44e0df
AS
206 <add>1.3</add>
207 <pseudoconstant>
208 <table>civicrm_currency</table>
209 <keyColumn>name</keyColumn>
210 <labelColumn>symbol</labelColumn>
211 </pseudoconstant>
6d68a4cb
CW
212 </field>
213 <field>
214 <name>cancel_date</name>
215 <type>datetime</type>
6a488035
TO
216 <import>true</import>
217 <headerPattern>/cancel(.?date)?/i</headerPattern>
218 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
6d68a4cb
CW
219 <comment>when was gift cancelled</comment>
220 <add>1.3</add>
221 </field>
222 <field>
223 <name>cancel_reason</name>
224 <type>text</type>
6a488035
TO
225 <import>true</import>
226 <headerPattern>/(cancel.?)?reason/i</headerPattern>
6d68a4cb
CW
227 <add>1.3</add>
228 </field>
229 <field>
230 <name>receipt_date</name>
231 <type>datetime</type>
6a488035
TO
232 <import>true</import>
233 <headerPattern>/receipt(.?date)?/i</headerPattern>
234 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
235 <comment>when (if) receipt was sent. populated automatically for online donations w/ automatic receipting</comment>
6d68a4cb
CW
236 <add>1.3</add>
237 </field>
238 <field>
6a488035
TO
239 <name>thankyou_date</name>
240 <title>Thank-you Date</title>
6d68a4cb 241 <type>datetime</type>
6a488035
TO
242 <import>true</import>
243 <headerPattern>/thank(s|(.?you))?(.?date)?/i</headerPattern>
244 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
6d68a4cb
CW
245 <comment>when (if) was donor thanked</comment>
246 <add>1.3</add>
247 </field>
248 <field>
6a488035
TO
249 <name>source</name>
250 <uniqueName>contribution_source</uniqueName>
251 <title>Contribution Source</title>
6d68a4cb 252 <type>varchar</type>
6a488035
TO
253 <length>255</length>
254 <import>true</import>
255 <headerPattern>/source/i</headerPattern>
6d68a4cb
CW
256 <comment>Origin of this Contribution.</comment>
257 <add>1.3</add>
258 </field>
259 <field>
6a488035
TO
260 <name>amount_level</name>
261 <title>Amount Label</title>
6d68a4cb 262 <type>text</type>
6a488035 263 <import>true</import>
6d68a4cb
CW
264 <add>1.7</add>
265 </field>
6a488035
TO
266 <field>
267 <name>note</name>
268 <type>text</type>
269 <comment>Note and/or Comment.</comment>
270 <htmlType>textarea</htmlType>
271 <rows>4</rows>
272 <cols>80</cols>
273 <import>true</import>
274 <headerPattern>/Note|Comment/i</headerPattern>
275 <dataPattern>//</dataPattern>
276 <add>1.4</add>
277 <drop>1.7</drop>
278 </field>
279 <index>
280 <name>UI_contrib_trxn_id</name>
281 <fieldName>trxn_id</fieldName>
282 <unique>true</unique>
283 <add>2.1</add>
284 </index>
285 <index>
286 <name>UI_contrib_invoice_id</name>
287 <fieldName>invoice_id</fieldName>
288 <unique>true</unique>
289 <add>2.1</add>
290 </index>
6d68a4cb
CW
291 <field>
292 <name>contribution_recur_id</name>
293 <type>int unsigned</type>
294 <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>
295 <add>1.4</add>
296 </field>
297 <foreignKey>
298 <name>contribution_recur_id</name>
299 <table>civicrm_contribution_recur</table>
300 <key>id</key>
301 <add>1.4</add>
6a488035
TO
302 <onDelete>SET NULL</onDelete>
303 </foreignKey>
6d68a4cb
CW
304 <field>
305 <name>honor_contact_id</name>
6a488035 306 <title>Honor Contact</title>
6d68a4cb
CW
307 <type>int unsigned</type>
308 <comment>FK to contact ID</comment>
309 <add>1.3</add>
310 </field>
311 <foreignKey>
312 <name>honor_contact_id</name>
313 <table>civicrm_contact</table>
314 <key>id</key>
315 <add>1.6</add>
6a488035 316 <onDelete>SET NULL</onDelete>
6d68a4cb
CW
317 </foreignKey>
318 <field>
319 <name>is_test</name>
6a488035
TO
320 <title>Test</title>
321 <type>boolean</type>
322 <default>0</default>
323 <import>true</import>
324 </field>
6d68a4cb
CW
325 <field>
326 <name>is_pay_later</name>
6a488035
TO
327 <title>Is Pay Later</title>
328 <type>boolean</type>
329 <default>0</default>
330 <import>true</import>
6d68a4cb 331 <add>2.1</add>
6a488035
TO
332 </field>
333 <field>
334 <name>contribution_status_id</name>
335 <title>Contribution Status</title>
336 <type>int unsigned</type>
337 <default>1</default>
338 <import>true</import>
339 <export>true</export>
340 <headerPattern>/status/i</headerPattern>
6d68a4cb
CW
341 <pseudoconstant>
342 <optionGroupName>contribution_status</optionGroupName>
343 </pseudoconstant>
6a488035
TO
344 <add>1.6</add>
345 </field>
346 <field>
347 <name>honor_type_id</name>
348 <title>Honor Type</title>
349 <type>int unsigned</type>
350 <comment>Implicit FK to civicrm_option_value.</comment>
351 <add>2.0</add>
352 <onDelete>SET NULL</onDelete>
cbf48754
AS
353 <pseudoconstant>
354 <optionGroupName>honor_type</optionGroupName>
355 </pseudoconstant>
6a488035
TO
356 </field>
357 <index>
358 <name>index_contribution_status</name>
359 <fieldName>contribution_status_id</fieldName>
360 <add>1.6</add>
361 </index>
362 <index>
363 <name>received_date</name>
364 <fieldName>receive_date</fieldName>
365 <add>1.6</add>
366 </index>
6d68a4cb
CW
367 <field>
368 <name>address_id</name>
369 <type>int unsigned</type>
370 <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>
371 <add>2.2</add>
372 </field>
373 <foreignKey>
374 <name>address_id</name>
375 <table>civicrm_address</table>
376 <key>id</key>
377 <add>2.2</add>
6a488035
TO
378 <onDelete>SET NULL</onDelete>
379 </foreignKey>
6d68a4cb
CW
380 <field>
381 <name>check_number</name>
6a488035
TO
382 <title>Check Number</title>
383 <headerPattern>/check(.?number)?/i</headerPattern>
6d68a4cb 384 <type>varchar</type>
6a488035 385 <length>255</length>
6d68a4cb 386 <size>SIX</size>
6a488035 387 <import>true</import>
6d68a4cb
CW
388 <add>2.2</add>
389 </field>
6a488035
TO
390 <index>
391 <name>check_number</name>
392 <fieldName>check_number</fieldName>
393 <add>2.2</add>
394 </index>
6d68a4cb 395 <field>
6a488035
TO
396 <name>campaign_id</name>
397 <uniqueName>contribution_campaign_id</uniqueName>
398 <type>int unsigned</type>
399 <title>Campaign ID</title>
6d68a4cb
CW
400 <import>true</import>
401 <comment>The campaign for which this contribution has been triggered.</comment>
402 <add>3.4</add>
403 </field>
404 <foreignKey>
405 <name>campaign_id</name>
406 <table>civicrm_campaign</table>
407 <key>id</key>
6a488035
TO
408 <onDelete>SET NULL</onDelete>
409 </foreignKey>
410</table>