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