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:fe7fe63ae2bf5e2e2c1f9e2449d5bda6)
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 instance to hold the values that can
68 static $_import = null;
70 * static instance to hold the values that can
75 static $_export = null;
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
84 * Contribution Recur ID
90 * Foreign key to civicrm_contact.id .
96 * Amount to be contributed or charged each recurrence.
102 * 3 character string, value from config setting or input via user.
108 * Time units for recurrence of payment.
112 public $frequency_unit;
114 * Number of time units for recurrence of payment.
118 public $frequency_interval;
120 * Total number of payments to be made. Set this to 0 if this is an open-ended commitment i.e. no set end date.
124 public $installments;
126 * The date the first scheduled recurring contribution occurs.
132 * When this recurring contribution record was created.
138 * Last updated date for this record. mostly the last time a payment was received
142 public $modified_date;
144 * Date this recurring contribution was cancelled by contributor- if we can get access to it
150 * Date this recurring contribution finished successfully
156 * Possibly needed to store a unique identifier for this recurring payment order - if this is available from the processor??
160 public $processor_id;
162 * Optionally used to store a link to a payment token used for this recurring contribution.
166 public $payment_token_id;
168 * unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method
174 * unique invoice id, system generated or passed in
183 public $contribution_status_id;
190 * Day in the period when the payment should be charged e.g. 1st of month, 15th etc.
196 * Next scheduled date
200 public $next_sched_contribution_date;
202 * Number of failed charge attempts since last success. Business rule could be set to deactivate on more than x failures.
206 public $failure_count;
208 * Date to retry failed attempt
212 public $failure_retry_date;
214 * Some systems allow contributor to set a number of installments - but then auto-renew the subscription or commitment if they do not cancel.
220 * Foreign key to civicrm_payment_processor.id
224 public $payment_processor_id;
226 * FK to Financial Type
230 public $financial_type_id;
232 * FK to Payment Instrument
236 public $payment_instrument_id;
238 * The campaign for which this contribution has been triggered.
244 * if true, receipt is automatically emailed to contact on each successful payment
248 public $is_email_receipt;
252 * @return civicrm_contribution_recur
254 function __construct() {
255 $this->__table
= 'civicrm_contribution_recur';
256 parent
::__construct();
259 * Returns foreign keys and entity references
262 * [CRM_Core_Reference_Interface]
264 static function getReferenceColumns() {
265 if (!self
::$_links) {
266 self
::$_links = static ::createReferenceColumns(__CLASS__
);
267 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contact_id', 'civicrm_contact', 'id');
268 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'payment_token_id', 'civicrm_payment_token', 'id');
269 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'payment_processor_id', 'civicrm_payment_processor', 'id');
270 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id');
271 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'campaign_id', 'civicrm_campaign', 'id');
273 return self
::$_links;
276 * Returns all the column names of this table
280 static function &fields() {
281 if (!(self
::$_fields)) {
282 self
::$_fields = array(
285 'type' => CRM_Utils_Type
::T_INT
,
286 'title' => ts('Recurring Contribution ID') ,
287 'description' => 'Contribution Recur ID',
290 'contact_id' => array(
291 'name' => 'contact_id',
292 'type' => CRM_Utils_Type
::T_INT
,
293 'title' => ts('Contact ID') ,
294 'description' => 'Foreign key to civicrm_contact.id .',
296 'FKClassName' => 'CRM_Contact_DAO_Contact',
300 'type' => CRM_Utils_Type
::T_MONEY
,
301 'title' => ts('Amount') ,
302 'description' => 'Amount to be contributed or charged each recurrence.',
304 'precision' => array(
313 'name' => 'currency',
314 'type' => CRM_Utils_Type
::T_STRING
,
315 'title' => ts('Currency') ,
316 'description' => '3 character string, value from config setting or input via user.',
318 'size' => CRM_Utils_Type
::FOUR
,
323 'pseudoconstant' => array(
324 'table' => 'civicrm_currency',
325 'keyColumn' => 'name',
326 'labelColumn' => 'full_name',
327 'nameColumn' => 'name',
330 'frequency_unit' => array(
331 'name' => 'frequency_unit',
332 'type' => CRM_Utils_Type
::T_STRING
,
333 'title' => ts('Frequency Unit') ,
334 'description' => 'Time units for recurrence of payment.',
336 'size' => CRM_Utils_Type
::EIGHT
,
337 'default' => 'month',
341 'pseudoconstant' => array(
342 'optionGroupName' => 'recur_frequency_units',
343 'keyColumn' => 'name',
344 'optionEditPath' => 'civicrm/admin/options/recur_frequency_units',
347 'frequency_interval' => array(
348 'name' => 'frequency_interval',
349 'type' => CRM_Utils_Type
::T_INT
,
350 'title' => ts('Interval (number of units)') ,
351 'description' => 'Number of time units for recurrence of payment.',
357 'installments' => array(
358 'name' => 'installments',
359 'type' => CRM_Utils_Type
::T_INT
,
360 'title' => ts('Number of Installments') ,
361 '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.',
366 'start_date' => array(
367 'name' => 'start_date',
368 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
369 'title' => ts('Recurring Contribution Started Date') ,
370 'description' => 'The date the first scheduled recurring contribution occurs.',
373 'type' => 'Select Date',
376 'create_date' => array(
377 'name' => 'create_date',
378 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
379 'title' => ts('Recurring Contribution Created Date') ,
380 'description' => 'When this recurring contribution record was created.',
383 'type' => 'Select Date',
386 'modified_date' => array(
387 'name' => 'modified_date',
388 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
389 'title' => ts('Recurring Contribution Modified Date') ,
390 'description' => 'Last updated date for this record. mostly the last time a payment was received',
392 'type' => 'Select Date',
395 'cancel_date' => array(
396 'name' => 'cancel_date',
397 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
398 'title' => ts('Recurring Contribution Cancel Date') ,
399 'description' => 'Date this recurring contribution was cancelled by contributor- if we can get access to it',
401 'type' => 'Select Date',
405 'name' => 'end_date',
406 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
407 'title' => ts('Recurring Contribution End Date') ,
408 'description' => 'Date this recurring contribution finished successfully',
410 'type' => 'Select Date',
413 'processor_id' => array(
414 'name' => 'processor_id',
415 'type' => CRM_Utils_Type
::T_STRING
,
416 'title' => ts('Processor ID') ,
417 'description' => 'Possibly needed to store a unique identifier for this recurring payment order - if this is available from the processor??',
419 'size' => CRM_Utils_Type
::HUGE
,
421 'payment_token_id' => array(
422 'name' => 'payment_token_id',
423 'type' => CRM_Utils_Type
::T_INT
,
424 'title' => ts('Payment Token ID') ,
425 'description' => 'Optionally used to store a link to a payment token used for this recurring contribution.',
426 'FKClassName' => 'CRM_Financial_DAO_PaymentToken',
430 'type' => CRM_Utils_Type
::T_STRING
,
431 'title' => ts('Transaction ID') ,
432 'description' => 'unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method',
434 'size' => CRM_Utils_Type
::HUGE
,
436 'invoice_id' => array(
437 'name' => 'invoice_id',
438 'type' => CRM_Utils_Type
::T_STRING
,
439 'title' => ts('Invoice ID') ,
440 'description' => 'unique invoice id, system generated or passed in',
442 'size' => CRM_Utils_Type
::HUGE
,
444 'contribution_status_id' => array(
445 'name' => 'contribution_status_id',
446 'type' => CRM_Utils_Type
::T_INT
,
447 'title' => ts('Recurring Contribution Status') ,
449 'where' => 'civicrm_contribution_recur.contribution_status_id',
450 'headerPattern' => '',
454 'pseudoconstant' => array(
455 'optionGroupName' => 'contribution_status',
456 'optionEditPath' => 'civicrm/admin/options/contribution_status',
461 'type' => CRM_Utils_Type
::T_BOOLEAN
,
462 'title' => ts('Test') ,
464 'where' => 'civicrm_contribution_recur.is_test',
465 'headerPattern' => '',
469 'cycle_day' => array(
470 'name' => 'cycle_day',
471 'type' => CRM_Utils_Type
::T_INT
,
472 'title' => ts('Number of Cycle Day') ,
473 'description' => 'Day in the period when the payment should be charged e.g. 1st of month, 15th etc.',
477 'next_sched_contribution_date' => array(
478 'name' => 'next_sched_contribution_date',
479 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
480 'title' => ts('Next Scheduled Contribution Date') ,
481 'description' => 'Next scheduled date',
483 'type' => 'Select Date',
486 'failure_count' => array(
487 'name' => 'failure_count',
488 'type' => CRM_Utils_Type
::T_INT
,
489 'title' => ts('Number of Failures') ,
490 'description' => 'Number of failed charge attempts since last success. Business rule could be set to deactivate on more than x failures.',
492 'failure_retry_date' => array(
493 'name' => 'failure_retry_date',
494 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
495 'title' => ts('Retry Failed Attempt Date') ,
496 'description' => 'Date to retry failed attempt',
498 'type' => 'Select Date',
501 'auto_renew' => array(
502 'name' => 'auto_renew',
503 'type' => CRM_Utils_Type
::T_BOOLEAN
,
504 'title' => ts('Auto Renew') ,
505 'description' => 'Some systems allow contributor to set a number of installments - but then auto-renew the subscription or commitment if they do not cancel.',
508 'payment_processor_id' => array(
509 'name' => 'payment_processor_id',
510 'type' => CRM_Utils_Type
::T_INT
,
511 'title' => ts('Payment Processor') ,
512 'description' => 'Foreign key to civicrm_payment_processor.id',
513 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
515 'financial_type_id' => array(
516 'name' => 'financial_type_id',
517 'type' => CRM_Utils_Type
::T_INT
,
518 'title' => ts('Financial Type') ,
519 'description' => 'FK to Financial Type',
521 'where' => 'civicrm_contribution_recur.financial_type_id',
522 'headerPattern' => '',
524 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
525 'pseudoconstant' => array(
526 'table' => 'civicrm_financial_type',
528 'labelColumn' => 'name',
531 'payment_instrument_id' => array(
532 'name' => 'payment_instrument_id',
533 'type' => CRM_Utils_Type
::T_INT
,
534 'title' => ts('Payment Method') ,
535 'description' => 'FK to Payment Instrument',
539 'pseudoconstant' => array(
540 'optionGroupName' => 'payment_instrument',
541 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
544 'contribution_campaign_id' => array(
545 'name' => 'campaign_id',
546 'type' => CRM_Utils_Type
::T_INT
,
547 'title' => ts('Campaign') ,
548 'description' => 'The campaign for which this contribution has been triggered.',
550 'where' => 'civicrm_contribution_recur.campaign_id',
551 'headerPattern' => '',
554 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
555 'pseudoconstant' => array(
556 'table' => 'civicrm_campaign',
558 'labelColumn' => 'title',
561 'is_email_receipt' => array(
562 'name' => 'is_email_receipt',
563 'type' => CRM_Utils_Type
::T_BOOLEAN
,
564 'title' => ts('Send email Receipt?') ,
565 'description' => 'if true, receipt is automatically emailed to contact on each successful payment',
570 return self
::$_fields;
573 * Returns an array containing, for each field, the arary key used for that
574 * field in self::$_fields.
578 static function &fieldKeys() {
579 if (!(self
::$_fieldKeys)) {
580 self
::$_fieldKeys = array(
582 'contact_id' => 'contact_id',
583 'amount' => 'amount',
584 'currency' => 'currency',
585 'frequency_unit' => 'frequency_unit',
586 'frequency_interval' => 'frequency_interval',
587 'installments' => 'installments',
588 'start_date' => 'start_date',
589 'create_date' => 'create_date',
590 'modified_date' => 'modified_date',
591 'cancel_date' => 'cancel_date',
592 'end_date' => 'end_date',
593 'processor_id' => 'processor_id',
594 'payment_token_id' => 'payment_token_id',
595 'trxn_id' => 'trxn_id',
596 'invoice_id' => 'invoice_id',
597 'contribution_status_id' => 'contribution_status_id',
598 'is_test' => 'is_test',
599 'cycle_day' => 'cycle_day',
600 'next_sched_contribution_date' => 'next_sched_contribution_date',
601 'failure_count' => 'failure_count',
602 'failure_retry_date' => 'failure_retry_date',
603 'auto_renew' => 'auto_renew',
604 'payment_processor_id' => 'payment_processor_id',
605 'financial_type_id' => 'financial_type_id',
606 'payment_instrument_id' => 'payment_instrument_id',
607 'campaign_id' => 'contribution_campaign_id',
608 'is_email_receipt' => 'is_email_receipt',
611 return self
::$_fieldKeys;
614 * Returns the names of this table
618 static function getTableName() {
619 return self
::$_tableName;
622 * Returns if this table needs to be logged
630 * Returns the list of fields that can be imported
632 * @param bool $prefix
636 static function &import($prefix = false) {
637 if (!(self
::$_import)) {
638 self
::$_import = array();
639 $fields = self
::fields();
640 foreach($fields as $name => $field) {
641 if (CRM_Utils_Array
::value('import', $field)) {
643 self
::$_import['contribution_recur'] = & $fields[$name];
645 self
::$_import[$name] = & $fields[$name];
650 return self
::$_import;
653 * Returns the list of fields that can be exported
655 * @param bool $prefix
659 static function &export($prefix = false) {
660 if (!(self
::$_export)) {
661 self
::$_export = array();
662 $fields = self
::fields();
663 foreach($fields as $name => $field) {
664 if (CRM_Utils_Array
::value('export', $field)) {
666 self
::$_export['contribution_recur'] = & $fields[$name];
668 self
::$_export[$name] = & $fields[$name];
673 return self
::$_export;