3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
29 * @copyright CiviCRM LLC (c) 2004-2017
31 * Generated from xml/schema/CRM/Contribute/ContributionRecur.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:5318b7daa057426c1bb8cdec6ed1e4b3)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
38 * CRM_Contribute_DAO_ContributionRecur constructor.
40 class CRM_Contribute_DAO_ContributionRecur
extends CRM_Core_DAO
{
42 * Static instance to hold the table name.
46 static $_tableName = 'civicrm_contribution_recur';
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
54 * Contribution Recur ID
60 * Foreign key to civicrm_contact.id .
66 * Amount to be contributed or charged each recurrence.
72 * 3 character string, value from config setting or input via user.
78 * Time units for recurrence of payment.
82 public $frequency_unit;
84 * Number of time units for recurrence of payment.
88 public $frequency_interval;
90 * Total number of payments to be made. Set this to 0 if this is an open-ended commitment i.e. no set end date.
96 * The date the first scheduled recurring contribution occurs.
102 * When this recurring contribution record was created.
108 * Last updated date for this record. mostly the last time a payment was received
112 public $modified_date;
114 * Date this recurring contribution was cancelled by contributor- if we can get access to it
120 * Date this recurring contribution finished successfully
126 * Possibly needed to store a unique identifier for this recurring payment order - if this is available from the processor??
130 public $processor_id;
132 * Optionally used to store a link to a payment token used for this recurring contribution.
136 public $payment_token_id;
138 * unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method
144 * unique invoice id, system generated or passed in
153 public $contribution_status_id;
160 * Day in the period when the payment should be charged e.g. 1st of month, 15th etc.
166 * Next scheduled date
170 public $next_sched_contribution_date;
172 * Number of failed charge attempts since last success. Business rule could be set to deactivate on more than x failures.
176 public $failure_count;
178 * Date to retry failed attempt
182 public $failure_retry_date;
184 * Some systems allow contributor to set a number of installments - but then auto-renew the subscription or commitment if they do not cancel.
190 * Foreign key to civicrm_payment_processor.id
194 public $payment_processor_id;
196 * FK to Financial Type
200 public $financial_type_id;
202 * FK to Payment Instrument
206 public $payment_instrument_id;
208 * The campaign for which this contribution has been triggered.
214 * if true, receipt is automatically emailed to contact on each successful payment
218 public $is_email_receipt;
222 function __construct() {
223 $this->__table
= 'civicrm_contribution_recur';
224 parent
::__construct();
227 * Returns foreign keys and entity references.
230 * [CRM_Core_Reference_Interface]
232 static function getReferenceColumns() {
233 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
234 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
235 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contact_id', 'civicrm_contact', 'id');
236 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'payment_token_id', 'civicrm_payment_token', 'id');
237 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'payment_processor_id', 'civicrm_payment_processor', 'id');
238 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id');
239 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'campaign_id', 'civicrm_campaign', 'id');
240 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
242 return Civi
::$statics[__CLASS__
]['links'];
245 * Returns all the column names of this table
249 static function &fields() {
250 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
251 Civi
::$statics[__CLASS__
]['fields'] = array(
254 'type' => CRM_Utils_Type
::T_INT
,
255 'title' => ts('Recurring Contribution ID') ,
256 'description' => 'Contribution Recur ID',
258 'table_name' => 'civicrm_contribution_recur',
259 'entity' => 'ContributionRecur',
260 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
263 'contact_id' => array(
264 'name' => 'contact_id',
265 'type' => CRM_Utils_Type
::T_INT
,
266 'title' => ts('Contact ID') ,
267 'description' => 'Foreign key to civicrm_contact.id .',
269 'table_name' => 'civicrm_contribution_recur',
270 'entity' => 'ContributionRecur',
271 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
273 'FKClassName' => 'CRM_Contact_DAO_Contact',
277 'type' => CRM_Utils_Type
::T_MONEY
,
278 'title' => ts('Amount') ,
279 'description' => 'Amount to be contributed or charged each recurrence.',
281 'precision' => array(
285 'table_name' => 'civicrm_contribution_recur',
286 'entity' => 'ContributionRecur',
287 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
294 'name' => 'currency',
295 'type' => CRM_Utils_Type
::T_STRING
,
296 'title' => ts('Currency') ,
297 'description' => '3 character string, value from config setting or input via user.',
299 'size' => CRM_Utils_Type
::FOUR
,
301 'table_name' => 'civicrm_contribution_recur',
302 'entity' => 'ContributionRecur',
303 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
308 'pseudoconstant' => array(
309 'table' => 'civicrm_currency',
310 'keyColumn' => 'name',
311 'labelColumn' => 'full_name',
312 'nameColumn' => 'name',
315 'frequency_unit' => array(
316 'name' => 'frequency_unit',
317 'type' => CRM_Utils_Type
::T_STRING
,
318 'title' => ts('Frequency Unit') ,
319 'description' => 'Time units for recurrence of payment.',
321 'size' => CRM_Utils_Type
::EIGHT
,
322 'default' => 'month',
323 'table_name' => 'civicrm_contribution_recur',
324 'entity' => 'ContributionRecur',
325 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
330 'pseudoconstant' => array(
331 'optionGroupName' => 'recur_frequency_units',
332 'keyColumn' => 'name',
333 'optionEditPath' => 'civicrm/admin/options/recur_frequency_units',
336 'frequency_interval' => array(
337 'name' => 'frequency_interval',
338 'type' => CRM_Utils_Type
::T_INT
,
339 'title' => ts('Interval (number of units)') ,
340 'description' => 'Number of time units for recurrence of payment.',
342 'table_name' => 'civicrm_contribution_recur',
343 'entity' => 'ContributionRecur',
344 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
350 'installments' => array(
351 'name' => 'installments',
352 'type' => CRM_Utils_Type
::T_INT
,
353 'title' => ts('Number of Installments') ,
354 'description' => 'Total number of payments to be made. Set this to 0 if this is an open-ended commitment i.e. no set end date.',
355 'table_name' => 'civicrm_contribution_recur',
356 'entity' => 'ContributionRecur',
357 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
363 'start_date' => array(
364 'name' => 'start_date',
365 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
366 'title' => ts('Recurring Contribution Started Date') ,
367 'description' => 'The date the first scheduled recurring contribution occurs.',
369 'table_name' => 'civicrm_contribution_recur',
370 'entity' => 'ContributionRecur',
371 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
374 'type' => 'Select Date',
377 'create_date' => array(
378 'name' => 'create_date',
379 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
380 'title' => ts('Recurring Contribution Created Date') ,
381 'description' => 'When this recurring contribution record was created.',
383 'table_name' => 'civicrm_contribution_recur',
384 'entity' => 'ContributionRecur',
385 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
388 'type' => 'Select Date',
391 'modified_date' => array(
392 'name' => 'modified_date',
393 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
394 'title' => ts('Recurring Contribution Modified Date') ,
395 'description' => 'Last updated date for this record. mostly the last time a payment was received',
396 'table_name' => 'civicrm_contribution_recur',
397 'entity' => 'ContributionRecur',
398 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
401 'type' => 'Select Date',
404 'cancel_date' => array(
405 'name' => 'cancel_date',
406 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
407 'title' => ts('Recurring Contribution Cancel Date') ,
408 'description' => 'Date this recurring contribution was cancelled by contributor- if we can get access to it',
409 'table_name' => 'civicrm_contribution_recur',
410 'entity' => 'ContributionRecur',
411 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
414 'type' => 'Select Date',
418 'name' => 'end_date',
419 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
420 'title' => ts('Recurring Contribution End Date') ,
421 'description' => 'Date this recurring contribution finished successfully',
422 'table_name' => 'civicrm_contribution_recur',
423 'entity' => 'ContributionRecur',
424 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
427 'type' => 'Select Date',
430 'processor_id' => array(
431 'name' => 'processor_id',
432 'type' => CRM_Utils_Type
::T_STRING
,
433 'title' => ts('Processor ID') ,
434 'description' => 'Possibly needed to store a unique identifier for this recurring payment order - if this is available from the processor??',
436 'size' => CRM_Utils_Type
::HUGE
,
437 'table_name' => 'civicrm_contribution_recur',
438 'entity' => 'ContributionRecur',
439 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
442 'payment_token_id' => array(
443 'name' => 'payment_token_id',
444 'type' => CRM_Utils_Type
::T_INT
,
445 'title' => ts('Payment Token ID') ,
446 'description' => 'Optionally used to store a link to a payment token used for this recurring contribution.',
447 'table_name' => 'civicrm_contribution_recur',
448 'entity' => 'ContributionRecur',
449 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
451 'FKClassName' => 'CRM_Financial_DAO_PaymentToken',
455 'type' => CRM_Utils_Type
::T_STRING
,
456 'title' => ts('Transaction ID') ,
457 'description' => 'unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method',
459 'size' => CRM_Utils_Type
::HUGE
,
460 'table_name' => 'civicrm_contribution_recur',
461 'entity' => 'ContributionRecur',
462 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
465 'invoice_id' => array(
466 'name' => 'invoice_id',
467 'type' => CRM_Utils_Type
::T_STRING
,
468 'title' => ts('Invoice ID') ,
469 'description' => 'unique invoice id, system generated or passed in',
471 'size' => CRM_Utils_Type
::HUGE
,
472 'table_name' => 'civicrm_contribution_recur',
473 'entity' => 'ContributionRecur',
474 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
477 'contribution_status_id' => array(
478 'name' => 'contribution_status_id',
479 'type' => CRM_Utils_Type
::T_INT
,
480 'title' => ts('Recurring Contribution Status') ,
482 'where' => 'civicrm_contribution_recur.contribution_status_id',
483 'headerPattern' => '',
487 'table_name' => 'civicrm_contribution_recur',
488 'entity' => 'ContributionRecur',
489 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
491 'pseudoconstant' => array(
492 'optionGroupName' => 'contribution_status',
493 'optionEditPath' => 'civicrm/admin/options/contribution_status',
498 'type' => CRM_Utils_Type
::T_BOOLEAN
,
499 'title' => ts('Test') ,
501 'where' => 'civicrm_contribution_recur.is_test',
502 'headerPattern' => '',
505 'table_name' => 'civicrm_contribution_recur',
506 'entity' => 'ContributionRecur',
507 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
510 'type' => 'CheckBox',
513 'cycle_day' => array(
514 'name' => 'cycle_day',
515 'type' => CRM_Utils_Type
::T_INT
,
516 'title' => ts('Number of Cycle Day') ,
517 'description' => 'Day in the period when the payment should be charged e.g. 1st of month, 15th etc.',
520 'table_name' => 'civicrm_contribution_recur',
521 'entity' => 'ContributionRecur',
522 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
528 'next_sched_contribution_date' => array(
529 'name' => 'next_sched_contribution_date',
530 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
531 'title' => ts('Next Scheduled Contribution Date') ,
532 'description' => 'Next scheduled date',
533 'table_name' => 'civicrm_contribution_recur',
534 'entity' => 'ContributionRecur',
535 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
538 'type' => 'Select Date',
541 'failure_count' => array(
542 'name' => 'failure_count',
543 'type' => CRM_Utils_Type
::T_INT
,
544 'title' => ts('Number of Failures') ,
545 'description' => 'Number of failed charge attempts since last success. Business rule could be set to deactivate on more than x failures.',
546 'table_name' => 'civicrm_contribution_recur',
547 'entity' => 'ContributionRecur',
548 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
554 'failure_retry_date' => array(
555 'name' => 'failure_retry_date',
556 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
557 'title' => ts('Retry Failed Attempt Date') ,
558 'description' => 'Date to retry failed attempt',
559 'table_name' => 'civicrm_contribution_recur',
560 'entity' => 'ContributionRecur',
561 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
564 'type' => 'Select Date',
567 'auto_renew' => array(
568 'name' => 'auto_renew',
569 'type' => CRM_Utils_Type
::T_BOOLEAN
,
570 'title' => ts('Auto Renew') ,
571 'description' => 'Some systems allow contributor to set a number of installments - but then auto-renew the subscription or commitment if they do not cancel.',
573 'table_name' => 'civicrm_contribution_recur',
574 'entity' => 'ContributionRecur',
575 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
578 'type' => 'CheckBox',
581 'payment_processor_id' => array(
582 'name' => 'payment_processor_id',
583 'type' => CRM_Utils_Type
::T_INT
,
584 'title' => ts('Payment Processor') ,
585 'description' => 'Foreign key to civicrm_payment_processor.id',
586 'table_name' => 'civicrm_contribution_recur',
587 'entity' => 'ContributionRecur',
588 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
590 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
592 'financial_type_id' => array(
593 'name' => 'financial_type_id',
594 'type' => CRM_Utils_Type
::T_INT
,
595 'title' => ts('Financial Type') ,
596 'description' => 'FK to Financial Type',
598 'where' => 'civicrm_contribution_recur.financial_type_id',
599 'headerPattern' => '',
601 'table_name' => 'civicrm_contribution_recur',
602 'entity' => 'ContributionRecur',
603 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
605 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
606 'pseudoconstant' => array(
607 'table' => 'civicrm_financial_type',
609 'labelColumn' => 'name',
612 'payment_instrument_id' => array(
613 'name' => 'payment_instrument_id',
614 'type' => CRM_Utils_Type
::T_INT
,
615 'title' => ts('Payment Method') ,
616 'description' => 'FK to Payment Instrument',
617 'table_name' => 'civicrm_contribution_recur',
618 'entity' => 'ContributionRecur',
619 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
624 'pseudoconstant' => array(
625 'optionGroupName' => 'payment_instrument',
626 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
629 'contribution_campaign_id' => array(
630 'name' => 'campaign_id',
631 'type' => CRM_Utils_Type
::T_INT
,
632 'title' => ts('Campaign') ,
633 'description' => 'The campaign for which this contribution has been triggered.',
635 'where' => 'civicrm_contribution_recur.campaign_id',
636 'headerPattern' => '',
639 'table_name' => 'civicrm_contribution_recur',
640 'entity' => 'ContributionRecur',
641 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
643 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
644 'pseudoconstant' => array(
645 'table' => 'civicrm_campaign',
647 'labelColumn' => 'title',
650 'is_email_receipt' => array(
651 'name' => 'is_email_receipt',
652 'type' => CRM_Utils_Type
::T_BOOLEAN
,
653 'title' => ts('Send email Receipt?') ,
654 'description' => 'if true, receipt is automatically emailed to contact on each successful payment',
656 'table_name' => 'civicrm_contribution_recur',
657 'entity' => 'ContributionRecur',
658 'bao' => 'CRM_Contribute_BAO_ContributionRecur',
661 'type' => 'CheckBox',
665 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
667 return Civi
::$statics[__CLASS__
]['fields'];
670 * Return a mapping from field-name to the corresponding key (as used in fields()).
673 * Array(string $name => string $uniqueName).
675 static function &fieldKeys() {
676 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
677 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
679 return Civi
::$statics[__CLASS__
]['fieldKeys'];
682 * Returns the names of this table
686 static function getTableName() {
687 return self
::$_tableName;
690 * Returns if this table needs to be logged
698 * Returns the list of fields that can be imported
700 * @param bool $prefix
704 static function &import($prefix = false) {
705 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contribution_recur', $prefix, array());
709 * Returns the list of fields that can be exported
711 * @param bool $prefix
715 static function &export($prefix = false) {
716 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contribution_recur', $prefix, array());