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: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 value to see if we should log any modifications to
46 * this table in the civicrm_log table
52 * Contribution Recur ID
58 * Foreign key to civicrm_contact.id .
64 * Amount to be contributed or charged each recurrence.
70 * 3 character string, value from config setting or input via user.
76 * Time units for recurrence of payment.
80 public $frequency_unit;
82 * Number of time units for recurrence of payment.
86 public $frequency_interval;
88 * Total number of payments to be made. Set this to 0 if this is an open-ended commitment i.e. no set end date.
94 * The date the first scheduled recurring contribution occurs.
100 * When this recurring contribution record was created.
106 * Last updated date for this record. mostly the last time a payment was received
110 public $modified_date;
112 * Date this recurring contribution was cancelled by contributor- if we can get access to it
118 * Date this recurring contribution finished successfully
124 * Possibly needed to store a unique identifier for this recurring payment order - if this is available from the processor??
128 public $processor_id;
130 * Optionally used to store a link to a payment token used for this recurring contribution.
134 public $payment_token_id;
136 * unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method
142 * unique invoice id, system generated or passed in
151 public $contribution_status_id;
158 * Day in the period when the payment should be charged e.g. 1st of month, 15th etc.
164 * Next scheduled date
168 public $next_sched_contribution_date;
170 * Number of failed charge attempts since last success. Business rule could be set to deactivate on more than x failures.
174 public $failure_count;
176 * Date to retry failed attempt
180 public $failure_retry_date;
182 * Some systems allow contributor to set a number of installments - but then auto-renew the subscription or commitment if they do not cancel.
188 * Foreign key to civicrm_payment_processor.id
192 public $payment_processor_id;
194 * FK to Financial Type
198 public $financial_type_id;
200 * FK to Payment Instrument
204 public $payment_instrument_id;
206 * The campaign for which this contribution has been triggered.
212 * if true, receipt is automatically emailed to contact on each successful payment
216 public $is_email_receipt;
220 * @return civicrm_contribution_recur
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',
259 'contact_id' => array(
260 'name' => 'contact_id',
261 'type' => CRM_Utils_Type
::T_INT
,
262 'title' => ts('Contact ID') ,
263 'description' => 'Foreign key to civicrm_contact.id .',
265 'FKClassName' => 'CRM_Contact_DAO_Contact',
269 'type' => CRM_Utils_Type
::T_MONEY
,
270 'title' => ts('Amount') ,
271 'description' => 'Amount to be contributed or charged each recurrence.',
273 'precision' => array(
282 'name' => 'currency',
283 'type' => CRM_Utils_Type
::T_STRING
,
284 'title' => ts('Currency') ,
285 'description' => '3 character string, value from config setting or input via user.',
287 'size' => CRM_Utils_Type
::FOUR
,
292 'pseudoconstant' => array(
293 'table' => 'civicrm_currency',
294 'keyColumn' => 'name',
295 'labelColumn' => 'full_name',
296 'nameColumn' => 'name',
299 'frequency_unit' => array(
300 'name' => 'frequency_unit',
301 'type' => CRM_Utils_Type
::T_STRING
,
302 'title' => ts('Frequency Unit') ,
303 'description' => 'Time units for recurrence of payment.',
305 'size' => CRM_Utils_Type
::EIGHT
,
306 'default' => 'month',
310 'pseudoconstant' => array(
311 'optionGroupName' => 'recur_frequency_units',
312 'keyColumn' => 'name',
313 'optionEditPath' => 'civicrm/admin/options/recur_frequency_units',
316 'frequency_interval' => array(
317 'name' => 'frequency_interval',
318 'type' => CRM_Utils_Type
::T_INT
,
319 'title' => ts('Interval (number of units)') ,
320 'description' => 'Number of time units for recurrence of payment.',
326 'installments' => array(
327 'name' => 'installments',
328 'type' => CRM_Utils_Type
::T_INT
,
329 'title' => ts('Number of Installments') ,
330 '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.',
335 'start_date' => array(
336 'name' => 'start_date',
337 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
338 'title' => ts('Recurring Contribution Started Date') ,
339 'description' => 'The date the first scheduled recurring contribution occurs.',
342 'type' => 'Select Date',
345 'create_date' => array(
346 'name' => 'create_date',
347 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
348 'title' => ts('Recurring Contribution Created Date') ,
349 'description' => 'When this recurring contribution record was created.',
352 'type' => 'Select Date',
355 'modified_date' => array(
356 'name' => 'modified_date',
357 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
358 'title' => ts('Recurring Contribution Modified Date') ,
359 'description' => 'Last updated date for this record. mostly the last time a payment was received',
361 'type' => 'Select Date',
364 'cancel_date' => array(
365 'name' => 'cancel_date',
366 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
367 'title' => ts('Recurring Contribution Cancel Date') ,
368 'description' => 'Date this recurring contribution was cancelled by contributor- if we can get access to it',
370 'type' => 'Select Date',
374 'name' => 'end_date',
375 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
376 'title' => ts('Recurring Contribution End Date') ,
377 'description' => 'Date this recurring contribution finished successfully',
379 'type' => 'Select Date',
382 'processor_id' => array(
383 'name' => 'processor_id',
384 'type' => CRM_Utils_Type
::T_STRING
,
385 'title' => ts('Processor ID') ,
386 'description' => 'Possibly needed to store a unique identifier for this recurring payment order - if this is available from the processor??',
388 'size' => CRM_Utils_Type
::HUGE
,
390 'payment_token_id' => array(
391 'name' => 'payment_token_id',
392 'type' => CRM_Utils_Type
::T_INT
,
393 'title' => ts('Payment Token ID') ,
394 'description' => 'Optionally used to store a link to a payment token used for this recurring contribution.',
395 'FKClassName' => 'CRM_Financial_DAO_PaymentToken',
399 'type' => CRM_Utils_Type
::T_STRING
,
400 'title' => ts('Transaction ID') ,
401 'description' => 'unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method',
403 'size' => CRM_Utils_Type
::HUGE
,
405 'invoice_id' => array(
406 'name' => 'invoice_id',
407 'type' => CRM_Utils_Type
::T_STRING
,
408 'title' => ts('Invoice ID') ,
409 'description' => 'unique invoice id, system generated or passed in',
411 'size' => CRM_Utils_Type
::HUGE
,
413 'contribution_status_id' => array(
414 'name' => 'contribution_status_id',
415 'type' => CRM_Utils_Type
::T_INT
,
416 'title' => ts('Recurring Contribution Status') ,
418 'where' => 'civicrm_contribution_recur.contribution_status_id',
419 'headerPattern' => '',
423 'pseudoconstant' => array(
424 'optionGroupName' => 'contribution_status',
425 'optionEditPath' => 'civicrm/admin/options/contribution_status',
430 'type' => CRM_Utils_Type
::T_BOOLEAN
,
431 'title' => ts('Test') ,
433 'where' => 'civicrm_contribution_recur.is_test',
434 'headerPattern' => '',
438 'type' => 'CheckBox',
441 'cycle_day' => array(
442 'name' => 'cycle_day',
443 'type' => CRM_Utils_Type
::T_INT
,
444 'title' => ts('Number of Cycle Day') ,
445 'description' => 'Day in the period when the payment should be charged e.g. 1st of month, 15th etc.',
452 'next_sched_contribution_date' => array(
453 'name' => 'next_sched_contribution_date',
454 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
455 'title' => ts('Next Scheduled Contribution Date') ,
456 'description' => 'Next scheduled date',
458 'type' => 'Select Date',
461 'failure_count' => array(
462 'name' => 'failure_count',
463 'type' => CRM_Utils_Type
::T_INT
,
464 'title' => ts('Number of Failures') ,
465 'description' => 'Number of failed charge attempts since last success. Business rule could be set to deactivate on more than x failures.',
470 'failure_retry_date' => array(
471 'name' => 'failure_retry_date',
472 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
473 'title' => ts('Retry Failed Attempt Date') ,
474 'description' => 'Date to retry failed attempt',
476 'type' => 'Select Date',
479 'auto_renew' => array(
480 'name' => 'auto_renew',
481 'type' => CRM_Utils_Type
::T_BOOLEAN
,
482 'title' => ts('Auto Renew') ,
483 'description' => 'Some systems allow contributor to set a number of installments - but then auto-renew the subscription or commitment if they do not cancel.',
486 'type' => 'CheckBox',
489 'payment_processor_id' => array(
490 'name' => 'payment_processor_id',
491 'type' => CRM_Utils_Type
::T_INT
,
492 'title' => ts('Payment Processor') ,
493 'description' => 'Foreign key to civicrm_payment_processor.id',
494 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
496 'financial_type_id' => array(
497 'name' => 'financial_type_id',
498 'type' => CRM_Utils_Type
::T_INT
,
499 'title' => ts('Financial Type') ,
500 'description' => 'FK to Financial Type',
502 'where' => 'civicrm_contribution_recur.financial_type_id',
503 'headerPattern' => '',
505 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
506 'pseudoconstant' => array(
507 'table' => 'civicrm_financial_type',
509 'labelColumn' => 'name',
512 'payment_instrument_id' => array(
513 'name' => 'payment_instrument_id',
514 'type' => CRM_Utils_Type
::T_INT
,
515 'title' => ts('Payment Method') ,
516 'description' => 'FK to Payment Instrument',
520 'pseudoconstant' => array(
521 'optionGroupName' => 'payment_instrument',
522 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
525 'contribution_campaign_id' => array(
526 'name' => 'campaign_id',
527 'type' => CRM_Utils_Type
::T_INT
,
528 'title' => ts('Campaign') ,
529 'description' => 'The campaign for which this contribution has been triggered.',
531 'where' => 'civicrm_contribution_recur.campaign_id',
532 'headerPattern' => '',
535 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
536 'pseudoconstant' => array(
537 'table' => 'civicrm_campaign',
539 'labelColumn' => 'title',
542 'is_email_receipt' => array(
543 'name' => 'is_email_receipt',
544 'type' => CRM_Utils_Type
::T_BOOLEAN
,
545 'title' => ts('Send email Receipt?') ,
546 'description' => 'if true, receipt is automatically emailed to contact on each successful payment',
549 'type' => 'CheckBox',
553 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
555 return Civi
::$statics[__CLASS__
]['fields'];
558 * Return a mapping from field-name to the corresponding key (as used in fields()).
561 * Array(string $name => string $uniqueName).
563 static function &fieldKeys() {
564 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
565 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
567 return Civi
::$statics[__CLASS__
]['fieldKeys'];
570 * Returns the names of this table
574 static function getTableName() {
575 return self
::$_tableName;
578 * Returns if this table needs to be logged
586 * Returns the list of fields that can be imported
588 * @param bool $prefix
592 static function &import($prefix = false) {
593 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contribution_recur', $prefix, array());
597 * Returns the list of fields that can be exported
599 * @param bool $prefix
603 static function &export($prefix = false) {
604 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contribution_recur', $prefix, array());