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:b14fa847767daf3723033f41dbca9612)
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]',
68 * FK to Financial Type for (total_amount - non_deductible_amount).
72 public $financial_type_id;
75 * The Contribution Page which triggered this contribution
79 public $contribution_page_id;
82 * FK to Payment Instrument
86 public $payment_instrument_id;
89 * Date contribution was received - not necessarily the creation date of the record
96 * Portion of total amount which is NOT tax deductible. Equal to total_amount for non-deductible financial types.
100 public $non_deductible_amount;
103 * Total amount of this contribution. Use market value for non-monetary gifts.
107 public $total_amount;
110 * actual processor fee if known - may be 0.
117 * actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.
124 * unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method
131 * unique invoice id, system generated or passed in
138 * Human readable invoice number
142 public $invoice_number;
145 * 3 character string, value from config setting or input via user.
152 * when was gift cancelled
161 public $cancel_reason;
164 * when (if) receipt was sent. populated automatically for online donations w/ automatic receipting
168 public $receipt_date;
171 * when (if) was donor thanked
175 public $thankyou_date;
178 * Origin of this Contribution.
187 public $amount_level;
190 * 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.
194 public $contribution_recur_id;
204 public $is_pay_later;
209 public $contribution_status_id;
212 * Conditional foreign key to civicrm_address.id. We insert an address record for each contribution when we have associated billing name and address data.
221 public $check_number;
224 * The campaign for which this contribution has been triggered.
231 * unique credit note id, system generated or passed in
235 public $creditnote_id;
238 * Total tax amount of this contribution.
245 * Stores the date when revenue should be recognized.
249 public $revenue_recognition_date;
252 * Shows this is a template for recurring contributions.
261 public function __construct() {
262 $this->__table
= 'civicrm_contribution';
263 parent
::__construct();
267 * Returns localized title of this entity.
269 * @param bool $plural
270 * Whether to return the plural version of the title.
272 public static function getEntityTitle($plural = FALSE) {
273 return $plural ?
ts('Contributions') : ts('Contribution');
277 * Returns user-friendly description of this entity.
281 public static function getEntityDescription() {
282 return ts('Financial records consisting of transactions, line-items, etc.');
286 * Returns foreign keys and entity references.
289 * [CRM_Core_Reference_Interface]
291 public static function getReferenceColumns() {
292 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
293 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
294 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
295 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
296 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contribution_page_id', 'civicrm_contribution_page', 'id');
297 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contribution_recur_id', 'civicrm_contribution_recur', 'id');
298 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'address_id', 'civicrm_address', 'id');
299 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
300 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
302 return Civi
::$statics[__CLASS__
]['links'];
306 * Returns all the column names of this table
310 public static function &fields() {
311 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
312 Civi
::$statics[__CLASS__
]['fields'] = [
313 'contribution_id' => [
315 'type' => CRM_Utils_Type
::T_INT
,
316 'title' => ts('Contribution ID'),
317 'description' => ts('Contribution ID'),
320 'where' => 'civicrm_contribution.id',
322 'table_name' => 'civicrm_contribution',
323 'entity' => 'Contribution',
324 'bao' => 'CRM_Contribute_BAO_Contribution',
332 'contribution_contact_id' => [
333 'name' => 'contact_id',
334 'type' => CRM_Utils_Type
::T_INT
,
335 'title' => ts('Contact ID'),
336 'description' => ts('FK to Contact ID'),
339 'where' => 'civicrm_contribution.contact_id',
340 'headerPattern' => '/contact(.?id)?/i',
341 'dataPattern' => '/^\d+$/',
343 'table_name' => 'civicrm_contribution',
344 'entity' => 'Contribution',
345 'bao' => 'CRM_Contribute_BAO_Contribution',
347 'FKClassName' => 'CRM_Contact_DAO_Contact',
349 'type' => 'EntityRef',
350 'label' => ts("Contact"),
354 'financial_type_id' => [
355 'name' => 'financial_type_id',
356 'type' => CRM_Utils_Type
::T_INT
,
357 'title' => ts('Financial Type ID'),
358 'description' => ts('FK to Financial Type for (total_amount - non_deductible_amount).'),
359 'where' => 'civicrm_contribution.financial_type_id',
361 'table_name' => 'civicrm_contribution',
362 'entity' => 'Contribution',
363 'bao' => 'CRM_Contribute_BAO_Contribution',
365 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
368 'label' => ts("Financial Type"),
370 'pseudoconstant' => [
371 'table' => 'civicrm_financial_type',
373 'labelColumn' => 'name',
377 'contribution_page_id' => [
378 'name' => 'contribution_page_id',
379 'type' => CRM_Utils_Type
::T_INT
,
380 'title' => ts('Contribution Page ID'),
381 'description' => ts('The Contribution Page which triggered this contribution'),
383 'where' => 'civicrm_contribution.contribution_page_id',
385 'table_name' => 'civicrm_contribution',
386 'entity' => 'Contribution',
387 'bao' => 'CRM_Contribute_BAO_Contribution',
389 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage',
392 'label' => ts("Contribution Page"),
394 'pseudoconstant' => [
395 'table' => 'civicrm_contribution_page',
397 'labelColumn' => 'title',
401 'payment_instrument_id' => [
402 'name' => 'payment_instrument_id',
403 'type' => CRM_Utils_Type
::T_INT
,
404 'title' => ts('Payment Method ID'),
405 'description' => ts('FK to Payment Instrument'),
406 'where' => 'civicrm_contribution.payment_instrument_id',
407 'headerPattern' => '/^payment|(p(ayment\s)?instrument)$/i',
409 'table_name' => 'civicrm_contribution',
410 'entity' => 'Contribution',
411 'bao' => 'CRM_Contribute_BAO_Contribution',
415 'label' => ts("Payment Method"),
417 'pseudoconstant' => [
418 'optionGroupName' => 'payment_instrument',
419 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
424 'name' => 'receive_date',
425 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
426 'title' => ts('Date Received'),
427 'description' => ts('Date contribution was received - not necessarily the creation date of the record'),
429 'where' => 'civicrm_contribution.receive_date',
430 'headerPattern' => '/receive(.?date)?/i',
431 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/',
433 'table_name' => 'civicrm_contribution',
434 'entity' => 'Contribution',
435 'bao' => 'CRM_Contribute_BAO_Contribution',
438 'type' => 'Select Date',
439 'formatType' => 'activityDateTime',
443 'non_deductible_amount' => [
444 'name' => 'non_deductible_amount',
445 'type' => CRM_Utils_Type
::T_MONEY
,
446 'title' => ts('Non-deductible Amount'),
447 'description' => ts('Portion of total amount which is NOT tax deductible. Equal to total_amount for non-deductible financial types.'),
453 'where' => 'civicrm_contribution.non_deductible_amount',
454 'headerPattern' => '/non?.?deduct/i',
455 'dataPattern' => '/^\d+(\.\d{2})?$/',
458 'table_name' => 'civicrm_contribution',
459 'entity' => 'Contribution',
460 'bao' => 'CRM_Contribute_BAO_Contribution',
468 'name' => 'total_amount',
469 'type' => CRM_Utils_Type
::T_MONEY
,
470 'title' => ts('Total Amount'),
471 'description' => ts('Total amount of this contribution. Use market value for non-monetary gifts.'),
478 'where' => 'civicrm_contribution.total_amount',
479 'headerPattern' => '/^total|(.?^am(ou)?nt)/i',
480 'dataPattern' => '/^\d+(\.\d{2})?$/',
482 'table_name' => 'civicrm_contribution',
483 'entity' => 'Contribution',
484 'bao' => 'CRM_Contribute_BAO_Contribution',
488 'label' => ts("Total Amount"),
493 'name' => 'fee_amount',
494 'type' => CRM_Utils_Type
::T_MONEY
,
495 'title' => ts('Fee Amount'),
496 'description' => ts('actual processor fee if known - may be 0.'),
502 'where' => 'civicrm_contribution.fee_amount',
503 'headerPattern' => '/fee(.?am(ou)?nt)?/i',
504 'dataPattern' => '/^\d+(\.\d{2})?$/',
506 'table_name' => 'civicrm_contribution',
507 'entity' => 'Contribution',
508 'bao' => 'CRM_Contribute_BAO_Contribution',
512 'label' => ts("Fee Amount"),
517 'name' => 'net_amount',
518 'type' => CRM_Utils_Type
::T_MONEY
,
519 'title' => ts('Net Amount'),
520 'description' => ts('actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.'),
526 'where' => 'civicrm_contribution.net_amount',
527 'headerPattern' => '/net(.?am(ou)?nt)?/i',
528 'dataPattern' => '/^\d+(\.\d{2})?$/',
530 'table_name' => 'civicrm_contribution',
531 'entity' => 'Contribution',
532 'bao' => 'CRM_Contribute_BAO_Contribution',
536 'label' => ts("Net Amount"),
542 'type' => CRM_Utils_Type
::T_STRING
,
543 'title' => ts('Transaction ID'),
544 'description' => ts('unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method'),
546 'size' => CRM_Utils_Type
::HUGE
,
548 'where' => 'civicrm_contribution.trxn_id',
549 'headerPattern' => '/tr(ansactio|x)n(.?id)?/i',
551 'table_name' => 'civicrm_contribution',
552 'entity' => 'Contribution',
553 'bao' => 'CRM_Contribute_BAO_Contribution',
562 'name' => 'invoice_id',
563 'type' => CRM_Utils_Type
::T_STRING
,
564 'title' => ts('Invoice Reference'),
565 'description' => ts('unique invoice id, system generated or passed in'),
567 'size' => CRM_Utils_Type
::HUGE
,
569 'where' => 'civicrm_contribution.invoice_id',
570 'headerPattern' => '/invoice(.?id)?/i',
572 'table_name' => 'civicrm_contribution',
573 'entity' => 'Contribution',
574 'bao' => 'CRM_Contribute_BAO_Contribution',
582 'invoice_number' => [
583 'name' => 'invoice_number',
584 'type' => CRM_Utils_Type
::T_STRING
,
585 'title' => ts('Invoice Number'),
586 'description' => ts('Human readable invoice number'),
588 'size' => CRM_Utils_Type
::HUGE
,
590 'where' => 'civicrm_contribution.invoice_number',
591 'headerPattern' => '/invoice(.?number)?/i',
593 'table_name' => 'civicrm_contribution',
594 'entity' => 'Contribution',
595 'bao' => 'CRM_Contribute_BAO_Contribution',
603 'name' => 'currency',
604 'type' => CRM_Utils_Type
::T_STRING
,
605 'title' => ts('Currency'),
606 'description' => ts('3 character string, value from config setting or input via user.'),
608 'size' => CRM_Utils_Type
::FOUR
,
610 'where' => 'civicrm_contribution.currency',
611 'headerPattern' => '/cur(rency)?/i',
612 'dataPattern' => '/^[A-Z]{3}$/i',
615 'table_name' => 'civicrm_contribution',
616 'entity' => 'Contribution',
617 'bao' => 'CRM_Contribute_BAO_Contribution',
621 'label' => ts("Currency"),
623 'pseudoconstant' => [
624 'table' => 'civicrm_currency',
625 'keyColumn' => 'name',
626 'labelColumn' => 'full_name',
627 'nameColumn' => 'name',
628 'abbrColumn' => 'symbol',
632 'contribution_cancel_date' => [
633 'name' => 'cancel_date',
634 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
635 'title' => ts('Cancelled / Refunded Date'),
636 'description' => ts('when was gift cancelled'),
638 'where' => 'civicrm_contribution.cancel_date',
639 'headerPattern' => '/cancel(.?date)?/i',
640 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/',
642 'table_name' => 'civicrm_contribution',
643 'entity' => 'Contribution',
644 'bao' => 'CRM_Contribute_BAO_Contribution',
647 'type' => 'Select Date',
648 'formatType' => 'activityDateTime',
653 'name' => 'cancel_reason',
654 'type' => CRM_Utils_Type
::T_TEXT
,
655 'title' => ts('Cancellation / Refund Reason'),
657 'where' => 'civicrm_contribution.cancel_reason',
658 'headerPattern' => '/(cancel.?)?reason/i',
660 'table_name' => 'civicrm_contribution',
661 'entity' => 'Contribution',
662 'bao' => 'CRM_Contribute_BAO_Contribution',
670 'name' => 'receipt_date',
671 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
672 'title' => ts('Receipt Date'),
673 'description' => ts('when (if) receipt was sent. populated automatically for online donations w/ automatic receipting'),
675 'where' => 'civicrm_contribution.receipt_date',
676 'headerPattern' => '/receipt(.?date)?/i',
677 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/',
679 'table_name' => 'civicrm_contribution',
680 'entity' => 'Contribution',
681 'bao' => 'CRM_Contribute_BAO_Contribution',
684 'type' => 'Select Date',
685 'formatType' => 'activityDateTime',
686 'label' => ts("Receipt Date"),
691 'name' => 'thankyou_date',
692 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
693 'title' => ts('Thank-you Date'),
694 'description' => ts('when (if) was donor thanked'),
696 'where' => 'civicrm_contribution.thankyou_date',
697 'headerPattern' => '/thank(s|(.?you))?(.?date)?/i',
698 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/',
700 'table_name' => 'civicrm_contribution',
701 'entity' => 'Contribution',
702 'bao' => 'CRM_Contribute_BAO_Contribution',
705 'type' => 'Select Date',
706 'formatType' => 'activityDateTime',
710 'contribution_source' => [
712 'type' => CRM_Utils_Type
::T_STRING
,
713 'title' => ts('Contribution Source'),
714 'description' => ts('Origin of this Contribution.'),
716 'size' => CRM_Utils_Type
::HUGE
,
718 'where' => 'civicrm_contribution.source',
719 'headerPattern' => '/source/i',
721 'table_name' => 'civicrm_contribution',
722 'entity' => 'Contribution',
723 'bao' => 'CRM_Contribute_BAO_Contribution',
731 'name' => 'amount_level',
732 'type' => CRM_Utils_Type
::T_TEXT
,
733 'title' => ts('Amount Label'),
735 'where' => 'civicrm_contribution.amount_level',
737 'table_name' => 'civicrm_contribution',
738 'entity' => 'Contribution',
739 'bao' => 'CRM_Contribute_BAO_Contribution',
746 'contribution_recur_id' => [
747 'name' => 'contribution_recur_id',
748 'type' => CRM_Utils_Type
::T_INT
,
749 'title' => ts('Recurring Contribution ID'),
750 '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.'),
751 'where' => 'civicrm_contribution.contribution_recur_id',
753 'table_name' => 'civicrm_contribution',
754 'entity' => 'Contribution',
755 'bao' => 'CRM_Contribute_BAO_Contribution',
757 'FKClassName' => 'CRM_Contribute_DAO_ContributionRecur',
759 'label' => ts("Recurring Contribution"),
766 'type' => CRM_Utils_Type
::T_BOOLEAN
,
767 'title' => ts('Test'),
769 'where' => 'civicrm_contribution.is_test',
772 'table_name' => 'civicrm_contribution',
773 'entity' => 'Contribution',
774 'bao' => 'CRM_Contribute_BAO_Contribution',
777 'type' => 'CheckBox',
782 'name' => 'is_pay_later',
783 'type' => CRM_Utils_Type
::T_BOOLEAN
,
784 'title' => ts('Is Pay Later'),
786 'where' => 'civicrm_contribution.is_pay_later',
789 'table_name' => 'civicrm_contribution',
790 'entity' => 'Contribution',
791 'bao' => 'CRM_Contribute_BAO_Contribution',
794 'type' => 'CheckBox',
798 'contribution_status_id' => [
799 'name' => 'contribution_status_id',
800 'type' => CRM_Utils_Type
::T_INT
,
801 'title' => ts('Contribution Status ID'),
803 'where' => 'civicrm_contribution.contribution_status_id',
804 'headerPattern' => '/status/i',
807 'table_name' => 'civicrm_contribution',
808 'entity' => 'Contribution',
809 'bao' => 'CRM_Contribute_BAO_Contribution',
813 'label' => ts("Contribution Status"),
815 'pseudoconstant' => [
816 'optionGroupName' => 'contribution_status',
817 'optionEditPath' => 'civicrm/admin/options/contribution_status',
821 'contribution_address_id' => [
822 'name' => 'address_id',
823 'type' => CRM_Utils_Type
::T_INT
,
824 'title' => ts('Address ID'),
825 '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.'),
826 'where' => 'civicrm_contribution.address_id',
828 'table_name' => 'civicrm_contribution',
829 'entity' => 'Contribution',
830 'bao' => 'CRM_Contribute_BAO_Contribution',
832 'FKClassName' => 'CRM_Core_DAO_Address',
834 'label' => ts("Address"),
838 'contribution_check_number' => [
839 'name' => 'check_number',
840 'type' => CRM_Utils_Type
::T_STRING
,
841 'title' => ts('Check Number'),
845 'where' => 'civicrm_contribution.check_number',
846 'headerPattern' => '/check(.?number)?/i',
848 'table_name' => 'civicrm_contribution',
849 'entity' => 'Contribution',
850 'bao' => 'CRM_Contribute_BAO_Contribution',
857 'contribution_campaign_id' => [
858 'name' => 'campaign_id',
859 'type' => CRM_Utils_Type
::T_INT
,
860 'title' => ts('Campaign ID'),
861 'description' => ts('The campaign for which this contribution has been triggered.'),
863 'where' => 'civicrm_contribution.campaign_id',
865 'table_name' => 'civicrm_contribution',
866 'entity' => 'Contribution',
867 'bao' => 'CRM_Contribute_BAO_Contribution',
869 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
870 'component' => 'CiviCampaign',
872 'type' => 'EntityRef',
873 'label' => ts("Campaign"),
875 'pseudoconstant' => [
876 'table' => 'civicrm_campaign',
878 'labelColumn' => 'title',
879 'prefetch' => 'FALSE',
884 'name' => 'creditnote_id',
885 'type' => CRM_Utils_Type
::T_STRING
,
886 'title' => ts('Credit Note ID'),
887 'description' => ts('unique credit note id, system generated or passed in'),
889 'size' => CRM_Utils_Type
::HUGE
,
891 'where' => 'civicrm_contribution.creditnote_id',
892 'headerPattern' => '/creditnote(.?id)?/i',
894 'table_name' => 'civicrm_contribution',
895 'entity' => 'Contribution',
896 'bao' => 'CRM_Contribute_BAO_Contribution',
904 'name' => 'tax_amount',
905 'type' => CRM_Utils_Type
::T_MONEY
,
906 'title' => ts('Tax Amount'),
907 'description' => ts('Total tax amount of this contribution.'),
913 'where' => 'civicrm_contribution.tax_amount',
914 'headerPattern' => '/tax(.?am(ou)?nt)?/i',
915 'dataPattern' => '/^\d+(\.\d{2})?$/',
917 'table_name' => 'civicrm_contribution',
918 'entity' => 'Contribution',
919 'bao' => 'CRM_Contribute_BAO_Contribution',
926 'revenue_recognition_date' => [
927 'name' => 'revenue_recognition_date',
928 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
929 'title' => ts('Revenue Recognition Date'),
930 'description' => ts('Stores the date when revenue should be recognized.'),
932 'where' => 'civicrm_contribution.revenue_recognition_date',
933 'headerPattern' => '/revenue(.?date)?/i',
934 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/',
936 'table_name' => 'civicrm_contribution',
937 'entity' => 'Contribution',
938 'bao' => 'CRM_Contribute_BAO_Contribution',
941 'type' => 'Select Date',
942 'formatType' => 'activityDateTime',
943 'label' => ts("Revenue Recognition Date"),
948 'name' => 'is_template',
949 'type' => CRM_Utils_Type
::T_BOOLEAN
,
950 'title' => ts('Is a Template Contribution'),
951 'description' => ts('Shows this is a template for recurring contributions.'),
953 'where' => 'civicrm_contribution.is_template',
956 'table_name' => 'civicrm_contribution',
957 'entity' => 'Contribution',
958 'bao' => 'CRM_Contribute_BAO_Contribution',
961 'type' => 'CheckBox',
967 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
969 return Civi
::$statics[__CLASS__
]['fields'];
973 * Return a mapping from field-name to the corresponding key (as used in fields()).
976 * Array(string $name => string $uniqueName).
978 public static function &fieldKeys() {
979 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
980 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
982 return Civi
::$statics[__CLASS__
]['fieldKeys'];
986 * Returns the names of this table
990 public static function getTableName() {
991 return self
::$_tableName;
995 * Returns if this table needs to be logged
999 public function getLog() {
1004 * Returns the list of fields that can be imported
1006 * @param bool $prefix
1010 public static function &import($prefix = FALSE) {
1011 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contribution', $prefix, []);
1016 * Returns the list of fields that can be exported
1018 * @param bool $prefix
1022 public static function &export($prefix = FALSE) {
1023 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contribution', $prefix, []);
1028 * Returns the list of indices
1030 * @param bool $localize
1034 public static function indices($localize = TRUE) {
1036 'UI_contrib_payment_instrument_id' => [
1037 'name' => 'UI_contrib_payment_instrument_id',
1039 0 => 'payment_instrument_id',
1041 'localizable' => FALSE,
1042 'sig' => 'civicrm_contribution::0::payment_instrument_id',
1044 'index_total_amount_receive_date' => [
1045 'name' => 'index_total_amount_receive_date',
1047 0 => 'total_amount',
1048 1 => 'receive_date',
1050 'localizable' => FALSE,
1051 'sig' => 'civicrm_contribution::0::total_amount::receive_date',
1054 'name' => 'index_source',
1058 'localizable' => FALSE,
1059 'sig' => 'civicrm_contribution::0::source',
1061 'UI_contrib_trxn_id' => [
1062 'name' => 'UI_contrib_trxn_id',
1066 'localizable' => FALSE,
1068 'sig' => 'civicrm_contribution::1::trxn_id',
1070 'UI_contrib_invoice_id' => [
1071 'name' => 'UI_contrib_invoice_id',
1075 'localizable' => FALSE,
1077 'sig' => 'civicrm_contribution::1::invoice_id',
1079 'index_contribution_status' => [
1080 'name' => 'index_contribution_status',
1082 0 => 'contribution_status_id',
1084 'localizable' => FALSE,
1085 'sig' => 'civicrm_contribution::0::contribution_status_id',
1087 'received_date' => [
1088 'name' => 'received_date',
1090 0 => 'receive_date',
1092 'localizable' => FALSE,
1093 'sig' => 'civicrm_contribution::0::receive_date',
1096 'name' => 'check_number',
1098 0 => 'check_number',
1100 'localizable' => FALSE,
1101 'sig' => 'civicrm_contribution::0::check_number',
1103 'index_creditnote_id' => [
1104 'name' => 'index_creditnote_id',
1106 0 => 'creditnote_id',
1108 'localizable' => FALSE,
1109 'sig' => 'civicrm_contribution::0::creditnote_id',
1112 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;