e85f2fe88d94da948d59b4f6f93021462391152d
[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 <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>
40 <onDelete>CASCADE</onDelete>
41 </foreignKey>
42 <field>
43 <name>solicitor_id</name>
44 <title>Solicitor ID</title>
45 <type>int unsigned</type>
46 <comment>FK to Solicitor ID</comment>
47 <add>1.4</add>
48 <drop>2.2</drop>
49 </field>
50 <foreignKey>
51 <name>solicitor_id</name>
52 <table>civicrm_contact</table>
53 <key>id</key>
54 <add>1.4</add>
55 <drop>2.2</drop>
56 <onDelete>SET NULL</onDelete>
57 </foreignKey>
58 <field>
59 <name>contribution_type_id</name>
60 <title>Contribution Type</title>
61 <export>false</export>
62 <type>int unsigned</type>
63 <comment>FK to Contribution Type</comment>
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>
73 <onDelete>SET NULL</onDelete>
74 </foreignKey>
75 <field>
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>
81 <pseudoconstant>
82 <table>civicrm_financial_type</table>
83 <keyColumn>id</keyColumn>
84 <labelColumn>name</labelColumn>
85 </pseudoconstant>
86 <add>4.3</add>
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>
96 <title>Contribution Page</title>
97 <type>int unsigned</type>
98 <import>true</import>
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>
111 <onDelete>SET NULL</onDelete>
112 </foreignKey>
113 <field>
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>
120 <optionGroupName>payment_instrument</optionGroupName>
121 </pseudoconstant>
122 <add>1.3</add>
123 </field>
124 <index>
125 <name>UI_contrib_payment_instrument_id</name>
126 <fieldName>payment_instrument_id</fieldName>
127 <add>1.6</add>
128 </index>
129 <field>
130 <name>receive_date</name>
131 <type>datetime</type>
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>
135 <comment>when was gift received</comment>
136 <add>1.3</add>
137 </field>
138 <field>
139 <name>non_deductible_amount</name>
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>
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>
148 </field>
149 <field>
150 <name>total_amount</name>
151 <type>decimal</type>
152 <required>true</required>
153 <import>true</import>
154 <headerPattern>/^total|(.?^am(ou)?nt)/i</headerPattern>
155 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
156 <comment>Total amount of this contribution. Use market value for non-monetary gifts.</comment>
157 <add>1.3</add>
158 </field>
159 <field>
160 <name>fee_amount</name>
161 <type>decimal</type>
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>
166 <add>1.3</add>
167 </field>
168 <field>
169 <name>net_amount</name>
170 <type>decimal</type>
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>
175 <add>1.3</add>
176 </field>
177 <field>
178 <name>trxn_id</name>
179 <title>Transaction ID</title>
180 <type>varchar</type>
181 <length>255</length>
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>
185 <add>1.3</add>
186 </field>
187 <field>
188 <name>invoice_id</name>
189 <title>Invoice ID</title>
190 <type>varchar</type>
191 <length>255</length>
192 <import>true</import>
193 <headerPattern>/invoice(.?id)?/i</headerPattern>
194 <comment>unique invoice id, system generated or passed in</comment>
195 <add>1.3</add>
196 </field>
197 <field>
198 <name>currency</name>
199 <type>varchar</type>
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>
206 <add>1.3</add>
207 <pseudoconstant>
208 <table>civicrm_currency</table>
209 <keyColumn>name</keyColumn>
210 <labelColumn>full_name</labelColumn>
211 <nameColumn>numeric_code</nameColumn>
212 </pseudoconstant>
213 </field>
214 <field>
215 <name>cancel_date</name>
216 <type>datetime</type>
217 <import>true</import>
218 <headerPattern>/cancel(.?date)?/i</headerPattern>
219 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
220 <comment>when was gift cancelled</comment>
221 <add>1.3</add>
222 </field>
223 <field>
224 <name>cancel_reason</name>
225 <type>text</type>
226 <import>true</import>
227 <headerPattern>/(cancel.?)?reason/i</headerPattern>
228 <add>1.3</add>
229 </field>
230 <field>
231 <name>receipt_date</name>
232 <type>datetime</type>
233 <import>true</import>
234 <headerPattern>/receipt(.?date)?/i</headerPattern>
235 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
236 <comment>when (if) receipt was sent. populated automatically for online donations w/ automatic receipting</comment>
237 <add>1.3</add>
238 </field>
239 <field>
240 <name>thankyou_date</name>
241 <title>Thank-you Date</title>
242 <type>datetime</type>
243 <import>true</import>
244 <headerPattern>/thank(s|(.?you))?(.?date)?/i</headerPattern>
245 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
246 <comment>when (if) was donor thanked</comment>
247 <add>1.3</add>
248 </field>
249 <field>
250 <name>source</name>
251 <uniqueName>contribution_source</uniqueName>
252 <title>Contribution Source</title>
253 <type>varchar</type>
254 <length>255</length>
255 <import>true</import>
256 <headerPattern>/source/i</headerPattern>
257 <comment>Origin of this Contribution.</comment>
258 <add>1.3</add>
259 </field>
260 <field>
261 <name>amount_level</name>
262 <title>Amount Label</title>
263 <type>text</type>
264 <import>true</import>
265 <add>1.7</add>
266 </field>
267 <field>
268 <name>note</name>
269 <type>text</type>
270 <comment>Note and/or Comment.</comment>
271 <htmlType>textarea</htmlType>
272 <rows>4</rows>
273 <cols>80</cols>
274 <import>true</import>
275 <headerPattern>/Note|Comment/i</headerPattern>
276 <dataPattern>//</dataPattern>
277 <add>1.4</add>
278 <drop>1.7</drop>
279 </field>
280 <index>
281 <name>UI_contrib_trxn_id</name>
282 <fieldName>trxn_id</fieldName>
283 <unique>true</unique>
284 <add>2.1</add>
285 </index>
286 <index>
287 <name>UI_contrib_invoice_id</name>
288 <fieldName>invoice_id</fieldName>
289 <unique>true</unique>
290 <add>2.1</add>
291 </index>
292 <field>
293 <name>contribution_recur_id</name>
294 <type>int unsigned</type>
295 <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>
296 <add>1.4</add>
297 </field>
298 <foreignKey>
299 <name>contribution_recur_id</name>
300 <table>civicrm_contribution_recur</table>
301 <key>id</key>
302 <add>1.4</add>
303 <onDelete>SET NULL</onDelete>
304 </foreignKey>
305 <field>
306 <name>honor_contact_id</name>
307 <title>Honor Contact</title>
308 <type>int unsigned</type>
309 <comment>FK to contact ID</comment>
310 <add>1.3</add>
311 </field>
312 <foreignKey>
313 <name>honor_contact_id</name>
314 <table>civicrm_contact</table>
315 <key>id</key>
316 <add>1.6</add>
317 <onDelete>SET NULL</onDelete>
318 </foreignKey>
319 <field>
320 <name>is_test</name>
321 <title>Test</title>
322 <type>boolean</type>
323 <default>0</default>
324 <import>true</import>
325 </field>
326 <field>
327 <name>is_pay_later</name>
328 <title>Is Pay Later</title>
329 <type>boolean</type>
330 <default>0</default>
331 <import>true</import>
332 <add>2.1</add>
333 </field>
334 <field>
335 <name>contribution_status_id</name>
336 <title>Contribution Status</title>
337 <type>int unsigned</type>
338 <default>1</default>
339 <import>true</import>
340 <export>true</export>
341 <headerPattern>/status/i</headerPattern>
342 <pseudoconstant>
343 <optionGroupName>contribution_status</optionGroupName>
344 </pseudoconstant>
345 <add>1.6</add>
346 </field>
347 <field>
348 <name>honor_type_id</name>
349 <title>Honor Type</title>
350 <type>int unsigned</type>
351 <comment>Implicit FK to civicrm_option_value.</comment>
352 <add>2.0</add>
353 <onDelete>SET NULL</onDelete>
354 <pseudoconstant>
355 <optionGroupName>honor_type</optionGroupName>
356 </pseudoconstant>
357 </field>
358 <index>
359 <name>index_contribution_status</name>
360 <fieldName>contribution_status_id</fieldName>
361 <add>1.6</add>
362 </index>
363 <index>
364 <name>received_date</name>
365 <fieldName>receive_date</fieldName>
366 <add>1.6</add>
367 </index>
368 <field>
369 <name>address_id</name>
370 <type>int unsigned</type>
371 <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>
372 <add>2.2</add>
373 </field>
374 <foreignKey>
375 <name>address_id</name>
376 <table>civicrm_address</table>
377 <key>id</key>
378 <add>2.2</add>
379 <onDelete>SET NULL</onDelete>
380 </foreignKey>
381 <field>
382 <name>check_number</name>
383 <title>Check Number</title>
384 <headerPattern>/check(.?number)?/i</headerPattern>
385 <type>varchar</type>
386 <length>255</length>
387 <size>SIX</size>
388 <import>true</import>
389 <add>2.2</add>
390 </field>
391 <index>
392 <name>check_number</name>
393 <fieldName>check_number</fieldName>
394 <add>2.2</add>
395 </index>
396 <field>
397 <name>campaign_id</name>
398 <uniqueName>contribution_campaign_id</uniqueName>
399 <type>int unsigned</type>
400 <title>Campaign ID</title>
401 <import>true</import>
402 <comment>The campaign for which this contribution has been triggered.</comment>
403 <pseudoconstant>
404 <table>civicrm_campaign</table>
405 <keyColumn>id</keyColumn>
406 <labelColumn>title</labelColumn>
407 <condition>(end_date IS NULL OR end_date > NOW())</condition>
408 </pseudoconstant>
409 <add>3.4</add>
410 </field>
411 <foreignKey>
412 <name>campaign_id</name>
413 <table>civicrm_campaign</table>
414 <key>id</key>
415 <onDelete>SET NULL</onDelete>
416 </foreignKey>
417 </table>