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