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