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