Merge pull request #18915 from colemanw/entityPaths2
[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 <icon>fa-credit-card</icon>
10 <paths>
11 <add>civicrm/contribute/add?reset=1&amp;action=add&amp;context=standalone</add>
12 <view>civicrm/contact/view/contribution?reset=1&amp;action=view&amp;id=[id]</view>
13 <update>civicrm/contact/view/contribution?reset=1&amp;action=update&amp;id=[id]</update>
14 <delete>civicrm/contact/view/contribution?reset=1&amp;action=delete&amp;id=[id]</delete>
15 </paths>
16 <field>
17 <name>id</name>
18 <uniqueName>contribution_id</uniqueName>
19 <type>int unsigned</type>
20 <required>true</required>
21 <import>true</import>
22 <title>Contribution ID</title>
23 <comment>Contribution ID</comment>
24 <html>
25 <type>Text</type>
26 </html>
27 <add>1.3</add>
28 </field>
29 <primaryKey>
30 <name>id</name>
31 <autoincrement>true</autoincrement>
32 </primaryKey>
33 <field>
34 <name>contact_id</name>
35 <uniqueName>contribution_contact_id</uniqueName>
36 <title>Contact ID</title>
37 <type>int unsigned</type>
38 <required>true</required>
39 <import>true</import>
40 <headerPattern>/contact(.?id)?/i</headerPattern>
41 <dataPattern>/^\d+$/</dataPattern>
42 <comment>FK to Contact ID</comment>
43 <html>
44 <type>EntityRef</type>
45 </html>
46 <add>1.3</add>
47 </field>
48 <foreignKey>
49 <name>contact_id</name>
50 <table>civicrm_contact</table>
51 <key>id</key>
52 <add>1.3</add>
53 <onDelete>CASCADE</onDelete>
54 </foreignKey>
55 <field>
56 <name>financial_type_id</name>
57 <title>Financial Type ID</title>
58 <type>int unsigned</type>
59 <comment>FK to Financial Type for (total_amount - non_deductible_amount).</comment>
60 <pseudoconstant>
61 <table>civicrm_financial_type</table>
62 <keyColumn>id</keyColumn>
63 <labelColumn>name</labelColumn>
64 </pseudoconstant>
65 <export>true</export>
66 <html>
67 <type>Select</type>
68 <label>Financial Type</label>
69 </html>
70 <add>4.3</add>
71 </field>
72 <foreignKey>
73 <name>financial_type_id</name>
74 <table>civicrm_financial_type</table>
75 <key>id</key>
76 <add>4.3</add>
77 </foreignKey>
78 <field>
79 <name>contribution_page_id</name>
80 <title>Contribution Page ID</title>
81 <type>int unsigned</type>
82 <import>true</import>
83 <comment>The Contribution Page which triggered this contribution</comment>
84 <pseudoconstant>
85 <table>civicrm_contribution_page</table>
86 <keyColumn>id</keyColumn>
87 <labelColumn>title</labelColumn>
88 </pseudoconstant>
89 <html>
90 <type>Select</type>
91 <label>Contribution Page</label>
92 </html>
93 <add>1.5</add>
94 </field>
95 <foreignKey>
96 <name>contribution_page_id</name>
97 <table>civicrm_contribution_page</table>
98 <key>id</key>
99 <onDelete>SET NULL</onDelete>
100 </foreignKey>
101 <field>
102 <name>payment_instrument_id</name>
103 <uniqueName>payment_instrument_id</uniqueName>
104 <title>Payment Method ID</title>
105 <type>int unsigned</type>
106 <comment>FK to Payment Instrument</comment>
107 <export>true</export>
108 <headerPattern>/^payment|(p(ayment\s)?instrument)$/i</headerPattern>
109 <pseudoconstant>
110 <optionGroupName>payment_instrument</optionGroupName>
111 </pseudoconstant>
112 <html>
113 <type>Select</type>
114 </html>
115 <add>1.3</add>
116 </field>
117 <index>
118 <name>UI_contrib_payment_instrument_id</name>
119 <fieldName>payment_instrument_id</fieldName>
120 <add>1.6</add>
121 </index>
122 <field>
123 <name>receive_date</name>
124 <title>Date Received</title>
125 <type>datetime</type>
126 <import>true</import>
127 <headerPattern>/receive(.?date)?/i</headerPattern>
128 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
129 <comment>Date contribution was received - not necessarily the creation date of the record</comment>
130 <add>1.3</add>
131 <html>
132 <type>Select Date</type>
133 <formatType>activityDateTime</formatType>
134 </html>
135 </field>
136 <field>
137 <name>non_deductible_amount</name>
138 <title>Non-deductible Amount</title>
139 <type>decimal</type>
140 <default>0</default>
141 <import>true</import>
142 <headerPattern>/non?.?deduct/i</headerPattern>
143 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
144 <comment>Portion of total amount which is NOT tax deductible. Equal to total_amount for non-deductible financial types.</comment>
145 <add>1.3</add>
146 <html>
147 <type>Text</type>
148 </html>
149 </field>
150 <field>
151 <name>total_amount</name>
152 <type>decimal</type>
153 <required>true</required>
154 <import>true</import>
155 <headerPattern>/^total|(.?^am(ou)?nt)/i</headerPattern>
156 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
157 <comment>Total amount of this contribution. Use market value for non-monetary gifts.</comment>
158 <add>1.3</add>
159 <html>
160 <type>Text</type>
161 </html>
162 </field>
163 <index>
164 <name>index_total_amount_receive_date</name>
165 <fieldName>total_amount</fieldName>
166 <fieldName>receive_date</fieldName>
167 <add>4.7</add>
168 </index>
169 <field>
170 <name>fee_amount</name>
171 <type>decimal</type>
172 <import>true</import>
173 <headerPattern>/fee(.?am(ou)?nt)?/i</headerPattern>
174 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
175 <comment>actual processor fee if known - may be 0.</comment>
176 <add>1.3</add>
177 <html>
178 <type>Text</type>
179 </html>
180 </field>
181 <field>
182 <name>net_amount</name>
183 <type>decimal</type>
184 <import>true</import>
185 <headerPattern>/net(.?am(ou)?nt)?/i</headerPattern>
186 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
187 <comment>actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.</comment>
188 <add>1.3</add>
189 <html>
190 <type>Text</type>
191 </html>
192 </field>
193 <field>
194 <name>trxn_id</name>
195 <title>Transaction ID</title>
196 <type>varchar</type>
197 <length>255</length>
198 <import>true</import>
199 <headerPattern>/tr(ansactio|x)n(.?id)?/i</headerPattern>
200 <comment>unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method</comment>
201 <html>
202 <type>Text</type>
203 </html>
204 <add>1.3</add>
205 </field>
206 <field>
207 <name>invoice_id</name>
208 <title>Invoice Reference</title>
209 <type>varchar</type>
210 <length>255</length>
211 <import>true</import>
212 <headerPattern>/invoice(.?id)?/i</headerPattern>
213 <comment>unique invoice id, system generated or passed in</comment>
214 <html>
215 <type>Text</type>
216 </html>
217 <add>1.3</add>
218 </field>
219 <field>
220 <name>invoice_number</name>
221 <title>Invoice Number</title>
222 <type>varchar</type>
223 <length>255</length>
224 <import>true</import>
225 <headerPattern>/invoice(.?number)?/i</headerPattern>
226 <comment>Human readable invoice number</comment>
227 <html>
228 <type>Text</type>
229 </html>
230 <add>4.7</add>
231 </field>
232 <field>
233 <name>currency</name>
234 <type>varchar</type>
235 <length>3</length>
236 <default>NULL</default>
237 <import>true</import>
238 <headerPattern>/cur(rency)?/i</headerPattern>
239 <dataPattern>/^[A-Z]{3}$/i</dataPattern>
240 <comment>3 character string, value from config setting or input via user.</comment>
241 <add>1.3</add>
242 <pseudoconstant>
243 <table>civicrm_currency</table>
244 <keyColumn>name</keyColumn>
245 <labelColumn>full_name</labelColumn>
246 <nameColumn>name</nameColumn>
247 <abbrColumn>symbol</abbrColumn>
248 </pseudoconstant>
249 <html>
250 <type>Select</type>
251 </html>
252 </field>
253 <field>
254 <name>cancel_date</name>
255 <title>Cancelled / Refunded Date</title>
256 <type>datetime</type>
257 <import>true</import>
258 <headerPattern>/cancel(.?date)?/i</headerPattern>
259 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
260 <comment>when was gift cancelled</comment>
261 <add>1.3</add>
262 <html>
263 <type>Select Date</type>
264 <formatType>activityDateTime</formatType>
265 </html>
266 <uniqueName>contribution_cancel_date</uniqueName>
267 </field>
268 <field>
269 <name>cancel_reason</name>
270 <type>text</type>
271 <title>Cancellation / Refund Reason</title>
272 <import>true</import>
273 <export>true</export>
274 <headerPattern>/(cancel.?)?reason/i</headerPattern>
275 <html>
276 <type>Text</type>
277 <size>40</size>
278 </html>
279 <add>1.3</add>
280 </field>
281 <field>
282 <name>receipt_date</name>
283 <type>datetime</type>
284 <import>true</import>
285 <headerPattern>/receipt(.?date)?/i</headerPattern>
286 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
287 <comment>when (if) receipt was sent. populated automatically for online donations w/ automatic receipting</comment>
288 <html>
289 <type>Select Date</type>
290 <formatType>activityDateTime</formatType>
291 </html>
292 <add>1.3</add>
293 </field>
294 <field>
295 <name>thankyou_date</name>
296 <title>Thank-you Date</title>
297 <type>datetime</type>
298 <import>true</import>
299 <headerPattern>/thank(s|(.?you))?(.?date)?/i</headerPattern>
300 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
301 <comment>when (if) was donor thanked</comment>
302 <add>1.3</add>
303 <html>
304 <type>Select Date</type>
305 <formatType>activityDateTime</formatType>
306 </html>
307 </field>
308 <field>
309 <name>source</name>
310 <uniqueName>contribution_source</uniqueName>
311 <title>Contribution Source</title>
312 <type>varchar</type>
313 <length>255</length>
314 <import>true</import>
315 <headerPattern>/source/i</headerPattern>
316 <comment>Origin of this Contribution.</comment>
317 <add>1.3</add>
318 <html>
319 <type>Text</type>
320 </html>
321 </field>
322 <index>
323 <name>index_source</name>
324 <fieldName>source</fieldName>
325 <add>4.7</add>
326 </index>
327 <field>
328 <name>amount_level</name>
329 <title>Amount Label</title>
330 <type>text</type>
331 <import>true</import>
332 <add>1.7</add>
333 <html>
334 <type>Text</type>
335 </html>
336 </field>
337 <index>
338 <name>UI_contrib_trxn_id</name>
339 <fieldName>trxn_id</fieldName>
340 <unique>true</unique>
341 <add>2.1</add>
342 </index>
343 <index>
344 <name>UI_contrib_invoice_id</name>
345 <fieldName>invoice_id</fieldName>
346 <unique>true</unique>
347 <add>2.1</add>
348 </index>
349 <field>
350 <name>contribution_recur_id</name>
351 <title>Recurring Contribution ID</title>
352 <type>int unsigned</type>
353 <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>
354 <export>true</export>
355 <add>1.4</add>
356 </field>
357 <foreignKey>
358 <name>contribution_recur_id</name>
359 <table>civicrm_contribution_recur</table>
360 <key>id</key>
361 <add>1.4</add>
362 <onDelete>SET NULL</onDelete>
363 </foreignKey>
364 <field>
365 <name>is_test</name>
366 <title>Test</title>
367 <type>boolean</type>
368 <default>0</default>
369 <import>true</import>
370 <html>
371 <type>CheckBox</type>
372 </html>
373 </field>
374 <field>
375 <name>is_pay_later</name>
376 <title>Is Pay Later</title>
377 <type>boolean</type>
378 <default>0</default>
379 <import>true</import>
380 <add>2.1</add>
381 <html>
382 <type>CheckBox</type>
383 </html>
384 </field>
385 <field>
386 <name>contribution_status_id</name>
387 <title>Contribution Status ID</title>
388 <type>int unsigned</type>
389 <default>1</default>
390 <import>true</import>
391 <export>true</export>
392 <headerPattern>/status/i</headerPattern>
393 <pseudoconstant>
394 <optionGroupName>contribution_status</optionGroupName>
395 </pseudoconstant>
396 <html>
397 <type>Select</type>
398 </html>
399 <add>1.6</add>
400 </field>
401 <index>
402 <name>index_contribution_status</name>
403 <fieldName>contribution_status_id</fieldName>
404 <add>1.6</add>
405 </index>
406 <index>
407 <name>received_date</name>
408 <fieldName>receive_date</fieldName>
409 <add>1.6</add>
410 </index>
411 <field>
412 <name>address_id</name>
413 <uniqueName>contribution_address_id</uniqueName>
414 <title>Contribution Address</title>
415 <type>int unsigned</type>
416 <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>
417 <add>2.2</add>
418 <export>true</export>
419 </field>
420 <foreignKey>
421 <name>address_id</name>
422 <table>civicrm_address</table>
423 <key>id</key>
424 <add>2.2</add>
425 <onDelete>SET NULL</onDelete>
426 </foreignKey>
427 <field>
428 <name>check_number</name>
429 <title>Check Number</title>
430 <uniqueName>contribution_check_number</uniqueName>
431 <headerPattern>/check(.?number)?/i</headerPattern>
432 <type>varchar</type>
433 <length>255</length>
434 <html>
435 <type>Text</type>
436 <size>6</size>
437 </html>
438 <import>true</import>
439 <add>2.2</add>
440 </field>
441 <index>
442 <name>check_number</name>
443 <fieldName>check_number</fieldName>
444 <add>2.2</add>
445 </index>
446 <field>
447 <name>campaign_id</name>
448 <uniqueName>contribution_campaign_id</uniqueName>
449 <type>int unsigned</type>
450 <title>Campaign</title>
451 <import>true</import>
452 <comment>The campaign for which this contribution has been triggered.</comment>
453 <pseudoconstant>
454 <table>civicrm_campaign</table>
455 <keyColumn>id</keyColumn>
456 <labelColumn>title</labelColumn>
457 </pseudoconstant>
458 <add>3.4</add>
459 <html>
460 <type>Select</type>
461 </html>
462 </field>
463 <field>
464 <name>creditnote_id</name>
465 <title>Credit Note ID</title>
466 <type>varchar</type>
467 <length>255</length>
468 <import>true</import>
469 <headerPattern>/creditnote(.?id)?/i</headerPattern>
470 <comment>unique credit note id, system generated or passed in</comment>
471 <add>4.6</add>
472 <html>
473 <type>Text</type>
474 </html>
475 </field>
476 <index>
477 <name>index_creditnote_id</name>
478 <fieldName>creditnote_id</fieldName>
479 <add>4.7</add>
480 </index>
481 <field>
482 <name>tax_amount</name>
483 <title>Tax Amount</title>
484 <type>decimal</type>
485 <import>true</import>
486 <headerPattern>/tax(.?am(ou)?nt)?/i</headerPattern>
487 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
488 <comment>Total tax amount of this contribution.</comment>
489 <add>4.6</add>
490 <html>
491 <type>Text</type>
492 </html>
493 </field>
494 <foreignKey>
495 <name>campaign_id</name>
496 <table>civicrm_campaign</table>
497 <key>id</key>
498 <onDelete>SET NULL</onDelete>
499 </foreignKey>
500 <field>
501 <name>revenue_recognition_date</name>
502 <type>datetime</type>
503 <import>true</import>
504 <headerPattern>/revenue(.?date)?/i</headerPattern>
505 <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
506 <comment>Stores the date when revenue should be recognized.</comment>
507 <html>
508 <type>Select Date</type>
509 <formatType>activityDateTime</formatType>
510 </html>
511 <add>4.7</add>
512 </field>
513 <field>
514 <name>is_template</name>
515 <title>Is a Template Contribution</title>
516 <type>boolean</type>
517 <default>0</default>
518 <import>true</import>
519 <comment>Shows this is a template for recurring contributions.</comment>
520 <html>
521 <type>CheckBox</type>
522 </html>
523 <add>5.20</add>
524 </field>
525 </table>