Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
6b83d5bd | 5 | * @copyright CiviCRM LLC (c) 2004-2019 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Contribute/ContributionRecur.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
ac7a239e | 9 | * (GenCodeChecksum:2ccc42487b9e4e5774fcfcde7db9c5ae) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the ContributionRecur entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { |
c3fc2621 | 16 | |
e501603b | 17 | /** |
f41f0342 | 18 | * Static instance to hold the table name. |
e501603b TO |
19 | * |
20 | * @var string | |
21 | */ | |
22 | static $_tableName = 'civicrm_contribution_recur'; | |
c3fc2621 | 23 | |
e501603b | 24 | /** |
f41f0342 | 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 26 | * |
c3fc2621 | 27 | * @var bool |
e501603b | 28 | */ |
c3fc2621 CW |
29 | static $_log = TRUE; |
30 | ||
e501603b TO |
31 | /** |
32 | * Contribution Recur ID | |
33 | * | |
34 | * @var int unsigned | |
35 | */ | |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b | 38 | /** |
c6821d8d | 39 | * Foreign key to civicrm_contact.id. |
e501603b TO |
40 | * |
41 | * @var int unsigned | |
42 | */ | |
43 | public $contact_id; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * Amount to be contributed or charged each recurrence. | |
47 | * | |
48 | * @var float | |
49 | */ | |
50 | public $amount; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * 3 character string, value from config setting or input via user. | |
54 | * | |
55 | * @var string | |
56 | */ | |
57 | public $currency; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * Time units for recurrence of payment. | |
61 | * | |
62 | * @var string | |
63 | */ | |
64 | public $frequency_unit; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * Number of time units for recurrence of payment. | |
68 | * | |
69 | * @var int unsigned | |
70 | */ | |
71 | public $frequency_interval; | |
c3fc2621 | 72 | |
e501603b TO |
73 | /** |
74 | * Total number of payments to be made. Set this to 0 if this is an open-ended commitment i.e. no set end date. | |
75 | * | |
76 | * @var int unsigned | |
77 | */ | |
78 | public $installments; | |
c3fc2621 | 79 | |
e501603b TO |
80 | /** |
81 | * The date the first scheduled recurring contribution occurs. | |
82 | * | |
83 | * @var datetime | |
84 | */ | |
85 | public $start_date; | |
c3fc2621 | 86 | |
e501603b TO |
87 | /** |
88 | * When this recurring contribution record was created. | |
89 | * | |
90 | * @var datetime | |
91 | */ | |
92 | public $create_date; | |
c3fc2621 | 93 | |
e501603b TO |
94 | /** |
95 | * Last updated date for this record. mostly the last time a payment was received | |
96 | * | |
97 | * @var datetime | |
98 | */ | |
99 | public $modified_date; | |
c3fc2621 | 100 | |
e501603b TO |
101 | /** |
102 | * Date this recurring contribution was cancelled by contributor- if we can get access to it | |
103 | * | |
104 | * @var datetime | |
105 | */ | |
106 | public $cancel_date; | |
c3fc2621 | 107 | |
ac7a239e | 108 | /** |
109 | * Free text field for a reason for cancelling | |
110 | * | |
111 | * @var text | |
112 | */ | |
113 | public $cancel_reason; | |
114 | ||
e501603b TO |
115 | /** |
116 | * Date this recurring contribution finished successfully | |
117 | * | |
118 | * @var datetime | |
119 | */ | |
120 | public $end_date; | |
c3fc2621 | 121 | |
e501603b TO |
122 | /** |
123 | * Possibly needed to store a unique identifier for this recurring payment order - if this is available from the processor?? | |
124 | * | |
125 | * @var string | |
126 | */ | |
127 | public $processor_id; | |
c3fc2621 | 128 | |
e501603b TO |
129 | /** |
130 | * Optionally used to store a link to a payment token used for this recurring contribution. | |
131 | * | |
132 | * @var int unsigned | |
133 | */ | |
134 | public $payment_token_id; | |
c3fc2621 | 135 | |
e501603b TO |
136 | /** |
137 | * unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method | |
138 | * | |
139 | * @var string | |
140 | */ | |
141 | public $trxn_id; | |
c3fc2621 | 142 | |
e501603b TO |
143 | /** |
144 | * unique invoice id, system generated or passed in | |
145 | * | |
146 | * @var string | |
147 | */ | |
148 | public $invoice_id; | |
c3fc2621 | 149 | |
e501603b | 150 | /** |
e501603b TO |
151 | * @var int unsigned |
152 | */ | |
153 | public $contribution_status_id; | |
c3fc2621 | 154 | |
e501603b | 155 | /** |
e501603b TO |
156 | * @var boolean |
157 | */ | |
158 | public $is_test; | |
c3fc2621 | 159 | |
e501603b TO |
160 | /** |
161 | * Day in the period when the payment should be charged e.g. 1st of month, 15th etc. | |
162 | * | |
163 | * @var int unsigned | |
164 | */ | |
165 | public $cycle_day; | |
c3fc2621 | 166 | |
e501603b TO |
167 | /** |
168 | * Next scheduled date | |
169 | * | |
170 | * @var datetime | |
171 | */ | |
172 | public $next_sched_contribution_date; | |
c3fc2621 | 173 | |
e501603b TO |
174 | /** |
175 | * Number of failed charge attempts since last success. Business rule could be set to deactivate on more than x failures. | |
176 | * | |
177 | * @var int unsigned | |
178 | */ | |
179 | public $failure_count; | |
c3fc2621 | 180 | |
e501603b TO |
181 | /** |
182 | * Date to retry failed attempt | |
183 | * | |
184 | * @var datetime | |
185 | */ | |
186 | public $failure_retry_date; | |
c3fc2621 | 187 | |
e501603b TO |
188 | /** |
189 | * Some systems allow contributor to set a number of installments - but then auto-renew the subscription or commitment if they do not cancel. | |
190 | * | |
191 | * @var boolean | |
192 | */ | |
193 | public $auto_renew; | |
c3fc2621 | 194 | |
e501603b TO |
195 | /** |
196 | * Foreign key to civicrm_payment_processor.id | |
197 | * | |
198 | * @var int unsigned | |
199 | */ | |
200 | public $payment_processor_id; | |
c3fc2621 | 201 | |
e501603b TO |
202 | /** |
203 | * FK to Financial Type | |
204 | * | |
205 | * @var int unsigned | |
206 | */ | |
207 | public $financial_type_id; | |
c3fc2621 | 208 | |
e501603b TO |
209 | /** |
210 | * FK to Payment Instrument | |
211 | * | |
212 | * @var int unsigned | |
213 | */ | |
214 | public $payment_instrument_id; | |
c3fc2621 | 215 | |
e501603b TO |
216 | /** |
217 | * The campaign for which this contribution has been triggered. | |
218 | * | |
219 | * @var int unsigned | |
220 | */ | |
221 | public $campaign_id; | |
c3fc2621 | 222 | |
e501603b TO |
223 | /** |
224 | * if true, receipt is automatically emailed to contact on each successful payment | |
225 | * | |
226 | * @var boolean | |
227 | */ | |
228 | public $is_email_receipt; | |
c3fc2621 | 229 | |
e501603b | 230 | /** |
f41f0342 | 231 | * Class constructor. |
e501603b | 232 | */ |
c3fc2621 | 233 | public function __construct() { |
e501603b TO |
234 | $this->__table = 'civicrm_contribution_recur'; |
235 | parent::__construct(); | |
236 | } | |
c3fc2621 | 237 | |
e501603b | 238 | /** |
f41f0342 | 239 | * Returns foreign keys and entity references. |
e501603b TO |
240 | * |
241 | * @return array | |
242 | * [CRM_Core_Reference_Interface] | |
243 | */ | |
c3fc2621 | 244 | public static function getReferenceColumns() { |
346aaaba TO |
245 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
246 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
c3fc2621 CW |
247 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); |
248 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'payment_token_id', 'civicrm_payment_token', 'id'); | |
249 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'payment_processor_id', 'civicrm_payment_processor', 'id'); | |
250 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); | |
251 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id'); | |
346aaaba | 252 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 253 | } |
346aaaba | 254 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 255 | } |
c3fc2621 | 256 | |
e501603b TO |
257 | /** |
258 | * Returns all the column names of this table | |
259 | * | |
260 | * @return array | |
261 | */ | |
c3fc2621 | 262 | public static function &fields() { |
346aaaba | 263 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
264 | Civi::$statics[__CLASS__]['fields'] = [ |
265 | 'id' => [ | |
e501603b TO |
266 | 'name' => 'id', |
267 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 268 | 'title' => ts('Recurring Contribution ID'), |
215b423e | 269 | 'description' => ts('Contribution Recur ID'), |
c3fc2621 | 270 | 'required' => TRUE, |
522a26c9 | 271 | 'table_name' => 'civicrm_contribution_recur', |
272 | 'entity' => 'ContributionRecur', | |
273 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 274 | 'localizable' => 0, |
c3fc2621 CW |
275 | ], |
276 | 'contact_id' => [ | |
e501603b TO |
277 | 'name' => 'contact_id', |
278 | 'type' => CRM_Utils_Type::T_INT, | |
c6821d8d MWMC |
279 | 'title' => ts('Contact'), |
280 | 'description' => ts('Foreign key to civicrm_contact.id.'), | |
c3fc2621 | 281 | 'required' => TRUE, |
522a26c9 | 282 | 'table_name' => 'civicrm_contribution_recur', |
283 | 'entity' => 'ContributionRecur', | |
284 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 285 | 'localizable' => 0, |
e501603b | 286 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c6821d8d MWMC |
287 | 'html' => [ |
288 | 'type' => 'EntityRef', | |
289 | ], | |
c3fc2621 CW |
290 | ], |
291 | 'amount' => [ | |
e501603b TO |
292 | 'name' => 'amount', |
293 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 294 | 'title' => ts('Amount'), |
215b423e | 295 | 'description' => ts('Amount to be contributed or charged each recurrence.'), |
c3fc2621 CW |
296 | 'required' => TRUE, |
297 | 'precision' => [ | |
e501603b TO |
298 | 20, |
299 | 2 | |
c3fc2621 | 300 | ], |
522a26c9 | 301 | 'table_name' => 'civicrm_contribution_recur', |
302 | 'entity' => 'ContributionRecur', | |
303 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 304 | 'localizable' => 0, |
c3fc2621 | 305 | 'html' => [ |
e501603b | 306 | 'type' => 'Text', |
c3fc2621 CW |
307 | ], |
308 | ], | |
309 | 'currency' => [ | |
e501603b TO |
310 | 'name' => 'currency', |
311 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 312 | 'title' => ts('Currency'), |
215b423e | 313 | 'description' => ts('3 character string, value from config setting or input via user.'), |
e501603b TO |
314 | 'maxlength' => 3, |
315 | 'size' => CRM_Utils_Type::FOUR, | |
316 | 'default' => 'NULL', | |
522a26c9 | 317 | 'table_name' => 'civicrm_contribution_recur', |
318 | 'entity' => 'ContributionRecur', | |
319 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 320 | 'localizable' => 0, |
c3fc2621 | 321 | 'html' => [ |
e501603b | 322 | 'type' => 'Select', |
c3fc2621 CW |
323 | ], |
324 | 'pseudoconstant' => [ | |
e501603b TO |
325 | 'table' => 'civicrm_currency', |
326 | 'keyColumn' => 'name', | |
327 | 'labelColumn' => 'full_name', | |
328 | 'nameColumn' => 'name', | |
c3fc2621 CW |
329 | ] |
330 | ], | |
331 | 'frequency_unit' => [ | |
e501603b TO |
332 | 'name' => 'frequency_unit', |
333 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 334 | 'title' => ts('Frequency Unit'), |
215b423e | 335 | 'description' => ts('Time units for recurrence of payment.'), |
e501603b TO |
336 | 'maxlength' => 8, |
337 | 'size' => CRM_Utils_Type::EIGHT, | |
338 | 'default' => 'month', | |
522a26c9 | 339 | 'table_name' => 'civicrm_contribution_recur', |
340 | 'entity' => 'ContributionRecur', | |
341 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 342 | 'localizable' => 0, |
c3fc2621 | 343 | 'html' => [ |
e501603b | 344 | 'type' => 'Select', |
c3fc2621 CW |
345 | ], |
346 | 'pseudoconstant' => [ | |
e501603b TO |
347 | 'optionGroupName' => 'recur_frequency_units', |
348 | 'keyColumn' => 'name', | |
349 | 'optionEditPath' => 'civicrm/admin/options/recur_frequency_units', | |
c3fc2621 CW |
350 | ] |
351 | ], | |
352 | 'frequency_interval' => [ | |
e501603b TO |
353 | 'name' => 'frequency_interval', |
354 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 355 | 'title' => ts('Interval (number of units)'), |
215b423e | 356 | 'description' => ts('Number of time units for recurrence of payment.'), |
c3fc2621 | 357 | 'required' => TRUE, |
522a26c9 | 358 | 'table_name' => 'civicrm_contribution_recur', |
359 | 'entity' => 'ContributionRecur', | |
360 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 361 | 'localizable' => 0, |
c3fc2621 | 362 | 'html' => [ |
e501603b | 363 | 'type' => 'Text', |
c3fc2621 CW |
364 | ], |
365 | ], | |
366 | 'installments' => [ | |
e501603b TO |
367 | 'name' => 'installments', |
368 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 369 | 'title' => ts('Number of Installments'), |
215b423e | 370 | 'description' => ts('Total number of payments to be made. Set this to 0 if this is an open-ended commitment i.e. no set end date.'), |
522a26c9 | 371 | 'table_name' => 'civicrm_contribution_recur', |
372 | 'entity' => 'ContributionRecur', | |
373 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 374 | 'localizable' => 0, |
c3fc2621 | 375 | 'html' => [ |
e501603b | 376 | 'type' => 'Text', |
c3fc2621 CW |
377 | ], |
378 | ], | |
379 | 'start_date' => [ | |
e501603b TO |
380 | 'name' => 'start_date', |
381 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c6821d8d | 382 | 'title' => ts('Start Date'), |
215b423e | 383 | 'description' => ts('The date the first scheduled recurring contribution occurs.'), |
c3fc2621 | 384 | 'required' => TRUE, |
522a26c9 | 385 | 'table_name' => 'civicrm_contribution_recur', |
386 | 'entity' => 'ContributionRecur', | |
387 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 388 | 'localizable' => 0, |
c3fc2621 | 389 | 'html' => [ |
e501603b | 390 | 'type' => 'Select Date', |
c6821d8d | 391 | 'formatType' => 'activityDateTime', |
c3fc2621 CW |
392 | ], |
393 | ], | |
394 | 'create_date' => [ | |
e501603b TO |
395 | 'name' => 'create_date', |
396 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c6821d8d | 397 | 'title' => ts('Created Date'), |
215b423e | 398 | 'description' => ts('When this recurring contribution record was created.'), |
c3fc2621 | 399 | 'required' => TRUE, |
522a26c9 | 400 | 'table_name' => 'civicrm_contribution_recur', |
401 | 'entity' => 'ContributionRecur', | |
402 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 403 | 'localizable' => 0, |
c3fc2621 | 404 | 'html' => [ |
e501603b | 405 | 'type' => 'Select Date', |
c6821d8d | 406 | 'formatType' => 'activityDateTime', |
c3fc2621 CW |
407 | ], |
408 | ], | |
409 | 'modified_date' => [ | |
e501603b TO |
410 | 'name' => 'modified_date', |
411 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c6821d8d | 412 | 'title' => ts('Modified Date'), |
215b423e | 413 | 'description' => ts('Last updated date for this record. mostly the last time a payment was received'), |
522a26c9 | 414 | 'table_name' => 'civicrm_contribution_recur', |
415 | 'entity' => 'ContributionRecur', | |
416 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 417 | 'localizable' => 0, |
c3fc2621 | 418 | 'html' => [ |
e501603b | 419 | 'type' => 'Select Date', |
c6821d8d | 420 | 'formatType' => 'activityDateTime', |
c3fc2621 CW |
421 | ], |
422 | ], | |
423 | 'cancel_date' => [ | |
e501603b TO |
424 | 'name' => 'cancel_date', |
425 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c6821d8d | 426 | 'title' => ts('Cancel Date'), |
215b423e | 427 | 'description' => ts('Date this recurring contribution was cancelled by contributor- if we can get access to it'), |
522a26c9 | 428 | 'table_name' => 'civicrm_contribution_recur', |
429 | 'entity' => 'ContributionRecur', | |
430 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 431 | 'localizable' => 0, |
c3fc2621 | 432 | 'html' => [ |
e501603b | 433 | 'type' => 'Select Date', |
9139737b | 434 | 'formatType' => 'activityDate', |
c3fc2621 CW |
435 | ], |
436 | ], | |
ac7a239e | 437 | 'contribution_recur_cancel_reason' => [ |
438 | 'name' => 'cancel_reason', | |
439 | 'type' => CRM_Utils_Type::T_TEXT, | |
440 | 'title' => ts('Cancellation Reason'), | |
441 | 'description' => ts('Free text field for a reason for cancelling'), | |
442 | 'table_name' => 'civicrm_contribution_recur', | |
443 | 'entity' => 'ContributionRecur', | |
444 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
445 | 'localizable' => 0, | |
446 | 'html' => [ | |
447 | 'type' => 'Text', | |
448 | ], | |
449 | ], | |
c3fc2621 | 450 | 'end_date' => [ |
e501603b TO |
451 | 'name' => 'end_date', |
452 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 453 | 'title' => ts('Recurring Contribution End Date'), |
215b423e | 454 | 'description' => ts('Date this recurring contribution finished successfully'), |
522a26c9 | 455 | 'table_name' => 'civicrm_contribution_recur', |
456 | 'entity' => 'ContributionRecur', | |
457 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 458 | 'localizable' => 0, |
c3fc2621 | 459 | 'html' => [ |
e501603b | 460 | 'type' => 'Select Date', |
9139737b | 461 | 'formatType' => 'activityDate', |
c3fc2621 CW |
462 | ], |
463 | ], | |
464 | 'processor_id' => [ | |
e501603b TO |
465 | 'name' => 'processor_id', |
466 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 467 | 'title' => ts('Processor ID'), |
215b423e | 468 | 'description' => ts('Possibly needed to store a unique identifier for this recurring payment order - if this is available from the processor??'), |
e501603b TO |
469 | 'maxlength' => 255, |
470 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 471 | 'table_name' => 'civicrm_contribution_recur', |
472 | 'entity' => 'ContributionRecur', | |
473 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 474 | 'localizable' => 0, |
c6821d8d MWMC |
475 | 'html' => [ |
476 | 'type' => 'Text', | |
477 | ], | |
c3fc2621 CW |
478 | ], |
479 | 'payment_token_id' => [ | |
e501603b TO |
480 | 'name' => 'payment_token_id', |
481 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 482 | 'title' => ts('Payment Token ID'), |
215b423e | 483 | 'description' => ts('Optionally used to store a link to a payment token used for this recurring contribution.'), |
522a26c9 | 484 | 'table_name' => 'civicrm_contribution_recur', |
485 | 'entity' => 'ContributionRecur', | |
486 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 487 | 'localizable' => 0, |
e501603b | 488 | 'FKClassName' => 'CRM_Financial_DAO_PaymentToken', |
c3fc2621 CW |
489 | ], |
490 | 'trxn_id' => [ | |
e501603b TO |
491 | 'name' => 'trxn_id', |
492 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 493 | 'title' => ts('Transaction ID'), |
215b423e | 494 | 'description' => ts('unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method'), |
e501603b TO |
495 | 'maxlength' => 255, |
496 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 497 | 'table_name' => 'civicrm_contribution_recur', |
498 | 'entity' => 'ContributionRecur', | |
499 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 500 | 'localizable' => 0, |
c6821d8d MWMC |
501 | 'html' => [ |
502 | 'type' => 'Text', | |
503 | ], | |
c3fc2621 CW |
504 | ], |
505 | 'invoice_id' => [ | |
e501603b TO |
506 | 'name' => 'invoice_id', |
507 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 508 | 'title' => ts('Invoice ID'), |
215b423e | 509 | 'description' => ts('unique invoice id, system generated or passed in'), |
e501603b TO |
510 | 'maxlength' => 255, |
511 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 512 | 'table_name' => 'civicrm_contribution_recur', |
513 | 'entity' => 'ContributionRecur', | |
514 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 515 | 'localizable' => 0, |
c6821d8d MWMC |
516 | 'html' => [ |
517 | 'type' => 'Text', | |
518 | ], | |
c3fc2621 CW |
519 | ], |
520 | 'contribution_status_id' => [ | |
e501603b TO |
521 | 'name' => 'contribution_status_id', |
522 | 'type' => CRM_Utils_Type::T_INT, | |
c6821d8d | 523 | 'title' => ts('Status'), |
c3fc2621 | 524 | 'import' => TRUE, |
e501603b TO |
525 | 'where' => 'civicrm_contribution_recur.contribution_status_id', |
526 | 'headerPattern' => '', | |
527 | 'dataPattern' => '', | |
c3fc2621 | 528 | 'export' => TRUE, |
e501603b | 529 | 'default' => '1', |
522a26c9 | 530 | 'table_name' => 'civicrm_contribution_recur', |
531 | 'entity' => 'ContributionRecur', | |
532 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 533 | 'localizable' => 0, |
c6821d8d MWMC |
534 | 'html' => [ |
535 | 'type' => 'Select', | |
536 | ], | |
c3fc2621 | 537 | 'pseudoconstant' => [ |
e501603b TO |
538 | 'optionGroupName' => 'contribution_status', |
539 | 'optionEditPath' => 'civicrm/admin/options/contribution_status', | |
c3fc2621 CW |
540 | ] |
541 | ], | |
542 | 'is_test' => [ | |
e501603b TO |
543 | 'name' => 'is_test', |
544 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 CW |
545 | 'title' => ts('Test'), |
546 | 'import' => TRUE, | |
e501603b TO |
547 | 'where' => 'civicrm_contribution_recur.is_test', |
548 | 'headerPattern' => '', | |
549 | 'dataPattern' => '', | |
c3fc2621 | 550 | 'export' => TRUE, |
45a83e42 | 551 | 'default' => '0', |
522a26c9 | 552 | 'table_name' => 'civicrm_contribution_recur', |
553 | 'entity' => 'ContributionRecur', | |
554 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 555 | 'localizable' => 0, |
c3fc2621 | 556 | 'html' => [ |
437fafcf | 557 | 'type' => 'CheckBox', |
c3fc2621 CW |
558 | ], |
559 | ], | |
560 | 'cycle_day' => [ | |
e501603b TO |
561 | 'name' => 'cycle_day', |
562 | 'type' => CRM_Utils_Type::T_INT, | |
c6821d8d | 563 | 'title' => ts('Cycle Day'), |
215b423e | 564 | 'description' => ts('Day in the period when the payment should be charged e.g. 1st of month, 15th etc.'), |
c3fc2621 | 565 | 'required' => TRUE, |
e501603b | 566 | 'default' => '1', |
522a26c9 | 567 | 'table_name' => 'civicrm_contribution_recur', |
568 | 'entity' => 'ContributionRecur', | |
569 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 570 | 'localizable' => 0, |
c3fc2621 | 571 | 'html' => [ |
437fafcf | 572 | 'type' => 'Text', |
c3fc2621 CW |
573 | ], |
574 | ], | |
575 | 'next_sched_contribution_date' => [ | |
e501603b TO |
576 | 'name' => 'next_sched_contribution_date', |
577 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 578 | 'title' => ts('Next Scheduled Contribution Date'), |
215b423e | 579 | 'description' => ts('Next scheduled date'), |
522a26c9 | 580 | 'table_name' => 'civicrm_contribution_recur', |
581 | 'entity' => 'ContributionRecur', | |
582 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 583 | 'localizable' => 0, |
c3fc2621 | 584 | 'html' => [ |
e501603b | 585 | 'type' => 'Select Date', |
9139737b | 586 | 'formatType' => 'activityDate', |
c3fc2621 CW |
587 | ], |
588 | ], | |
589 | 'failure_count' => [ | |
e501603b TO |
590 | 'name' => 'failure_count', |
591 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 592 | 'title' => ts('Number of Failures'), |
215b423e | 593 | 'description' => ts('Number of failed charge attempts since last success. Business rule could be set to deactivate on more than x failures.'), |
45a83e42 | 594 | 'default' => '0', |
522a26c9 | 595 | 'table_name' => 'civicrm_contribution_recur', |
596 | 'entity' => 'ContributionRecur', | |
597 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 598 | 'localizable' => 0, |
c3fc2621 | 599 | 'html' => [ |
437fafcf | 600 | 'type' => 'Text', |
c3fc2621 CW |
601 | ], |
602 | ], | |
603 | 'failure_retry_date' => [ | |
e501603b TO |
604 | 'name' => 'failure_retry_date', |
605 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 606 | 'title' => ts('Retry Failed Attempt Date'), |
215b423e | 607 | 'description' => ts('Date to retry failed attempt'), |
522a26c9 | 608 | 'table_name' => 'civicrm_contribution_recur', |
609 | 'entity' => 'ContributionRecur', | |
610 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 611 | 'localizable' => 0, |
c3fc2621 | 612 | 'html' => [ |
e501603b | 613 | 'type' => 'Select Date', |
9139737b | 614 | 'formatType' => 'activityDate', |
c3fc2621 CW |
615 | ], |
616 | ], | |
617 | 'auto_renew' => [ | |
e501603b TO |
618 | 'name' => 'auto_renew', |
619 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 620 | 'title' => ts('Auto Renew'), |
215b423e | 621 | 'description' => ts('Some systems allow contributor to set a number of installments - but then auto-renew the subscription or commitment if they do not cancel.'), |
c3fc2621 | 622 | 'required' => TRUE, |
45a83e42 | 623 | 'default' => '0', |
522a26c9 | 624 | 'table_name' => 'civicrm_contribution_recur', |
625 | 'entity' => 'ContributionRecur', | |
626 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 627 | 'localizable' => 0, |
c3fc2621 | 628 | 'html' => [ |
437fafcf | 629 | 'type' => 'CheckBox', |
c3fc2621 CW |
630 | ], |
631 | ], | |
632 | 'payment_processor_id' => [ | |
e501603b TO |
633 | 'name' => 'payment_processor_id', |
634 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 635 | 'title' => ts('Payment Processor'), |
215b423e | 636 | 'description' => ts('Foreign key to civicrm_payment_processor.id'), |
522a26c9 | 637 | 'table_name' => 'civicrm_contribution_recur', |
638 | 'entity' => 'ContributionRecur', | |
639 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 640 | 'localizable' => 0, |
e501603b | 641 | 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor', |
c6821d8d MWMC |
642 | 'html' => [ |
643 | 'type' => 'Select', | |
644 | ], | |
5d24a084 MWMC |
645 | 'pseudoconstant' => [ |
646 | 'table' => 'civicrm_payment_processor', | |
647 | 'keyColumn' => 'id', | |
648 | 'labelColumn' => 'name', | |
649 | ] | |
c3fc2621 CW |
650 | ], |
651 | 'financial_type_id' => [ | |
e501603b TO |
652 | 'name' => 'financial_type_id', |
653 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 654 | 'title' => ts('Financial Type'), |
215b423e | 655 | 'description' => ts('FK to Financial Type'), |
c3fc2621 | 656 | 'export' => FALSE, |
e501603b TO |
657 | 'where' => 'civicrm_contribution_recur.financial_type_id', |
658 | 'headerPattern' => '', | |
659 | 'dataPattern' => '', | |
522a26c9 | 660 | 'table_name' => 'civicrm_contribution_recur', |
661 | 'entity' => 'ContributionRecur', | |
662 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 663 | 'localizable' => 0, |
e501603b | 664 | 'FKClassName' => 'CRM_Financial_DAO_FinancialType', |
c6821d8d MWMC |
665 | 'html' => [ |
666 | 'type' => 'Select', | |
667 | ], | |
c3fc2621 | 668 | 'pseudoconstant' => [ |
e501603b TO |
669 | 'table' => 'civicrm_financial_type', |
670 | 'keyColumn' => 'id', | |
671 | 'labelColumn' => 'name', | |
c3fc2621 CW |
672 | ] |
673 | ], | |
674 | 'payment_instrument_id' => [ | |
e501603b TO |
675 | 'name' => 'payment_instrument_id', |
676 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 677 | 'title' => ts('Payment Method'), |
215b423e | 678 | 'description' => ts('FK to Payment Instrument'), |
522a26c9 | 679 | 'table_name' => 'civicrm_contribution_recur', |
680 | 'entity' => 'ContributionRecur', | |
681 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 682 | 'localizable' => 0, |
c3fc2621 | 683 | 'html' => [ |
e501603b | 684 | 'type' => 'Select', |
c3fc2621 CW |
685 | ], |
686 | 'pseudoconstant' => [ | |
e501603b TO |
687 | 'optionGroupName' => 'payment_instrument', |
688 | 'optionEditPath' => 'civicrm/admin/options/payment_instrument', | |
c3fc2621 CW |
689 | ] |
690 | ], | |
691 | 'contribution_campaign_id' => [ | |
e501603b TO |
692 | 'name' => 'campaign_id', |
693 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 694 | 'title' => ts('Campaign'), |
215b423e | 695 | 'description' => ts('The campaign for which this contribution has been triggered.'), |
c3fc2621 | 696 | 'import' => TRUE, |
e501603b TO |
697 | 'where' => 'civicrm_contribution_recur.campaign_id', |
698 | 'headerPattern' => '', | |
699 | 'dataPattern' => '', | |
c3fc2621 | 700 | 'export' => TRUE, |
522a26c9 | 701 | 'table_name' => 'civicrm_contribution_recur', |
702 | 'entity' => 'ContributionRecur', | |
703 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 704 | 'localizable' => 0, |
e501603b | 705 | 'FKClassName' => 'CRM_Campaign_DAO_Campaign', |
c6821d8d MWMC |
706 | 'html' => [ |
707 | 'type' => 'Select', | |
708 | ], | |
c3fc2621 | 709 | 'pseudoconstant' => [ |
e501603b TO |
710 | 'table' => 'civicrm_campaign', |
711 | 'keyColumn' => 'id', | |
712 | 'labelColumn' => 'title', | |
c3fc2621 CW |
713 | ] |
714 | ], | |
715 | 'is_email_receipt' => [ | |
e501603b TO |
716 | 'name' => 'is_email_receipt', |
717 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 718 | 'title' => ts('Send email Receipt?'), |
215b423e | 719 | 'description' => ts('if true, receipt is automatically emailed to contact on each successful payment'), |
e501603b | 720 | 'default' => '1', |
522a26c9 | 721 | 'table_name' => 'civicrm_contribution_recur', |
722 | 'entity' => 'ContributionRecur', | |
723 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 724 | 'localizable' => 0, |
c3fc2621 | 725 | 'html' => [ |
437fafcf | 726 | 'type' => 'CheckBox', |
c3fc2621 CW |
727 | ], |
728 | ], | |
729 | ]; | |
346aaaba | 730 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 731 | } |
346aaaba | 732 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 733 | } |
c3fc2621 | 734 | |
e501603b | 735 | /** |
bd8e0b14 | 736 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
737 | * |
738 | * @return array | |
bd8e0b14 | 739 | * Array(string $name => string $uniqueName). |
e501603b | 740 | */ |
c3fc2621 | 741 | public static function &fieldKeys() { |
bd8e0b14 TO |
742 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
743 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 744 | } |
bd8e0b14 | 745 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 746 | } |
c3fc2621 | 747 | |
e501603b TO |
748 | /** |
749 | * Returns the names of this table | |
750 | * | |
751 | * @return string | |
752 | */ | |
c3fc2621 | 753 | public static function getTableName() { |
e501603b TO |
754 | return self::$_tableName; |
755 | } | |
c3fc2621 | 756 | |
e501603b TO |
757 | /** |
758 | * Returns if this table needs to be logged | |
759 | * | |
c3fc2621 | 760 | * @return bool |
e501603b | 761 | */ |
c3fc2621 | 762 | public function getLog() { |
e501603b TO |
763 | return self::$_log; |
764 | } | |
c3fc2621 | 765 | |
e501603b TO |
766 | /** |
767 | * Returns the list of fields that can be imported | |
768 | * | |
769 | * @param bool $prefix | |
770 | * | |
771 | * @return array | |
772 | */ | |
c3fc2621 CW |
773 | public static function &import($prefix = FALSE) { |
774 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_recur', $prefix, []); | |
60808919 | 775 | return $r; |
e501603b | 776 | } |
c3fc2621 | 777 | |
e501603b TO |
778 | /** |
779 | * Returns the list of fields that can be exported | |
780 | * | |
781 | * @param bool $prefix | |
782 | * | |
783 | * @return array | |
784 | */ | |
c3fc2621 CW |
785 | public static function &export($prefix = FALSE) { |
786 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_recur', $prefix, []); | |
60808919 | 787 | return $r; |
e501603b | 788 | } |
c3fc2621 | 789 | |
e7a6b91a AS |
790 | /** |
791 | * Returns the list of indices | |
c3fc2621 CW |
792 | * |
793 | * @param bool $localize | |
794 | * | |
795 | * @return array | |
e7a6b91a AS |
796 | */ |
797 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
798 | $indices = [ |
799 | 'UI_contrib_trxn_id' => [ | |
e7a6b91a | 800 | 'name' => 'UI_contrib_trxn_id', |
c3fc2621 | 801 | 'field' => [ |
e7a6b91a | 802 | 0 => 'trxn_id', |
c3fc2621 CW |
803 | ], |
804 | 'localizable' => FALSE, | |
805 | 'unique' => TRUE, | |
e7a6b91a | 806 | 'sig' => 'civicrm_contribution_recur::1::trxn_id', |
c3fc2621 CW |
807 | ], |
808 | 'UI_contrib_invoice_id' => [ | |
e7a6b91a | 809 | 'name' => 'UI_contrib_invoice_id', |
c3fc2621 | 810 | 'field' => [ |
e7a6b91a | 811 | 0 => 'invoice_id', |
c3fc2621 CW |
812 | ], |
813 | 'localizable' => FALSE, | |
814 | 'unique' => TRUE, | |
e7a6b91a | 815 | 'sig' => 'civicrm_contribution_recur::1::invoice_id', |
c3fc2621 CW |
816 | ], |
817 | 'index_contribution_status' => [ | |
e7a6b91a | 818 | 'name' => 'index_contribution_status', |
c3fc2621 | 819 | 'field' => [ |
e7a6b91a | 820 | 0 => 'contribution_status_id', |
c3fc2621 CW |
821 | ], |
822 | 'localizable' => FALSE, | |
e7a6b91a | 823 | 'sig' => 'civicrm_contribution_recur::0::contribution_status_id', |
c3fc2621 CW |
824 | ], |
825 | 'UI_contribution_recur_payment_instrument_id' => [ | |
e7a6b91a | 826 | 'name' => 'UI_contribution_recur_payment_instrument_id', |
c3fc2621 | 827 | 'field' => [ |
e7a6b91a | 828 | 0 => 'payment_instrument_id', |
c3fc2621 CW |
829 | ], |
830 | 'localizable' => FALSE, | |
e7a6b91a | 831 | 'sig' => 'civicrm_contribution_recur::0::payment_instrument_id', |
c3fc2621 CW |
832 | ], |
833 | ]; | |
e7a6b91a AS |
834 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
835 | } | |
c3fc2621 | 836 | |
e501603b | 837 | } |