5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Contribute/Contribution.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:edd96be2e997a659ceeee0cf823c6f90)
13 * Database access object for the Contribution entity.
15 class CRM_Contribute_DAO_Contribution
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.3';
18 const COMPONENT
= 'CiviContribute';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_contribution';
28 * Icon associated with this entity.
32 public static $_icon = 'fa-credit-card';
35 * Should CiviCRM log any modifications to this table in the civicrm_log table.
39 public static $_log = TRUE;
42 * Paths for accessing this entity in the UI.
46 protected static $_paths = [
47 'add' => 'civicrm/contribute/add?reset=1&action=add&context=standalone',
48 'view' => 'civicrm/contact/view/contribution?reset=1&action=view&id=[id]',
49 'update' => 'civicrm/contact/view/contribution?reset=1&action=update&id=[id]',
50 'delete' => 'civicrm/contact/view/contribution?reset=1&action=delete&id=[id]',
56 * @var int|string|null
57 * (SQL type: int unsigned)
58 * Note that values will be retrieved from the database as a string.
66 * (SQL type: int unsigned)
67 * Note that values will be retrieved from the database as a string.
72 * FK to Financial Type for (total_amount - non_deductible_amount).
74 * @var int|string|null
75 * (SQL type: int unsigned)
76 * Note that values will be retrieved from the database as a string.
78 public $financial_type_id;
81 * The Contribution Page which triggered this contribution
83 * @var int|string|null
84 * (SQL type: int unsigned)
85 * Note that values will be retrieved from the database as a string.
87 public $contribution_page_id;
90 * FK to Payment Instrument
92 * @var int|string|null
93 * (SQL type: int unsigned)
94 * Note that values will be retrieved from the database as a string.
96 public $payment_instrument_id;
99 * Date contribution was received - not necessarily the creation date of the record
102 * (SQL type: datetime)
103 * Note that values will be retrieved from the database as a string.
105 public $receive_date;
108 * Portion of total amount which is NOT tax deductible. Equal to total_amount for non-deductible financial types.
110 * @var float|string|null
111 * (SQL type: decimal(20,2))
112 * Note that values will be retrieved from the database as a string.
114 public $non_deductible_amount;
117 * Total amount of this contribution. Use market value for non-monetary gifts.
120 * (SQL type: decimal(20,2))
121 * Note that values will be retrieved from the database as a string.
123 public $total_amount;
126 * actual processor fee if known - may be 0.
128 * @var float|string|null
129 * (SQL type: decimal(20,2))
130 * Note that values will be retrieved from the database as a string.
135 * actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.
137 * @var float|string|null
138 * (SQL type: decimal(20,2))
139 * Note that values will be retrieved from the database as a string.
144 * unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method
147 * (SQL type: varchar(255))
148 * Note that values will be retrieved from the database as a string.
153 * unique invoice id, system generated or passed in
156 * (SQL type: varchar(255))
157 * Note that values will be retrieved from the database as a string.
162 * Human readable invoice number
165 * (SQL type: varchar(255))
166 * Note that values will be retrieved from the database as a string.
168 public $invoice_number;
171 * 3 character string, value from config setting or input via user.
174 * (SQL type: varchar(3))
175 * Note that values will be retrieved from the database as a string.
180 * when was gift cancelled
183 * (SQL type: datetime)
184 * Note that values will be retrieved from the database as a string.
191 * Note that values will be retrieved from the database as a string.
193 public $cancel_reason;
196 * when (if) receipt was sent. populated automatically for online donations w/ automatic receipting
199 * (SQL type: datetime)
200 * Note that values will be retrieved from the database as a string.
202 public $receipt_date;
205 * when (if) was donor thanked
208 * (SQL type: datetime)
209 * Note that values will be retrieved from the database as a string.
211 public $thankyou_date;
214 * Origin of this Contribution.
217 * (SQL type: varchar(255))
218 * Note that values will be retrieved from the database as a string.
225 * Note that values will be retrieved from the database as a string.
227 public $amount_level;
230 * Conditional foreign key to civicrm_contribution_recur id. Each contribution made in connection with a recurring contribution carries a foreign key to the recurring contribution record. This assumes we can track these processor initiated events.
232 * @var int|string|null
233 * (SQL type: int unsigned)
234 * Note that values will be retrieved from the database as a string.
236 public $contribution_recur_id;
240 * (SQL type: tinyint)
241 * Note that values will be retrieved from the database as a string.
247 * (SQL type: tinyint)
248 * Note that values will be retrieved from the database as a string.
250 public $is_pay_later;
253 * @var int|string|null
254 * (SQL type: int unsigned)
255 * Note that values will be retrieved from the database as a string.
257 public $contribution_status_id;
260 * Conditional foreign key to civicrm_address.id. We insert an address record for each contribution when we have associated billing name and address data.
262 * @var int|string|null
263 * (SQL type: int unsigned)
264 * Note that values will be retrieved from the database as a string.
270 * (SQL type: varchar(255))
271 * Note that values will be retrieved from the database as a string.
273 public $check_number;
276 * The campaign for which this contribution has been triggered.
278 * @var int|string|null
279 * (SQL type: int unsigned)
280 * Note that values will be retrieved from the database as a string.
285 * unique credit note id, system generated or passed in
288 * (SQL type: varchar(255))
289 * Note that values will be retrieved from the database as a string.
291 public $creditnote_id;
294 * Total tax amount of this contribution.
296 * @var float|string|null
297 * (SQL type: decimal(20,2))
298 * Note that values will be retrieved from the database as a string.
303 * Stores the date when revenue should be recognized.
306 * (SQL type: datetime)
307 * Note that values will be retrieved from the database as a string.
309 public $revenue_recognition_date;
312 * Shows this is a template for recurring contributions.
315 * (SQL type: tinyint)
316 * Note that values will be retrieved from the database as a string.
323 public function __construct() {
324 $this->__table
= 'civicrm_contribution';
325 parent
::__construct();
329 * Returns localized title of this entity.
331 * @param bool $plural
332 * Whether to return the plural version of the title.
334 public static function getEntityTitle($plural = FALSE) {
335 return $plural ?
ts('Contributions') : ts('Contribution');
339 * Returns user-friendly description of this entity.
343 public static function getEntityDescription() {
344 return ts('Financial records consisting of transactions, line-items, etc.');
348 * Returns foreign keys and entity references.
351 * [CRM_Core_Reference_Interface]
353 public static function getReferenceColumns() {
354 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
355 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
356 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
357 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
358 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contribution_page_id', 'civicrm_contribution_page', 'id');
359 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contribution_recur_id', 'civicrm_contribution_recur', 'id');
360 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'address_id', 'civicrm_address', 'id');
361 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
362 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
364 return Civi
::$statics[__CLASS__
]['links'];
368 * Returns all the column names of this table
372 public static function &fields() {
373 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
374 Civi
::$statics[__CLASS__
]['fields'] = [
375 'contribution_id' => [
377 'type' => CRM_Utils_Type
::T_INT
,
378 'title' => ts('Contribution ID'),
379 'description' => ts('Contribution ID'),
382 'where' => 'civicrm_contribution.id',
384 'table_name' => 'civicrm_contribution',
385 'entity' => 'Contribution',
386 'bao' => 'CRM_Contribute_BAO_Contribution',
394 'contribution_contact_id' => [
395 'name' => 'contact_id',
396 'type' => CRM_Utils_Type
::T_INT
,
397 'title' => ts('Contact ID'),
398 'description' => ts('FK to Contact ID'),
401 'where' => 'civicrm_contribution.contact_id',
402 'headerPattern' => '/contact(.?id)?/i',
403 'dataPattern' => '/^\d+$/',
405 'table_name' => 'civicrm_contribution',
406 'entity' => 'Contribution',
407 'bao' => 'CRM_Contribute_BAO_Contribution',
409 'FKClassName' => 'CRM_Contact_DAO_Contact',
411 'type' => 'EntityRef',
412 'label' => ts("Contact"),
416 'financial_type_id' => [
417 'name' => 'financial_type_id',
418 'type' => CRM_Utils_Type
::T_INT
,
419 'title' => ts('Financial Type ID'),
420 'description' => ts('FK to Financial Type for (total_amount - non_deductible_amount).'),
421 'where' => 'civicrm_contribution.financial_type_id',
423 'table_name' => 'civicrm_contribution',
424 'entity' => 'Contribution',
425 'bao' => 'CRM_Contribute_BAO_Contribution',
427 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
430 'label' => ts("Financial Type"),
432 'pseudoconstant' => [
433 'table' => 'civicrm_financial_type',
435 'labelColumn' => 'name',
439 'contribution_page_id' => [
440 'name' => 'contribution_page_id',
441 'type' => CRM_Utils_Type
::T_INT
,
442 'title' => ts('Contribution Page ID'),
443 'description' => ts('The Contribution Page which triggered this contribution'),
445 'where' => 'civicrm_contribution.contribution_page_id',
447 'table_name' => 'civicrm_contribution',
448 'entity' => 'Contribution',
449 'bao' => 'CRM_Contribute_BAO_Contribution',
451 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage',
454 'label' => ts("Contribution Page"),
456 'pseudoconstant' => [
457 'table' => 'civicrm_contribution_page',
459 'labelColumn' => 'title',
463 'payment_instrument_id' => [
464 'name' => 'payment_instrument_id',
465 'type' => CRM_Utils_Type
::T_INT
,
466 'title' => ts('Payment Method ID'),
467 'description' => ts('FK to Payment Instrument'),
468 'where' => 'civicrm_contribution.payment_instrument_id',
469 'headerPattern' => '/^payment|(p(ayment\s)?instrument)$/i',
471 'table_name' => 'civicrm_contribution',
472 'entity' => 'Contribution',
473 'bao' => 'CRM_Contribute_BAO_Contribution',
477 'label' => ts("Payment Method"),
479 'pseudoconstant' => [
480 'optionGroupName' => 'payment_instrument',
481 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
486 'name' => 'receive_date',
487 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
488 'title' => ts('Date Received'),
489 'description' => ts('Date contribution was received - not necessarily the creation date of the record'),
491 'where' => 'civicrm_contribution.receive_date',
492 'headerPattern' => '/receive(.?date)?/i',
493 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/',
495 'table_name' => 'civicrm_contribution',
496 'entity' => 'Contribution',
497 'bao' => 'CRM_Contribute_BAO_Contribution',
500 'type' => 'Select Date',
501 'formatType' => 'activityDateTime',
505 'non_deductible_amount' => [
506 'name' => 'non_deductible_amount',
507 'type' => CRM_Utils_Type
::T_MONEY
,
508 'title' => ts('Non-deductible Amount'),
509 'description' => ts('Portion of total amount which is NOT tax deductible. Equal to total_amount for non-deductible financial types.'),
515 'where' => 'civicrm_contribution.non_deductible_amount',
516 'headerPattern' => '/non?.?deduct/i',
517 'dataPattern' => '/^\d+(\.\d{2})?$/',
520 'table_name' => 'civicrm_contribution',
521 'entity' => 'Contribution',
522 'bao' => 'CRM_Contribute_BAO_Contribution',
530 'name' => 'total_amount',
531 'type' => CRM_Utils_Type
::T_MONEY
,
532 'title' => ts('Total Amount'),
533 'description' => ts('Total amount of this contribution. Use market value for non-monetary gifts.'),
540 'where' => 'civicrm_contribution.total_amount',
541 'headerPattern' => '/^total|(.?^am(ou)?nt)/i',
542 'dataPattern' => '/^\d+(\.\d{2})?$/',
544 'table_name' => 'civicrm_contribution',
545 'entity' => 'Contribution',
546 'bao' => 'CRM_Contribute_BAO_Contribution',
550 'label' => ts("Total Amount"),
555 'name' => 'fee_amount',
556 'type' => CRM_Utils_Type
::T_MONEY
,
557 'title' => ts('Fee Amount'),
558 'description' => ts('actual processor fee if known - may be 0.'),
564 'where' => 'civicrm_contribution.fee_amount',
565 'headerPattern' => '/fee(.?am(ou)?nt)?/i',
566 'dataPattern' => '/^\d+(\.\d{2})?$/',
568 'table_name' => 'civicrm_contribution',
569 'entity' => 'Contribution',
570 'bao' => 'CRM_Contribute_BAO_Contribution',
574 'label' => ts("Fee Amount"),
579 'name' => 'net_amount',
580 'type' => CRM_Utils_Type
::T_MONEY
,
581 'title' => ts('Net Amount'),
582 'description' => ts('actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.'),
588 'where' => 'civicrm_contribution.net_amount',
589 'headerPattern' => '/net(.?am(ou)?nt)?/i',
590 'dataPattern' => '/^\d+(\.\d{2})?$/',
592 'table_name' => 'civicrm_contribution',
593 'entity' => 'Contribution',
594 'bao' => 'CRM_Contribute_BAO_Contribution',
598 'label' => ts("Net Amount"),
604 'type' => CRM_Utils_Type
::T_STRING
,
605 'title' => ts('Transaction ID'),
606 'description' => ts('unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method'),
608 'size' => CRM_Utils_Type
::HUGE
,
610 'where' => 'civicrm_contribution.trxn_id',
611 'headerPattern' => '/tr(ansactio|x)n(.?id)?/i',
613 'table_name' => 'civicrm_contribution',
614 'entity' => 'Contribution',
615 'bao' => 'CRM_Contribute_BAO_Contribution',
624 'name' => 'invoice_id',
625 'type' => CRM_Utils_Type
::T_STRING
,
626 'title' => ts('Invoice Reference'),
627 'description' => ts('unique invoice id, system generated or passed in'),
629 'size' => CRM_Utils_Type
::HUGE
,
631 'where' => 'civicrm_contribution.invoice_id',
632 'headerPattern' => '/invoice(.?id)?/i',
634 'table_name' => 'civicrm_contribution',
635 'entity' => 'Contribution',
636 'bao' => 'CRM_Contribute_BAO_Contribution',
644 'invoice_number' => [
645 'name' => 'invoice_number',
646 'type' => CRM_Utils_Type
::T_STRING
,
647 'title' => ts('Invoice Number'),
648 'description' => ts('Human readable invoice number'),
650 'size' => CRM_Utils_Type
::HUGE
,
652 'where' => 'civicrm_contribution.invoice_number',
653 'headerPattern' => '/invoice(.?number)?/i',
655 'table_name' => 'civicrm_contribution',
656 'entity' => 'Contribution',
657 'bao' => 'CRM_Contribute_BAO_Contribution',
665 'name' => 'currency',
666 'type' => CRM_Utils_Type
::T_STRING
,
667 'title' => ts('Currency'),
668 'description' => ts('3 character string, value from config setting or input via user.'),
670 'size' => CRM_Utils_Type
::FOUR
,
672 'where' => 'civicrm_contribution.currency',
673 'headerPattern' => '/cur(rency)?/i',
674 'dataPattern' => '/^[A-Z]{3}$/i',
677 'table_name' => 'civicrm_contribution',
678 'entity' => 'Contribution',
679 'bao' => 'CRM_Contribute_BAO_Contribution',
683 'label' => ts("Currency"),
685 'pseudoconstant' => [
686 'table' => 'civicrm_currency',
687 'keyColumn' => 'name',
688 'labelColumn' => 'full_name',
689 'nameColumn' => 'name',
690 'abbrColumn' => 'symbol',
694 'contribution_cancel_date' => [
695 'name' => 'cancel_date',
696 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
697 'title' => ts('Cancelled / Refunded Date'),
698 'description' => ts('when was gift cancelled'),
700 'where' => 'civicrm_contribution.cancel_date',
701 'headerPattern' => '/cancel(.?date)?/i',
702 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/',
704 'table_name' => 'civicrm_contribution',
705 'entity' => 'Contribution',
706 'bao' => 'CRM_Contribute_BAO_Contribution',
709 'type' => 'Select Date',
710 'formatType' => 'activityDateTime',
715 'name' => 'cancel_reason',
716 'type' => CRM_Utils_Type
::T_TEXT
,
717 'title' => ts('Cancellation / Refund Reason'),
719 'where' => 'civicrm_contribution.cancel_reason',
720 'headerPattern' => '/(cancel.?)?reason/i',
722 'table_name' => 'civicrm_contribution',
723 'entity' => 'Contribution',
724 'bao' => 'CRM_Contribute_BAO_Contribution',
732 'name' => 'receipt_date',
733 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
734 'title' => ts('Receipt Date'),
735 'description' => ts('when (if) receipt was sent. populated automatically for online donations w/ automatic receipting'),
737 'where' => 'civicrm_contribution.receipt_date',
738 'headerPattern' => '/receipt(.?date)?/i',
739 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/',
741 'table_name' => 'civicrm_contribution',
742 'entity' => 'Contribution',
743 'bao' => 'CRM_Contribute_BAO_Contribution',
746 'type' => 'Select Date',
747 'formatType' => 'activityDateTime',
748 'label' => ts("Receipt Date"),
753 'name' => 'thankyou_date',
754 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
755 'title' => ts('Thank-you Date'),
756 'description' => ts('when (if) was donor thanked'),
758 'where' => 'civicrm_contribution.thankyou_date',
759 'headerPattern' => '/thank(s|(.?you))?(.?date)?/i',
760 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/',
762 'table_name' => 'civicrm_contribution',
763 'entity' => 'Contribution',
764 'bao' => 'CRM_Contribute_BAO_Contribution',
767 'type' => 'Select Date',
768 'formatType' => 'activityDateTime',
772 'contribution_source' => [
774 'type' => CRM_Utils_Type
::T_STRING
,
775 'title' => ts('Contribution Source'),
776 'description' => ts('Origin of this Contribution.'),
778 'size' => CRM_Utils_Type
::HUGE
,
780 'where' => 'civicrm_contribution.source',
781 'headerPattern' => '/source/i',
783 'table_name' => 'civicrm_contribution',
784 'entity' => 'Contribution',
785 'bao' => 'CRM_Contribute_BAO_Contribution',
793 'name' => 'amount_level',
794 'type' => CRM_Utils_Type
::T_TEXT
,
795 'title' => ts('Amount Label'),
797 'where' => 'civicrm_contribution.amount_level',
799 'table_name' => 'civicrm_contribution',
800 'entity' => 'Contribution',
801 'bao' => 'CRM_Contribute_BAO_Contribution',
808 'contribution_recur_id' => [
809 'name' => 'contribution_recur_id',
810 'type' => CRM_Utils_Type
::T_INT
,
811 'title' => ts('Recurring Contribution ID'),
812 'description' => ts('Conditional foreign key to civicrm_contribution_recur id. Each contribution made in connection with a recurring contribution carries a foreign key to the recurring contribution record. This assumes we can track these processor initiated events.'),
813 'where' => 'civicrm_contribution.contribution_recur_id',
815 'table_name' => 'civicrm_contribution',
816 'entity' => 'Contribution',
817 'bao' => 'CRM_Contribute_BAO_Contribution',
819 'FKClassName' => 'CRM_Contribute_DAO_ContributionRecur',
821 'label' => ts("Recurring Contribution"),
828 'type' => CRM_Utils_Type
::T_BOOLEAN
,
829 'title' => ts('Test'),
832 'where' => 'civicrm_contribution.is_test',
835 'table_name' => 'civicrm_contribution',
836 'entity' => 'Contribution',
837 'bao' => 'CRM_Contribute_BAO_Contribution',
840 'type' => 'CheckBox',
845 'name' => 'is_pay_later',
846 'type' => CRM_Utils_Type
::T_BOOLEAN
,
847 'title' => ts('Is Pay Later'),
850 'where' => 'civicrm_contribution.is_pay_later',
853 'table_name' => 'civicrm_contribution',
854 'entity' => 'Contribution',
855 'bao' => 'CRM_Contribute_BAO_Contribution',
858 'type' => 'CheckBox',
862 'contribution_status_id' => [
863 'name' => 'contribution_status_id',
864 'type' => CRM_Utils_Type
::T_INT
,
865 'title' => ts('Contribution Status ID'),
867 'where' => 'civicrm_contribution.contribution_status_id',
868 'headerPattern' => '/status/i',
871 'table_name' => 'civicrm_contribution',
872 'entity' => 'Contribution',
873 'bao' => 'CRM_Contribute_BAO_Contribution',
877 'label' => ts("Contribution Status"),
879 'pseudoconstant' => [
880 'optionGroupName' => 'contribution_status',
881 'optionEditPath' => 'civicrm/admin/options/contribution_status',
885 'contribution_address_id' => [
886 'name' => 'address_id',
887 'type' => CRM_Utils_Type
::T_INT
,
888 'title' => ts('Address ID'),
889 'description' => ts('Conditional foreign key to civicrm_address.id. We insert an address record for each contribution when we have associated billing name and address data.'),
890 'where' => 'civicrm_contribution.address_id',
892 'table_name' => 'civicrm_contribution',
893 'entity' => 'Contribution',
894 'bao' => 'CRM_Contribute_BAO_Contribution',
896 'FKClassName' => 'CRM_Core_DAO_Address',
898 'label' => ts("Address"),
902 'contribution_check_number' => [
903 'name' => 'check_number',
904 'type' => CRM_Utils_Type
::T_STRING
,
905 'title' => ts('Check Number'),
909 'where' => 'civicrm_contribution.check_number',
910 'headerPattern' => '/check(.?number)?/i',
912 'table_name' => 'civicrm_contribution',
913 'entity' => 'Contribution',
914 'bao' => 'CRM_Contribute_BAO_Contribution',
921 'contribution_campaign_id' => [
922 'name' => 'campaign_id',
923 'type' => CRM_Utils_Type
::T_INT
,
924 'title' => ts('Campaign ID'),
925 'description' => ts('The campaign for which this contribution has been triggered.'),
927 'where' => 'civicrm_contribution.campaign_id',
929 'table_name' => 'civicrm_contribution',
930 'entity' => 'Contribution',
931 'bao' => 'CRM_Contribute_BAO_Contribution',
933 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
934 'component' => 'CiviCampaign',
936 'type' => 'EntityRef',
937 'label' => ts("Campaign"),
939 'pseudoconstant' => [
940 'table' => 'civicrm_campaign',
942 'labelColumn' => 'title',
943 'prefetch' => 'FALSE',
948 'name' => 'creditnote_id',
949 'type' => CRM_Utils_Type
::T_STRING
,
950 'title' => ts('Credit Note ID'),
951 'description' => ts('unique credit note id, system generated or passed in'),
953 'size' => CRM_Utils_Type
::HUGE
,
955 'where' => 'civicrm_contribution.creditnote_id',
956 'headerPattern' => '/creditnote(.?id)?/i',
958 'table_name' => 'civicrm_contribution',
959 'entity' => 'Contribution',
960 'bao' => 'CRM_Contribute_BAO_Contribution',
968 'name' => 'tax_amount',
969 'type' => CRM_Utils_Type
::T_MONEY
,
970 'title' => ts('Tax Amount'),
971 'description' => ts('Total tax amount of this contribution.'),
977 'where' => 'civicrm_contribution.tax_amount',
978 'headerPattern' => '/tax(.?am(ou)?nt)?/i',
979 'dataPattern' => '/^\d+(\.\d{2})?$/',
981 'table_name' => 'civicrm_contribution',
982 'entity' => 'Contribution',
983 'bao' => 'CRM_Contribute_BAO_Contribution',
990 'revenue_recognition_date' => [
991 'name' => 'revenue_recognition_date',
992 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
993 'title' => ts('Revenue Recognition Date'),
994 'description' => ts('Stores the date when revenue should be recognized.'),
996 'where' => 'civicrm_contribution.revenue_recognition_date',
997 'headerPattern' => '/revenue(.?date)?/i',
998 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/',
1000 'table_name' => 'civicrm_contribution',
1001 'entity' => 'Contribution',
1002 'bao' => 'CRM_Contribute_BAO_Contribution',
1005 'type' => 'Select Date',
1006 'formatType' => 'activityDateTime',
1007 'label' => ts("Revenue Recognition Date"),
1012 'name' => 'is_template',
1013 'type' => CRM_Utils_Type
::T_BOOLEAN
,
1014 'title' => ts('Is a Template Contribution'),
1015 'description' => ts('Shows this is a template for recurring contributions.'),
1018 'where' => 'civicrm_contribution.is_template',
1021 'table_name' => 'civicrm_contribution',
1022 'entity' => 'Contribution',
1023 'bao' => 'CRM_Contribute_BAO_Contribution',
1026 'type' => 'CheckBox',
1032 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
1034 return Civi
::$statics[__CLASS__
]['fields'];
1038 * Return a mapping from field-name to the corresponding key (as used in fields()).
1041 * Array(string $name => string $uniqueName).
1043 public static function &fieldKeys() {
1044 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
1045 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
1047 return Civi
::$statics[__CLASS__
]['fieldKeys'];
1051 * Returns the names of this table
1055 public static function getTableName() {
1056 return self
::$_tableName;
1060 * Returns if this table needs to be logged
1064 public function getLog() {
1069 * Returns the list of fields that can be imported
1071 * @param bool $prefix
1075 public static function &import($prefix = FALSE) {
1076 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contribution', $prefix, []);
1081 * Returns the list of fields that can be exported
1083 * @param bool $prefix
1087 public static function &export($prefix = FALSE) {
1088 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contribution', $prefix, []);
1093 * Returns the list of indices
1095 * @param bool $localize
1099 public static function indices($localize = TRUE) {
1101 'UI_contrib_payment_instrument_id' => [
1102 'name' => 'UI_contrib_payment_instrument_id',
1104 0 => 'payment_instrument_id',
1106 'localizable' => FALSE,
1107 'sig' => 'civicrm_contribution::0::payment_instrument_id',
1109 'index_total_amount_receive_date' => [
1110 'name' => 'index_total_amount_receive_date',
1112 0 => 'total_amount',
1113 1 => 'receive_date',
1115 'localizable' => FALSE,
1116 'sig' => 'civicrm_contribution::0::total_amount::receive_date',
1119 'name' => 'index_source',
1123 'localizable' => FALSE,
1124 'sig' => 'civicrm_contribution::0::source',
1126 'UI_contrib_trxn_id' => [
1127 'name' => 'UI_contrib_trxn_id',
1131 'localizable' => FALSE,
1133 'sig' => 'civicrm_contribution::1::trxn_id',
1135 'UI_contrib_invoice_id' => [
1136 'name' => 'UI_contrib_invoice_id',
1140 'localizable' => FALSE,
1142 'sig' => 'civicrm_contribution::1::invoice_id',
1144 'index_contribution_status' => [
1145 'name' => 'index_contribution_status',
1147 0 => 'contribution_status_id',
1149 'localizable' => FALSE,
1150 'sig' => 'civicrm_contribution::0::contribution_status_id',
1152 'received_date' => [
1153 'name' => 'received_date',
1155 0 => 'receive_date',
1157 'localizable' => FALSE,
1158 'sig' => 'civicrm_contribution::0::receive_date',
1161 'name' => 'check_number',
1163 0 => 'check_number',
1165 'localizable' => FALSE,
1166 'sig' => 'civicrm_contribution::0::check_number',
1168 'index_creditnote_id' => [
1169 'name' => 'index_creditnote_id',
1171 0 => 'creditnote_id',
1173 'localizable' => FALSE,
1174 'sig' => 'civicrm_contribution::0::creditnote_id',
1177 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;