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