Merge pull request #21307 from civicrm/5.41
[civicrm-core.git] / xml / schema / Contribute / ContributionRecur.xml
CommitLineData
6a488035
TO
1<?xml version="1.0" encoding="iso-8859-1" ?>
2<table>
3 <base>CRM/Contribute</base>
4 <class>ContributionRecur</class>
5 <name>civicrm_contribution_recur</name>
6 <add>1.6</add>
7 <log>true</log>
7b66c3b5 8 <title>Recurring Contribution</title>
d31fb4e3 9 <component>CiviContribute</component>
6a488035
TO
10 <field>
11 <name>id</name>
23faf53d 12 <uniqueName>contribution_recur_id</uniqueName>
797b807e 13 <title>Recurring Contribution ID</title>
6a488035
TO
14 <type>int unsigned</type>
15 <required>true</required>
16 <comment>Contribution Recur ID</comment>
0481e12c
A
17 <html>
18 <type>Number</type>
19 </html>
6a488035
TO
20 <add>1.6</add>
21 </field>
22 <primaryKey>
23 <name>id</name>
24 <autoincrement>true</autoincrement>
25 </primaryKey>
26 <field>
27 <name>contact_id</name>
57e94608 28 <title>Contact ID</title>
6a488035
TO
29 <type>int unsigned</type>
30 <required>true</required>
c6821d8d 31 <comment>Foreign key to civicrm_contact.id.</comment>
6a488035 32 <add>1.6</add>
c6821d8d
MWMC
33 <html>
34 <type>EntityRef</type>
57e94608 35 <label>Contact</label>
c6821d8d 36 </html>
6a488035
TO
37 </field>
38 <foreignKey>
39 <name>contact_id</name>
40 <table>civicrm_contact</table>
41 <key>id</key>
42 <add>1.6</add>
43 <onDelete>CASCADE</onDelete>
44 </foreignKey>
45 <field>
46 <name>amount</name>
797b807e 47 <title>Amount</title>
6a488035
TO
48 <type>decimal</type>
49 <required>true</required>
a5ba7c40 50 <comment>Amount to be collected (including any sales tax) by payment processor each recurrence.</comment>
6a488035 51 <add>1.6</add>
0c6c47a5 52 <html>
53 <type>Text</type>
54 </html>
6a488035
TO
55 </field>
56 <field>
57 <name>currency</name>
797b807e 58 <title>Currency</title>
6a488035
TO
59 <type>varchar</type>
60 <length>3</length>
61 <default>NULL</default>
62 <comment>3 character string, value from config setting or input via user.</comment>
63 <add>3.2</add>
bd44e0df
AS
64 <pseudoconstant>
65 <table>civicrm_currency</table>
66 <keyColumn>name</keyColumn>
a38a89fc 67 <labelColumn>full_name</labelColumn>
c3de5c5a 68 <nameColumn>name</nameColumn>
a8fdb24e 69 <abbrColumn>symbol</abbrColumn>
bd44e0df 70 </pseudoconstant>
614d72ec 71 <html>
e0991796 72 <type>Select</type>
614d72ec 73 </html>
6a488035
TO
74 </field>
75 <field>
76 <name>frequency_unit</name>
797b807e 77 <title>Frequency Unit</title>
dc73c80d 78 <type>varchar</type>
79 <length>8</length>
6a488035
TO
80 <default>'month'</default>
81 <comment>Time units for recurrence of payment.</comment>
f80ce889 82 <pseudoconstant>
83 <optionGroupName>recur_frequency_units</optionGroupName>
84 <keyColumn>name</keyColumn>
85 </pseudoconstant>
6a488035 86 <add>1.6</add>
614d72ec 87 <html>
88 <type>Select</type>
89 </html>
6a488035
TO
90 </field>
91 <field>
92 <name>frequency_interval</name>
797b807e 93 <title>Interval (number of units)</title>
6a488035
TO
94 <type>int unsigned</type>
95 <required>true</required>
d462cb53 96 <default>1</default>
6a488035
TO
97 <comment>Number of time units for recurrence of payment.</comment>
98 <add>1.6</add>
0c6c47a5 99 <html>
100 <type>Text</type>
101 </html>
6a488035
TO
102 </field>
103 <field>
104 <name>installments</name>
797b807e 105 <title>Number of Installments</title>
6a488035
TO
106 <type>int unsigned</type>
107 <comment>Total number of payments to be made. Set this to 0 if this is an open-ended commitment i.e. no set end date.</comment>
108 <add>1.6</add>
0c6c47a5 109 <html>
110 <type>Text</type>
111 </html>
6a488035
TO
112 </field>
113 <field>
114 <name>start_date</name>
c6821d8d 115 <title>Start Date</title>
6a488035
TO
116 <type>datetime</type>
117 <required>true</required>
d462cb53 118 <default>CURRENT_TIMESTAMP</default>
6a488035
TO
119 <comment>The date the first scheduled recurring contribution occurs.</comment>
120 <add>1.6</add>
0c6c47a5 121 <html>
122 <type>Select Date</type>
c6821d8d 123 <formatType>activityDateTime</formatType>
0c6c47a5 124 </html>
74db51d3 125 <uniqueName>contribution_recur_start_date</uniqueName>
126 <uniqueTitle>Recurring Contribution Start Date</uniqueTitle>
6a488035
TO
127 </field>
128 <field>
129 <name>create_date</name>
c6821d8d 130 <title>Created Date</title>
6a488035
TO
131 <type>datetime</type>
132 <required>true</required>
d462cb53 133 <default>CURRENT_TIMESTAMP</default>
6a488035
TO
134 <comment>When this recurring contribution record was created.</comment>
135 <add>1.6</add>
0c6c47a5 136 <html>
137 <type>Select Date</type>
c6821d8d 138 <formatType>activityDateTime</formatType>
0c6c47a5 139 </html>
74db51d3 140 <uniqueName>contribution_recur_create_date</uniqueName>
141 <uniqueTitle>Recurring Contribution Create Date</uniqueTitle>
6a488035
TO
142 </field>
143 <field>
144 <name>modified_date</name>
c6821d8d 145 <title>Modified Date</title>
6a488035 146 <type>datetime</type>
d462cb53 147 <default>CURRENT_TIMESTAMP</default>
6a488035
TO
148 <comment>Last updated date for this record. mostly the last time a payment was received</comment>
149 <add>1.6</add>
0c6c47a5 150 <html>
151 <type>Select Date</type>
c6821d8d 152 <formatType>activityDateTime</formatType>
0c6c47a5 153 </html>
74db51d3 154 <uniqueName>contribution_recur_modified_date</uniqueName>
155 <uniqueTitle>Recurring Contribution Modified Date</uniqueTitle>
a0e733f3 156 <readonly>true</readonly>
6a488035
TO
157 </field>
158 <field>
159 <name>cancel_date</name>
c6821d8d 160 <title>Cancel Date</title>
6a488035
TO
161 <type>datetime</type>
162 <comment>Date this recurring contribution was cancelled by contributor- if we can get access to it</comment>
163 <add>1.6</add>
0c6c47a5 164 <html>
165 <type>Select Date</type>
9139737b 166 <formatType>activityDate</formatType>
0c6c47a5 167 </html>
74db51d3 168 <uniqueName>contribution_recur_cancel_date</uniqueName>
169 <uniqueTitle>Recurring Contribution Cancel Date</uniqueTitle>
6a488035 170 </field>
ac7a239e 171 <field>
172 <name>cancel_reason</name>
173 <type>text</type>
174 <title>Cancellation Reason</title>
175 <uniqueName>contribution_recur_cancel_reason</uniqueName>
74db51d3 176 <uniqueTitle>Recurring Contribution Cancel Reason</uniqueTitle>
ac7a239e 177 <comment>Free text field for a reason for cancelling</comment>
178 <html>
179 <type>Text</type>
180 <size>40</size>
181 </html>
182 <add>5.13</add>
183 </field>
6a488035
TO
184 <field>
185 <name>end_date</name>
797b807e 186 <title>Recurring Contribution End Date</title>
6a488035
TO
187 <type>datetime</type>
188 <comment>Date this recurring contribution finished successfully</comment>
189 <add>1.6</add>
0c6c47a5 190 <html>
191 <type>Select Date</type>
9139737b 192 <formatType>activityDate</formatType>
0c6c47a5 193 </html>
74db51d3 194 <uniqueName>contribution_recur_end_date</uniqueName>
195 <uniqueTitle>Recurring Contribution End Date</uniqueTitle>
6a488035 196 </field>
6d68a4cb 197 <field>
6a488035 198 <name>processor_id</name>
23faf53d 199 <uniqueName>contribution_recur_processor_id</uniqueName>
799e1e59 200 <title>Processor ID</title>
6d68a4cb 201 <type>varchar</type>
6a488035 202 <length>255</length>
6d68a4cb
CW
203 <comment>Possibly needed to store a unique identifier for this recurring payment order - if this is available from the processor??</comment>
204 <add>1.6</add>
c6821d8d
MWMC
205 <html>
206 <type>Text</type>
207 </html>
6d68a4cb 208 </field>
011293bb
RT
209 <field>
210 <name>payment_token_id</name>
211 <title>Payment Token ID</title>
212 <type>int unsigned</type>
213 <comment>Optionally used to store a link to a payment token used for this recurring contribution.</comment>
57e94608
A
214 <html>
215 <label>Payment Token</label>
216 </html>
011293bb
RT
217 <add>4.6</add>
218 </field>
219 <foreignKey>
220 <name>payment_token_id</name>
221 <table>civicrm_payment_token</table>
222 <key>id</key>
223 <add>4.6</add>
224 <onDelete>SET NULL</onDelete>
225 </foreignKey>
6d68a4cb
CW
226 <field>
227 <name>trxn_id</name>
23faf53d 228 <uniqueName>contribution_recur_trxn_id</uniqueName>
6a488035 229 <title>Transaction ID</title>
6d68a4cb
CW
230 <type>varchar</type>
231 <length>255</length>
6a488035 232 <comment>unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method</comment>
6d68a4cb 233 <add>1.6</add>
c6821d8d
MWMC
234 <html>
235 <type>Text</type>
236 </html>
6d68a4cb
CW
237 </field>
238 <field>
239 <name>invoice_id</name>
6a488035 240 <title>Invoice ID</title>
6d68a4cb
CW
241 <type>varchar</type>
242 <length>255</length>
6a488035 243 <comment>unique invoice id, system generated or passed in</comment>
6d68a4cb 244 <add>1.6</add>
c6821d8d
MWMC
245 <html>
246 <type>Text</type>
247 </html>
6d68a4cb 248 </field>
6a488035
TO
249 <index>
250 <name>UI_contrib_trxn_id</name>
251 <fieldName>trxn_id</fieldName>
252 <unique>true</unique>
253 <add>2.1</add>
254 </index>
255 <index>
256 <name>UI_contrib_invoice_id</name>
257 <fieldName>invoice_id</fieldName>
258 <unique>true</unique>
259 <add>2.1</add>
260 </index>
261 <field>
262 <name>contribution_status_id</name>
23faf53d 263 <uniqueName>contribution_recur_contribution_status_id</uniqueName>
c6821d8d 264 <title>Status</title>
6a488035 265 <type>int unsigned</type>
d462cb53 266 <default>2</default>
6a488035
TO
267 <import>true</import>
268 <add>1.6</add>
f389e500 269 <pseudoconstant>
0dc36ab0 270 <optionGroupName>contribution_recur_status</optionGroupName>
f389e500 271 </pseudoconstant>
c6821d8d
MWMC
272 <html>
273 <type>Select</type>
274 </html>
6a488035
TO
275 </field>
276 <index>
277 <name>index_contribution_status</name>
278 <fieldName>contribution_status_id</fieldName>
279 <add>1.6</add>
280 </index>
6d68a4cb
CW
281 <field>
282 <name>is_test</name>
6a488035
TO
283 <title>Test</title>
284 <type>boolean</type>
285 <default>0</default>
286 <import>true</import>
e15be85b 287 <html>
288 <type>CheckBox</type>
289 </html>
6a488035
TO
290 </field>
291 <field>
292 <name>cycle_day</name>
c6821d8d 293 <title>Cycle Day</title>
6a488035
TO
294 <type>int unsigned</type>
295 <default>1</default>
296 <required>true</required>
297 <comment>Day in the period when the payment should be charged e.g. 1st of month, 15th etc.</comment>
298 <add>1.6</add>
e15be85b 299 <html>
300 <type>Text</type>
301 </html>
797b807e 302 </field>
303 <field>
304 <name>next_sched_contribution_date</name>
305 <title>Next Scheduled Contribution Date</title>
306 <type>datetime</type>
307 <comment>Next scheduled date</comment>
308 <add>4.4</add>
0c6c47a5 309 <html>
310 <type>Select Date</type>
9139737b 311 <formatType>activityDate</formatType>
0c6c47a5 312 </html>
74db51d3 313 <uniqueName>contribution_recur_next_sched_contribution_date</uniqueName>
314 <uniqueTitle>Next Scheduled Recurring Contribution</uniqueTitle>
6a488035
TO
315 </field>
316 <field>
317 <name>failure_count</name>
797b807e 318 <title>Number of Failures</title>
6a488035
TO
319 <type>int unsigned</type>
320 <default>0</default>
321 <comment>Number of failed charge attempts since last success. Business rule could be set to deactivate on more than x failures.</comment>
322 <add>1.6</add>
e15be85b 323 <html>
324 <type>Text</type>
325 </html>
6a488035
TO
326 </field>
327 <field>
328 <name>failure_retry_date</name>
329 <type>datetime</type>
797b807e 330 <title>Retry Failed Attempt Date</title>
331 <comment>Date to retry failed attempt</comment>
6a488035 332 <add>1.6</add>
0c6c47a5 333 <html>
334 <type>Select Date</type>
9139737b 335 <formatType>activityDate</formatType>
0c6c47a5 336 </html>
74db51d3 337 <uniqueName>contribution_recur_failure_retry_date</uniqueName>
338 <uniqueTitle>Failed Recurring Contribution Retry Date</uniqueTitle>
6a488035 339 </field>
6d68a4cb 340 <field>
6a488035 341 <name>auto_renew</name>
797b807e 342 <title>Auto Renew</title>
6d68a4cb
CW
343 <type>boolean</type>
344 <required>true</required>
6a488035 345 <default>0</default>
6d68a4cb
CW
346 <comment>Some systems allow contributor to set a number of installments - but then auto-renew the subscription or commitment if they do not cancel.</comment>
347 <add>1.6</add>
e15be85b 348 <html>
349 <type>CheckBox</type>
350 </html>
6a488035
TO
351 </field>
352 <field>
353 <name>payment_processor_id</name>
57e94608 354 <title>Payment Processor ID</title>
23faf53d 355 <uniqueName>contribution_recur_payment_processor_id</uniqueName>
6a488035
TO
356 <type>int unsigned</type>
357 <comment>Foreign key to civicrm_payment_processor.id</comment>
358 <add>3.3</add>
5d24a084
MWMC
359 <pseudoconstant>
360 <table>civicrm_payment_processor</table>
361 <keyColumn>id</keyColumn>
362 <labelColumn>name</labelColumn>
363 </pseudoconstant>
c6821d8d
MWMC
364 <html>
365 <type>Select</type>
57e94608 366 <label>Payment Processor</label>
c6821d8d 367 </html>
6a488035 368 </field>
6d68a4cb
CW
369 <foreignKey>
370 <name>payment_processor_id</name>
371 <table>civicrm_payment_processor</table>
372 <key>id</key>
373 <add>3.3</add>
6a488035
TO
374 <onDelete>SET NULL</onDelete>
375 </foreignKey>
376 <field>
6a488035 377 <name>financial_type_id</name>
57e94608 378 <title>Financial Type ID</title>
6a488035
TO
379 <export>false</export>
380 <type>int unsigned</type>
381 <comment>FK to Financial Type</comment>
382 <add>4.3</add>
f389e500
E
383 <pseudoconstant>
384 <table>civicrm_financial_type</table>
385 <keyColumn>id</keyColumn>
386 <labelColumn>name</labelColumn>
387 </pseudoconstant>
c6821d8d
MWMC
388 <html>
389 <type>Select</type>
57e94608 390 <label>Financial Type</label>
c6821d8d 391 </html>
6a488035
TO
392 </field>
393 <foreignKey>
394 <name>financial_type_id</name>
395 <table>civicrm_financial_type</table>
396 <key>id</key>
397 <add>4.3</add>
398 <onDelete>SET NULL</onDelete>
399 </foreignKey>
400 <field>
401 <name>payment_instrument_id</name>
536f0e02 402 <title>Payment Method</title>
6a488035
TO
403 <type>int unsigned</type>
404 <comment>FK to Payment Instrument</comment>
6d68a4cb
CW
405 <pseudoconstant>
406 <optionGroupName>payment_instrument</optionGroupName>
407 </pseudoconstant>
614d72ec 408 <html>
e0991796 409 <type>Select</type>
614d72ec 410 </html>
6a488035
TO
411 <add>4.1</add>
412 </field>
413 <index>
5beb1de0 414 <name>UI_contribution_recur_payment_instrument_id</name>
6a488035
TO
415 <fieldName>payment_instrument_id</fieldName>
416 <add>4.1</add>
417 </index>
418 <field>
419 <name>campaign_id</name>
88c31c05 420 <component>CiviCampaign</component>
6a488035
TO
421 <uniqueName>contribution_campaign_id</uniqueName>
422 <type>int unsigned</type>
57e94608 423 <title>Campaign ID</title>
6a488035
TO
424 <import>true</import>
425 <comment>The campaign for which this contribution has been triggered.</comment>
426 <add>4.1</add>
c6821d8d 427 <html>
8813f972 428 <type>EntityRef</type>
57e94608 429 <label>Campaign</label>
c6821d8d 430 </html>
25ad69f2
CW
431 <pseudoconstant>
432 <table>civicrm_campaign</table>
433 <keyColumn>id</keyColumn>
434 <labelColumn>title</labelColumn>
435 <prefetch>FALSE</prefetch>
436 </pseudoconstant>
6a488035
TO
437 </field>
438 <foreignKey>
439 <name>campaign_id</name>
440 <table>civicrm_campaign</table>
441 <key>id</key>
442 <onDelete>SET NULL</onDelete>
443 </foreignKey>
6d68a4cb
CW
444 <field>
445 <name>is_email_receipt</name>
797b807e 446 <title>Send email Receipt?</title>
6d68a4cb
CW
447 <type>boolean</type>
448 <comment>if true, receipt is automatically emailed to contact on each successful payment</comment>
6a488035 449 <default>1</default>
6d68a4cb 450 <add>4.1</add>
e15be85b 451 <html>
452 <type>CheckBox</type>
453 </html>
6d68a4cb 454 </field>
6a488035 455</table>