3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
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-2016
31 * Generated from xml/schema/CRM/Contribute/ContributionRecur.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:0d69452bb0935f1146d7f5fdaff295bc)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Contribute_DAO_ContributionRecur
extends CRM_Core_DAO
{
39 * static instance to hold the table name
43 static $_tableName = 'civicrm_contribution_recur';
45 * static instance to hold the field values
49 static $_fields = null;
51 * static instance to hold the keys used in $_fields for each field.
55 static $_fieldKeys = null;
57 * static instance to hold the FK relationships
61 static $_links = null;
63 * static value to see if we should log any modifications to
64 * this table in the civicrm_log table
70 * Contribution Recur ID
76 * Foreign key to civicrm_contact.id .
82 * Amount to be contributed or charged each recurrence.
88 * 3 character string, value from config setting or input via user.
94 * Time units for recurrence of payment.
98 public $frequency_unit;
100 * Number of time units for recurrence of payment.
104 public $frequency_interval;
106 * Total number of payments to be made. Set this to 0 if this is an open-ended commitment i.e. no set end date.
110 public $installments;
112 * The date the first scheduled recurring contribution occurs.
118 * When this recurring contribution record was created.
124 * Last updated date for this record. mostly the last time a payment was received
128 public $modified_date;
130 * Date this recurring contribution was cancelled by contributor- if we can get access to it
136 * Date this recurring contribution finished successfully
142 * Possibly needed to store a unique identifier for this recurring payment order - if this is available from the processor??
146 public $processor_id;
148 * Optionally used to store a link to a payment token used for this recurring contribution.
152 public $payment_token_id;
154 * unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method
160 * unique invoice id, system generated or passed in
169 public $contribution_status_id;
176 * Day in the period when the payment should be charged e.g. 1st of month, 15th etc.
182 * Next scheduled date
186 public $next_sched_contribution_date;
188 * Number of failed charge attempts since last success. Business rule could be set to deactivate on more than x failures.
192 public $failure_count;
194 * Date to retry failed attempt
198 public $failure_retry_date;
200 * Some systems allow contributor to set a number of installments - but then auto-renew the subscription or commitment if they do not cancel.
206 * Foreign key to civicrm_payment_processor.id
210 public $payment_processor_id;
212 * FK to Financial Type
216 public $financial_type_id;
218 * FK to Payment Instrument
222 public $payment_instrument_id;
224 * The campaign for which this contribution has been triggered.
230 * if true, receipt is automatically emailed to contact on each successful payment
234 public $is_email_receipt;
238 * @return civicrm_contribution_recur
240 function __construct() {
241 $this->__table
= 'civicrm_contribution_recur';
242 parent
::__construct();
245 * Returns foreign keys and entity references
248 * [CRM_Core_Reference_Interface]
250 static function getReferenceColumns() {
251 if (!self
::$_links) {
252 self
::$_links = static ::createReferenceColumns(__CLASS__
);
253 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contact_id', 'civicrm_contact', 'id');
254 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'payment_token_id', 'civicrm_payment_token', 'id');
255 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'payment_processor_id', 'civicrm_payment_processor', 'id');
256 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id');
257 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'campaign_id', 'civicrm_campaign', 'id');
259 return self
::$_links;
262 * Returns all the column names of this table
266 static function &fields() {
267 if (!(self
::$_fields)) {
268 self
::$_fields = array(
271 'type' => CRM_Utils_Type
::T_INT
,
272 'title' => ts('Recurring Contribution ID') ,
273 'description' => 'Contribution Recur ID',
276 'contact_id' => array(
277 'name' => 'contact_id',
278 'type' => CRM_Utils_Type
::T_INT
,
279 'title' => ts('Contact ID') ,
280 'description' => 'Foreign key to civicrm_contact.id .',
282 'FKClassName' => 'CRM_Contact_DAO_Contact',
286 'type' => CRM_Utils_Type
::T_MONEY
,
287 'title' => ts('Amount') ,
288 'description' => 'Amount to be contributed or charged each recurrence.',
290 'precision' => array(
299 'name' => 'currency',
300 'type' => CRM_Utils_Type
::T_STRING
,
301 'title' => ts('Currency') ,
302 'description' => '3 character string, value from config setting or input via user.',
304 'size' => CRM_Utils_Type
::FOUR
,
309 'pseudoconstant' => array(
310 'table' => 'civicrm_currency',
311 'keyColumn' => 'name',
312 'labelColumn' => 'full_name',
313 'nameColumn' => 'name',
316 'frequency_unit' => array(
317 'name' => 'frequency_unit',
318 'type' => CRM_Utils_Type
::T_STRING
,
319 'title' => ts('Frequency Unit') ,
320 'description' => 'Time units for recurrence of payment.',
322 'size' => CRM_Utils_Type
::EIGHT
,
323 'default' => 'month',
327 'pseudoconstant' => array(
328 'optionGroupName' => 'recur_frequency_units',
329 'keyColumn' => 'name',
330 'optionEditPath' => 'civicrm/admin/options/recur_frequency_units',
333 'frequency_interval' => array(
334 'name' => 'frequency_interval',
335 'type' => CRM_Utils_Type
::T_INT
,
336 'title' => ts('Interval (number of units)') ,
337 'description' => 'Number of time units for recurrence of payment.',
343 'installments' => array(
344 'name' => 'installments',
345 'type' => CRM_Utils_Type
::T_INT
,
346 'title' => ts('Number of Installments') ,
347 '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.',
352 'start_date' => array(
353 'name' => 'start_date',
354 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
355 'title' => ts('Recurring Contribution Started Date') ,
356 'description' => 'The date the first scheduled recurring contribution occurs.',
359 'type' => 'Select Date',
362 'create_date' => array(
363 'name' => 'create_date',
364 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
365 'title' => ts('Recurring Contribution Created Date') ,
366 'description' => 'When this recurring contribution record was created.',
369 'type' => 'Select Date',
372 'modified_date' => array(
373 'name' => 'modified_date',
374 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
375 'title' => ts('Recurring Contribution Modified Date') ,
376 'description' => 'Last updated date for this record. mostly the last time a payment was received',
378 'type' => 'Select Date',
381 'cancel_date' => array(
382 'name' => 'cancel_date',
383 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
384 'title' => ts('Recurring Contribution Cancel Date') ,
385 'description' => 'Date this recurring contribution was cancelled by contributor- if we can get access to it',
387 'type' => 'Select Date',
391 'name' => 'end_date',
392 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
393 'title' => ts('Recurring Contribution End Date') ,
394 'description' => 'Date this recurring contribution finished successfully',
396 'type' => 'Select Date',
399 'processor_id' => array(
400 'name' => 'processor_id',
401 'type' => CRM_Utils_Type
::T_STRING
,
402 'title' => ts('Processor ID') ,
403 'description' => 'Possibly needed to store a unique identifier for this recurring payment order - if this is available from the processor??',
405 'size' => CRM_Utils_Type
::HUGE
,
407 'payment_token_id' => array(
408 'name' => 'payment_token_id',
409 'type' => CRM_Utils_Type
::T_INT
,
410 'title' => ts('Payment Token ID') ,
411 'description' => 'Optionally used to store a link to a payment token used for this recurring contribution.',
412 'FKClassName' => 'CRM_Financial_DAO_PaymentToken',
416 'type' => CRM_Utils_Type
::T_STRING
,
417 'title' => ts('Transaction ID') ,
418 'description' => 'unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method',
420 'size' => CRM_Utils_Type
::HUGE
,
422 'invoice_id' => array(
423 'name' => 'invoice_id',
424 'type' => CRM_Utils_Type
::T_STRING
,
425 'title' => ts('Invoice ID') ,
426 'description' => 'unique invoice id, system generated or passed in',
428 'size' => CRM_Utils_Type
::HUGE
,
430 'contribution_status_id' => array(
431 'name' => 'contribution_status_id',
432 'type' => CRM_Utils_Type
::T_INT
,
433 'title' => ts('Recurring Contribution Status') ,
435 'where' => 'civicrm_contribution_recur.contribution_status_id',
436 'headerPattern' => '',
440 'pseudoconstant' => array(
441 'optionGroupName' => 'contribution_status',
442 'optionEditPath' => 'civicrm/admin/options/contribution_status',
447 'type' => CRM_Utils_Type
::T_BOOLEAN
,
448 'title' => ts('Test') ,
450 'where' => 'civicrm_contribution_recur.is_test',
451 'headerPattern' => '',
455 'type' => 'CheckBox',
458 'cycle_day' => array(
459 'name' => 'cycle_day',
460 'type' => CRM_Utils_Type
::T_INT
,
461 'title' => ts('Number of Cycle Day') ,
462 'description' => 'Day in the period when the payment should be charged e.g. 1st of month, 15th etc.',
469 'next_sched_contribution_date' => array(
470 'name' => 'next_sched_contribution_date',
471 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
472 'title' => ts('Next Scheduled Contribution Date') ,
473 'description' => 'Next scheduled date',
475 'type' => 'Select Date',
478 'failure_count' => array(
479 'name' => 'failure_count',
480 'type' => CRM_Utils_Type
::T_INT
,
481 'title' => ts('Number of Failures') ,
482 'description' => 'Number of failed charge attempts since last success. Business rule could be set to deactivate on more than x failures.',
487 'failure_retry_date' => array(
488 'name' => 'failure_retry_date',
489 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
490 'title' => ts('Retry Failed Attempt Date') ,
491 'description' => 'Date to retry failed attempt',
493 'type' => 'Select Date',
496 'auto_renew' => array(
497 'name' => 'auto_renew',
498 'type' => CRM_Utils_Type
::T_BOOLEAN
,
499 'title' => ts('Auto Renew') ,
500 'description' => 'Some systems allow contributor to set a number of installments - but then auto-renew the subscription or commitment if they do not cancel.',
503 'type' => 'CheckBox',
506 'payment_processor_id' => array(
507 'name' => 'payment_processor_id',
508 'type' => CRM_Utils_Type
::T_INT
,
509 'title' => ts('Payment Processor') ,
510 'description' => 'Foreign key to civicrm_payment_processor.id',
511 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
513 'financial_type_id' => array(
514 'name' => 'financial_type_id',
515 'type' => CRM_Utils_Type
::T_INT
,
516 'title' => ts('Financial Type') ,
517 'description' => 'FK to Financial Type',
519 'where' => 'civicrm_contribution_recur.financial_type_id',
520 'headerPattern' => '',
522 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
523 'pseudoconstant' => array(
524 'table' => 'civicrm_financial_type',
526 'labelColumn' => 'name',
529 'payment_instrument_id' => array(
530 'name' => 'payment_instrument_id',
531 'type' => CRM_Utils_Type
::T_INT
,
532 'title' => ts('Payment Method') ,
533 'description' => 'FK to Payment Instrument',
537 'pseudoconstant' => array(
538 'optionGroupName' => 'payment_instrument',
539 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
542 'contribution_campaign_id' => array(
543 'name' => 'campaign_id',
544 'type' => CRM_Utils_Type
::T_INT
,
545 'title' => ts('Campaign') ,
546 'description' => 'The campaign for which this contribution has been triggered.',
548 'where' => 'civicrm_contribution_recur.campaign_id',
549 'headerPattern' => '',
552 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
553 'pseudoconstant' => array(
554 'table' => 'civicrm_campaign',
556 'labelColumn' => 'title',
559 'is_email_receipt' => array(
560 'name' => 'is_email_receipt',
561 'type' => CRM_Utils_Type
::T_BOOLEAN
,
562 'title' => ts('Send email Receipt?') ,
563 'description' => 'if true, receipt is automatically emailed to contact on each successful payment',
566 'type' => 'CheckBox',
571 return self
::$_fields;
574 * Returns an array containing, for each field, the arary key used for that
575 * field in self::$_fields.
579 static function &fieldKeys() {
580 if (!(self
::$_fieldKeys)) {
581 self
::$_fieldKeys = array(
583 'contact_id' => 'contact_id',
584 'amount' => 'amount',
585 'currency' => 'currency',
586 'frequency_unit' => 'frequency_unit',
587 'frequency_interval' => 'frequency_interval',
588 'installments' => 'installments',
589 'start_date' => 'start_date',
590 'create_date' => 'create_date',
591 'modified_date' => 'modified_date',
592 'cancel_date' => 'cancel_date',
593 'end_date' => 'end_date',
594 'processor_id' => 'processor_id',
595 'payment_token_id' => 'payment_token_id',
596 'trxn_id' => 'trxn_id',
597 'invoice_id' => 'invoice_id',
598 'contribution_status_id' => 'contribution_status_id',
599 'is_test' => 'is_test',
600 'cycle_day' => 'cycle_day',
601 'next_sched_contribution_date' => 'next_sched_contribution_date',
602 'failure_count' => 'failure_count',
603 'failure_retry_date' => 'failure_retry_date',
604 'auto_renew' => 'auto_renew',
605 'payment_processor_id' => 'payment_processor_id',
606 'financial_type_id' => 'financial_type_id',
607 'payment_instrument_id' => 'payment_instrument_id',
608 'campaign_id' => 'contribution_campaign_id',
609 'is_email_receipt' => 'is_email_receipt',
612 return self
::$_fieldKeys;
615 * Returns the names of this table
619 static function getTableName() {
620 return self
::$_tableName;
623 * Returns if this table needs to be logged
631 * Returns the list of fields that can be imported
633 * @param bool $prefix
637 static function &import($prefix = false) {
638 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contribution_recur', $prefix, array());
642 * Returns the list of fields that can be exported
644 * @param bool $prefix
648 static function &export($prefix = false) {
649 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contribution_recur', $prefix, array());