Merge pull request #20251 from larssandergreen/change-registration-button-text
[civicrm-core.git] / CRM / Contribute / DAO / Contribution.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Contribute/Contribution.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
28979d65 9 * (GenCodeChecksum:204947e70942c2db4fb9b84398818aa1)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Contribution entity.
f41f0342 14 */
e501603b 15class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.3';
d31fb4e3 18 const COMPONENT = 'CiviContribute';
c3fc2621 19
e501603b 20 /**
f41f0342 21 * Static instance to hold the table name.
e501603b
TO
22 *
23 * @var string
24 */
fa45b5b9 25 public static $_tableName = 'civicrm_contribution';
c3fc2621 26
449c4e6b
CW
27 /**
28 * Icon associated with this entity.
29 *
30 * @var string
31 */
32 public static $_icon = 'fa-credit-card';
33
e501603b 34 /**
f41f0342 35 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 36 *
c3fc2621 37 * @var bool
e501603b 38 */
fa45b5b9 39 public static $_log = TRUE;
c3fc2621 40
a7bd99ff
CW
41 /**
42 * Paths for accessing this entity in the UI.
43 *
44 * @var string[]
45 */
46 protected static $_paths = [
5c385299 47 'add' => 'civicrm/contribute/add?reset=1&action=add&context=standalone',
a7bd99ff 48 'view' => 'civicrm/contact/view/contribution?reset=1&action=view&id=[id]',
5c385299 49 'update' => 'civicrm/contact/view/contribution?reset=1&action=update&id=[id]',
a7bd99ff
CW
50 'delete' => 'civicrm/contact/view/contribution?reset=1&action=delete&id=[id]',
51 ];
52
e501603b
TO
53 /**
54 * Contribution ID
55 *
28979d65
CW
56 * @var int|string|null
57 * (SQL type: int unsigned)
58 * Note that values will be retrieved from the database as a string.
e501603b
TO
59 */
60 public $id;
c3fc2621 61
e501603b
TO
62 /**
63 * FK to Contact ID
64 *
28979d65
CW
65 * @var int|string
66 * (SQL type: int unsigned)
67 * Note that values will be retrieved from the database as a string.
e501603b
TO
68 */
69 public $contact_id;
c3fc2621 70
e501603b
TO
71 /**
72 * FK to Financial Type for (total_amount - non_deductible_amount).
73 *
28979d65
CW
74 * @var int|string|null
75 * (SQL type: int unsigned)
76 * Note that values will be retrieved from the database as a string.
e501603b
TO
77 */
78 public $financial_type_id;
c3fc2621 79
e501603b
TO
80 /**
81 * The Contribution Page which triggered this contribution
82 *
28979d65
CW
83 * @var int|string|null
84 * (SQL type: int unsigned)
85 * Note that values will be retrieved from the database as a string.
e501603b
TO
86 */
87 public $contribution_page_id;
c3fc2621 88
e501603b
TO
89 /**
90 * FK to Payment Instrument
91 *
28979d65
CW
92 * @var int|string|null
93 * (SQL type: int unsigned)
94 * Note that values will be retrieved from the database as a string.
e501603b
TO
95 */
96 public $payment_instrument_id;
c3fc2621 97
e501603b
TO
98 /**
99 * Date contribution was received - not necessarily the creation date of the record
100 *
28979d65
CW
101 * @var string|null
102 * (SQL type: datetime)
103 * Note that values will be retrieved from the database as a string.
e501603b
TO
104 */
105 public $receive_date;
c3fc2621 106
e501603b
TO
107 /**
108 * Portion of total amount which is NOT tax deductible. Equal to total_amount for non-deductible financial types.
109 *
28979d65
CW
110 * @var float|string|null
111 * (SQL type: decimal(20,2))
112 * Note that values will be retrieved from the database as a string.
e501603b
TO
113 */
114 public $non_deductible_amount;
c3fc2621 115
e501603b
TO
116 /**
117 * Total amount of this contribution. Use market value for non-monetary gifts.
118 *
28979d65
CW
119 * @var float|string
120 * (SQL type: decimal(20,2))
121 * Note that values will be retrieved from the database as a string.
e501603b
TO
122 */
123 public $total_amount;
c3fc2621 124
e501603b
TO
125 /**
126 * actual processor fee if known - may be 0.
127 *
28979d65
CW
128 * @var float|string|null
129 * (SQL type: decimal(20,2))
130 * Note that values will be retrieved from the database as a string.
e501603b
TO
131 */
132 public $fee_amount;
c3fc2621 133
e501603b
TO
134 /**
135 * actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.
136 *
28979d65
CW
137 * @var float|string|null
138 * (SQL type: decimal(20,2))
139 * Note that values will be retrieved from the database as a string.
e501603b
TO
140 */
141 public $net_amount;
c3fc2621 142
e501603b
TO
143 /**
144 * unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method
145 *
28979d65
CW
146 * @var string|null
147 * (SQL type: varchar(255))
148 * Note that values will be retrieved from the database as a string.
e501603b
TO
149 */
150 public $trxn_id;
c3fc2621 151
e501603b
TO
152 /**
153 * unique invoice id, system generated or passed in
154 *
28979d65
CW
155 * @var string|null
156 * (SQL type: varchar(255))
157 * Note that values will be retrieved from the database as a string.
e501603b
TO
158 */
159 public $invoice_id;
c3fc2621 160
9cad3ff4
CW
161 /**
162 * Human readable invoice number
163 *
28979d65
CW
164 * @var string|null
165 * (SQL type: varchar(255))
166 * Note that values will be retrieved from the database as a string.
9cad3ff4
CW
167 */
168 public $invoice_number;
c3fc2621 169
e501603b
TO
170 /**
171 * 3 character string, value from config setting or input via user.
172 *
28979d65
CW
173 * @var string|null
174 * (SQL type: varchar(3))
175 * Note that values will be retrieved from the database as a string.
e501603b
TO
176 */
177 public $currency;
c3fc2621 178
e501603b
TO
179 /**
180 * when was gift cancelled
181 *
28979d65
CW
182 * @var string|null
183 * (SQL type: datetime)
184 * Note that values will be retrieved from the database as a string.
e501603b
TO
185 */
186 public $cancel_date;
c3fc2621 187
e501603b 188 /**
28979d65
CW
189 * @var string|null
190 * (SQL type: text)
191 * Note that values will be retrieved from the database as a string.
e501603b
TO
192 */
193 public $cancel_reason;
c3fc2621 194
e501603b
TO
195 /**
196 * when (if) receipt was sent. populated automatically for online donations w/ automatic receipting
197 *
28979d65
CW
198 * @var string|null
199 * (SQL type: datetime)
200 * Note that values will be retrieved from the database as a string.
e501603b
TO
201 */
202 public $receipt_date;
c3fc2621 203
e501603b
TO
204 /**
205 * when (if) was donor thanked
206 *
28979d65
CW
207 * @var string|null
208 * (SQL type: datetime)
209 * Note that values will be retrieved from the database as a string.
e501603b
TO
210 */
211 public $thankyou_date;
c3fc2621 212
e501603b
TO
213 /**
214 * Origin of this Contribution.
215 *
28979d65
CW
216 * @var string|null
217 * (SQL type: varchar(255))
218 * Note that values will be retrieved from the database as a string.
e501603b
TO
219 */
220 public $source;
c3fc2621 221
e501603b 222 /**
28979d65
CW
223 * @var string|null
224 * (SQL type: text)
225 * Note that values will be retrieved from the database as a string.
e501603b
TO
226 */
227 public $amount_level;
c3fc2621 228
e501603b
TO
229 /**
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.
231 *
28979d65
CW
232 * @var int|string|null
233 * (SQL type: int unsigned)
234 * Note that values will be retrieved from the database as a string.
e501603b
TO
235 */
236 public $contribution_recur_id;
c3fc2621 237
e501603b 238 /**
28979d65
CW
239 * @var bool|string|null
240 * (SQL type: tinyint)
241 * Note that values will be retrieved from the database as a string.
e501603b
TO
242 */
243 public $is_test;
c3fc2621 244
e501603b 245 /**
28979d65
CW
246 * @var bool|string|null
247 * (SQL type: tinyint)
248 * Note that values will be retrieved from the database as a string.
e501603b
TO
249 */
250 public $is_pay_later;
c3fc2621 251
e501603b 252 /**
28979d65
CW
253 * @var int|string|null
254 * (SQL type: int unsigned)
255 * Note that values will be retrieved from the database as a string.
e501603b
TO
256 */
257 public $contribution_status_id;
c3fc2621 258
e501603b
TO
259 /**
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.
261 *
28979d65
CW
262 * @var int|string|null
263 * (SQL type: int unsigned)
264 * Note that values will be retrieved from the database as a string.
e501603b
TO
265 */
266 public $address_id;
c3fc2621 267
e501603b 268 /**
28979d65
CW
269 * @var string|null
270 * (SQL type: varchar(255))
271 * Note that values will be retrieved from the database as a string.
e501603b
TO
272 */
273 public $check_number;
c3fc2621 274
e501603b
TO
275 /**
276 * The campaign for which this contribution has been triggered.
277 *
28979d65
CW
278 * @var int|string|null
279 * (SQL type: int unsigned)
280 * Note that values will be retrieved from the database as a string.
e501603b
TO
281 */
282 public $campaign_id;
c3fc2621 283
e501603b
TO
284 /**
285 * unique credit note id, system generated or passed in
286 *
28979d65
CW
287 * @var string|null
288 * (SQL type: varchar(255))
289 * Note that values will be retrieved from the database as a string.
e501603b
TO
290 */
291 public $creditnote_id;
c3fc2621 292
e501603b
TO
293 /**
294 * Total tax amount of this contribution.
295 *
28979d65
CW
296 * @var float|string|null
297 * (SQL type: decimal(20,2))
298 * Note that values will be retrieved from the database as a string.
e501603b
TO
299 */
300 public $tax_amount;
c3fc2621 301
e501603b
TO
302 /**
303 * Stores the date when revenue should be recognized.
304 *
28979d65
CW
305 * @var string|null
306 * (SQL type: datetime)
307 * Note that values will be retrieved from the database as a string.
e501603b
TO
308 */
309 public $revenue_recognition_date;
c3fc2621 310
dc396835
AS
311 /**
312 * Shows this is a template for recurring contributions.
313 *
28979d65
CW
314 * @var bool|string|null
315 * (SQL type: tinyint)
316 * Note that values will be retrieved from the database as a string.
dc396835
AS
317 */
318 public $is_template;
319
e501603b 320 /**
f41f0342 321 * Class constructor.
e501603b 322 */
c3fc2621 323 public function __construct() {
e501603b
TO
324 $this->__table = 'civicrm_contribution';
325 parent::__construct();
326 }
c3fc2621 327
449c4e6b
CW
328 /**
329 * Returns localized title of this entity.
7b66c3b5
AH
330 *
331 * @param bool $plural
332 * Whether to return the plural version of the title.
449c4e6b 333 */
7b66c3b5
AH
334 public static function getEntityTitle($plural = FALSE) {
335 return $plural ? ts('Contributions') : ts('Contribution');
449c4e6b
CW
336 }
337
2562d09a
CW
338 /**
339 * Returns user-friendly description of this entity.
340 *
341 * @return string
342 */
343 public static function getEntityDescription() {
344 return ts('Financial records consisting of transactions, line-items, etc.');
345 }
346
e501603b 347 /**
f41f0342 348 * Returns foreign keys and entity references.
e501603b
TO
349 *
350 * @return array
351 * [CRM_Core_Reference_Interface]
352 */
c3fc2621 353 public static function getReferenceColumns() {
346aaaba 354 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 355 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
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');
346aaaba 362 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 363 }
346aaaba 364 return Civi::$statics[__CLASS__]['links'];
e501603b 365 }
c3fc2621 366
e501603b
TO
367 /**
368 * Returns all the column names of this table
369 *
370 * @return array
371 */
c3fc2621 372 public static function &fields() {
346aaaba 373 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
374 Civi::$statics[__CLASS__]['fields'] = [
375 'contribution_id' => [
e501603b
TO
376 'name' => 'id',
377 'type' => CRM_Utils_Type::T_INT,
c3fc2621 378 'title' => ts('Contribution ID'),
215b423e 379 'description' => ts('Contribution ID'),
c3fc2621
CW
380 'required' => TRUE,
381 'import' => TRUE,
e501603b 382 'where' => 'civicrm_contribution.id',
c3fc2621 383 'export' => TRUE,
522a26c9 384 'table_name' => 'civicrm_contribution',
385 'entity' => 'Contribution',
386 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 387 'localizable' => 0,
8cc7686b 388 'html' => [
2cbbebe8 389 'type' => 'Number',
8cc7686b 390 ],
1fe423d6 391 'readonly' => TRUE,
a9d0587b 392 'add' => '1.3',
c3fc2621
CW
393 ],
394 'contribution_contact_id' => [
e501603b
TO
395 'name' => 'contact_id',
396 'type' => CRM_Utils_Type::T_INT,
c3fc2621 397 'title' => ts('Contact ID'),
215b423e 398 'description' => ts('FK to Contact ID'),
c3fc2621
CW
399 'required' => TRUE,
400 'import' => TRUE,
e501603b
TO
401 'where' => 'civicrm_contribution.contact_id',
402 'headerPattern' => '/contact(.?id)?/i',
403 'dataPattern' => '/^\d+$/',
c3fc2621 404 'export' => TRUE,
522a26c9 405 'table_name' => 'civicrm_contribution',
406 'entity' => 'Contribution',
407 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 408 'localizable' => 0,
e501603b 409 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621 410 'html' => [
e501603b 411 'type' => 'EntityRef',
2cbbebe8 412 'label' => ts("Contact"),
c3fc2621 413 ],
a9d0587b 414 'add' => '1.3',
c3fc2621
CW
415 ],
416 'financial_type_id' => [
e501603b
TO
417 'name' => 'financial_type_id',
418 'type' => CRM_Utils_Type::T_INT,
a1d226d6 419 'title' => ts('Financial Type ID'),
215b423e 420 'description' => ts('FK to Financial Type for (total_amount - non_deductible_amount).'),
e501603b 421 'where' => 'civicrm_contribution.financial_type_id',
a36434b9 422 'export' => TRUE,
522a26c9 423 'table_name' => 'civicrm_contribution',
424 'entity' => 'Contribution',
425 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 426 'localizable' => 0,
e501603b 427 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
c3fc2621 428 'html' => [
e501603b 429 'type' => 'Select',
a1d226d6 430 'label' => ts("Financial Type"),
c3fc2621
CW
431 ],
432 'pseudoconstant' => [
e501603b
TO
433 'table' => 'civicrm_financial_type',
434 'keyColumn' => 'id',
435 'labelColumn' => 'name',
e6ca0a57 436 ],
a9d0587b 437 'add' => '4.3',
c3fc2621
CW
438 ],
439 'contribution_page_id' => [
e501603b
TO
440 'name' => 'contribution_page_id',
441 'type' => CRM_Utils_Type::T_INT,
c3fc2621 442 'title' => ts('Contribution Page ID'),
215b423e 443 'description' => ts('The Contribution Page which triggered this contribution'),
c3fc2621 444 'import' => TRUE,
e501603b 445 'where' => 'civicrm_contribution.contribution_page_id',
c3fc2621 446 'export' => TRUE,
522a26c9 447 'table_name' => 'civicrm_contribution',
448 'entity' => 'Contribution',
449 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 450 'localizable' => 0,
e501603b 451 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage',
c3fc2621 452 'html' => [
e501603b 453 'type' => 'Select',
cff5e6b9 454 'label' => ts("Contribution Page"),
c3fc2621
CW
455 ],
456 'pseudoconstant' => [
e501603b
TO
457 'table' => 'civicrm_contribution_page',
458 'keyColumn' => 'id',
459 'labelColumn' => 'title',
e6ca0a57 460 ],
a9d0587b 461 'add' => '1.5',
c3fc2621
CW
462 ],
463 'payment_instrument_id' => [
e501603b
TO
464 'name' => 'payment_instrument_id',
465 'type' => CRM_Utils_Type::T_INT,
c3fc2621 466 'title' => ts('Payment Method ID'),
215b423e 467 'description' => ts('FK to Payment Instrument'),
9d5c7f14 468 'where' => 'civicrm_contribution.payment_instrument_id',
469 'headerPattern' => '/^payment|(p(ayment\s)?instrument)$/i',
a36434b9 470 'export' => TRUE,
522a26c9 471 'table_name' => 'civicrm_contribution',
472 'entity' => 'Contribution',
473 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 474 'localizable' => 0,
c3fc2621 475 'html' => [
e501603b 476 'type' => 'Select',
1f4602ea 477 'label' => ts("Payment Method"),
c3fc2621
CW
478 ],
479 'pseudoconstant' => [
e501603b
TO
480 'optionGroupName' => 'payment_instrument',
481 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
e6ca0a57 482 ],
a9d0587b 483 'add' => '1.3',
c3fc2621
CW
484 ],
485 'receive_date' => [
e501603b
TO
486 'name' => 'receive_date',
487 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 488 'title' => ts('Date Received'),
215b423e 489 'description' => ts('Date contribution was received - not necessarily the creation date of the record'),
c3fc2621 490 'import' => TRUE,
e501603b
TO
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})?)?$/',
c3fc2621 494 'export' => TRUE,
522a26c9 495 'table_name' => 'civicrm_contribution',
496 'entity' => 'Contribution',
497 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 498 'localizable' => 0,
c3fc2621 499 'html' => [
e501603b 500 'type' => 'Select Date',
24317d89 501 'formatType' => 'activityDateTime',
c3fc2621 502 ],
a9d0587b 503 'add' => '1.3',
c3fc2621
CW
504 ],
505 'non_deductible_amount' => [
e501603b
TO
506 'name' => 'non_deductible_amount',
507 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 508 'title' => ts('Non-deductible Amount'),
215b423e 509 'description' => ts('Portion of total amount which is NOT tax deductible. Equal to total_amount for non-deductible financial types.'),
c3fc2621 510 'precision' => [
e501603b 511 20,
fb607354 512 2,
c3fc2621
CW
513 ],
514 'import' => TRUE,
e501603b
TO
515 'where' => 'civicrm_contribution.non_deductible_amount',
516 'headerPattern' => '/non?.?deduct/i',
517 'dataPattern' => '/^\d+(\.\d{2})?$/',
c3fc2621 518 'export' => TRUE,
45a83e42 519 'default' => '0',
522a26c9 520 'table_name' => 'civicrm_contribution',
521 'entity' => 'Contribution',
522 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 523 'localizable' => 0,
c3fc2621 524 'html' => [
e501603b 525 'type' => 'Text',
c3fc2621 526 ],
a9d0587b 527 'add' => '1.3',
c3fc2621
CW
528 ],
529 'total_amount' => [
e501603b
TO
530 'name' => 'total_amount',
531 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 532 'title' => ts('Total Amount'),
215b423e 533 'description' => ts('Total amount of this contribution. Use market value for non-monetary gifts.'),
c3fc2621
CW
534 'required' => TRUE,
535 'precision' => [
e501603b 536 20,
fb607354 537 2,
c3fc2621
CW
538 ],
539 'import' => TRUE,
e501603b
TO
540 'where' => 'civicrm_contribution.total_amount',
541 'headerPattern' => '/^total|(.?^am(ou)?nt)/i',
542 'dataPattern' => '/^\d+(\.\d{2})?$/',
c3fc2621 543 'export' => TRUE,
522a26c9 544 'table_name' => 'civicrm_contribution',
545 'entity' => 'Contribution',
546 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 547 'localizable' => 0,
c3fc2621 548 'html' => [
e501603b 549 'type' => 'Text',
c23563e3 550 'label' => ts("Total Amount"),
c3fc2621 551 ],
a9d0587b 552 'add' => '1.3',
c3fc2621
CW
553 ],
554 'fee_amount' => [
e501603b
TO
555 'name' => 'fee_amount',
556 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 557 'title' => ts('Fee Amount'),
215b423e 558 'description' => ts('actual processor fee if known - may be 0.'),
c3fc2621 559 'precision' => [
e501603b 560 20,
fb607354 561 2,
c3fc2621
CW
562 ],
563 'import' => TRUE,
e501603b
TO
564 'where' => 'civicrm_contribution.fee_amount',
565 'headerPattern' => '/fee(.?am(ou)?nt)?/i',
566 'dataPattern' => '/^\d+(\.\d{2})?$/',
c3fc2621 567 'export' => TRUE,
522a26c9 568 'table_name' => 'civicrm_contribution',
569 'entity' => 'Contribution',
570 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 571 'localizable' => 0,
c3fc2621 572 'html' => [
e501603b 573 'type' => 'Text',
c23563e3 574 'label' => ts("Fee Amount"),
c3fc2621 575 ],
a9d0587b 576 'add' => '1.3',
c3fc2621
CW
577 ],
578 'net_amount' => [
e501603b
TO
579 'name' => 'net_amount',
580 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 581 'title' => ts('Net Amount'),
215b423e 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.'),
c3fc2621 583 'precision' => [
e501603b 584 20,
fb607354 585 2,
c3fc2621
CW
586 ],
587 'import' => TRUE,
e501603b
TO
588 'where' => 'civicrm_contribution.net_amount',
589 'headerPattern' => '/net(.?am(ou)?nt)?/i',
590 'dataPattern' => '/^\d+(\.\d{2})?$/',
c3fc2621 591 'export' => TRUE,
522a26c9 592 'table_name' => 'civicrm_contribution',
593 'entity' => 'Contribution',
594 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 595 'localizable' => 0,
c3fc2621 596 'html' => [
e501603b 597 'type' => 'Text',
c23563e3 598 'label' => ts("Net Amount"),
c3fc2621 599 ],
a9d0587b 600 'add' => '1.3',
c3fc2621
CW
601 ],
602 'trxn_id' => [
e501603b
TO
603 'name' => 'trxn_id',
604 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 605 'title' => ts('Transaction ID'),
215b423e 606 'description' => ts('unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method'),
e501603b
TO
607 'maxlength' => 255,
608 'size' => CRM_Utils_Type::HUGE,
c3fc2621 609 'import' => TRUE,
e501603b
TO
610 'where' => 'civicrm_contribution.trxn_id',
611 'headerPattern' => '/tr(ansactio|x)n(.?id)?/i',
c3fc2621 612 'export' => TRUE,
522a26c9 613 'table_name' => 'civicrm_contribution',
614 'entity' => 'Contribution',
615 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 616 'localizable' => 0,
c3fc2621 617 'html' => [
e501603b 618 'type' => 'Text',
c3fc2621 619 ],
58b0bf5a 620 'readonly' => TRUE,
a9d0587b 621 'add' => '1.3',
c3fc2621
CW
622 ],
623 'invoice_id' => [
e501603b
TO
624 'name' => 'invoice_id',
625 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 626 'title' => ts('Invoice Reference'),
215b423e 627 'description' => ts('unique invoice id, system generated or passed in'),
e501603b
TO
628 'maxlength' => 255,
629 'size' => CRM_Utils_Type::HUGE,
c3fc2621 630 'import' => TRUE,
e501603b
TO
631 'where' => 'civicrm_contribution.invoice_id',
632 'headerPattern' => '/invoice(.?id)?/i',
c3fc2621 633 'export' => TRUE,
522a26c9 634 'table_name' => 'civicrm_contribution',
635 'entity' => 'Contribution',
636 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 637 'localizable' => 0,
c3fc2621 638 'html' => [
e501603b 639 'type' => 'Text',
c3fc2621 640 ],
58b0bf5a 641 'readonly' => TRUE,
a9d0587b 642 'add' => '1.3',
c3fc2621
CW
643 ],
644 'invoice_number' => [
9cad3ff4
CW
645 'name' => 'invoice_number',
646 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 647 'title' => ts('Invoice Number'),
215b423e 648 'description' => ts('Human readable invoice number'),
9cad3ff4
CW
649 'maxlength' => 255,
650 'size' => CRM_Utils_Type::HUGE,
c3fc2621 651 'import' => TRUE,
9cad3ff4
CW
652 'where' => 'civicrm_contribution.invoice_number',
653 'headerPattern' => '/invoice(.?number)?/i',
c3fc2621 654 'export' => TRUE,
9cad3ff4
CW
655 'table_name' => 'civicrm_contribution',
656 'entity' => 'Contribution',
657 'bao' => 'CRM_Contribute_BAO_Contribution',
658 'localizable' => 0,
c3fc2621 659 'html' => [
9cad3ff4 660 'type' => 'Text',
c3fc2621 661 ],
a9d0587b 662 'add' => '4.7',
c3fc2621
CW
663 ],
664 'currency' => [
e501603b
TO
665 'name' => 'currency',
666 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 667 'title' => ts('Currency'),
215b423e 668 'description' => ts('3 character string, value from config setting or input via user.'),
e501603b
TO
669 'maxlength' => 3,
670 'size' => CRM_Utils_Type::FOUR,
c3fc2621 671 'import' => TRUE,
e501603b
TO
672 'where' => 'civicrm_contribution.currency',
673 'headerPattern' => '/cur(rency)?/i',
674 'dataPattern' => '/^[A-Z]{3}$/i',
c3fc2621 675 'export' => TRUE,
5fb0de1f 676 'default' => NULL,
522a26c9 677 'table_name' => 'civicrm_contribution',
678 'entity' => 'Contribution',
679 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 680 'localizable' => 0,
c3fc2621 681 'html' => [
e501603b 682 'type' => 'Select',
c23563e3 683 'label' => ts("Currency"),
c3fc2621
CW
684 ],
685 'pseudoconstant' => [
e501603b
TO
686 'table' => 'civicrm_currency',
687 'keyColumn' => 'name',
688 'labelColumn' => 'full_name',
689 'nameColumn' => 'name',
a8fdb24e 690 'abbrColumn' => 'symbol',
e6ca0a57 691 ],
a9d0587b 692 'add' => '1.3',
c3fc2621 693 ],
6e7cc0f5 694 'contribution_cancel_date' => [
e501603b
TO
695 'name' => 'cancel_date',
696 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
6e7cc0f5 697 'title' => ts('Cancelled / Refunded Date'),
215b423e 698 'description' => ts('when was gift cancelled'),
c3fc2621 699 'import' => TRUE,
e501603b
TO
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})?)?$/',
c3fc2621 703 'export' => TRUE,
522a26c9 704 'table_name' => 'civicrm_contribution',
705 'entity' => 'Contribution',
706 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 707 'localizable' => 0,
c3fc2621 708 'html' => [
e501603b 709 'type' => 'Select Date',
24317d89 710 'formatType' => 'activityDateTime',
c3fc2621 711 ],
a9d0587b 712 'add' => '1.3',
c3fc2621
CW
713 ],
714 'cancel_reason' => [
e501603b
TO
715 'name' => 'cancel_reason',
716 'type' => CRM_Utils_Type::T_TEXT,
927898c5 717 'title' => ts('Cancellation / Refund Reason'),
c3fc2621 718 'import' => TRUE,
e501603b
TO
719 'where' => 'civicrm_contribution.cancel_reason',
720 'headerPattern' => '/(cancel.?)?reason/i',
c3fc2621 721 'export' => TRUE,
522a26c9 722 'table_name' => 'civicrm_contribution',
723 'entity' => 'Contribution',
724 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 725 'localizable' => 0,
c3fc2621 726 'html' => [
e501603b 727 'type' => 'Text',
c3fc2621 728 ],
a9d0587b 729 'add' => '1.3',
c3fc2621
CW
730 ],
731 'receipt_date' => [
e501603b
TO
732 'name' => 'receipt_date',
733 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 734 'title' => ts('Receipt Date'),
215b423e 735 'description' => ts('when (if) receipt was sent. populated automatically for online donations w/ automatic receipting'),
c3fc2621 736 'import' => TRUE,
e501603b
TO
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})?)?$/',
c3fc2621 740 'export' => TRUE,
522a26c9 741 'table_name' => 'civicrm_contribution',
742 'entity' => 'Contribution',
743 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 744 'localizable' => 0,
c3fc2621 745 'html' => [
e501603b 746 'type' => 'Select Date',
24317d89 747 'formatType' => 'activityDateTime',
c23563e3 748 'label' => ts("Receipt Date"),
c3fc2621 749 ],
a9d0587b 750 'add' => '1.3',
c3fc2621
CW
751 ],
752 'thankyou_date' => [
e501603b
TO
753 'name' => 'thankyou_date',
754 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 755 'title' => ts('Thank-you Date'),
215b423e 756 'description' => ts('when (if) was donor thanked'),
c3fc2621 757 'import' => TRUE,
e501603b
TO
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})?)?$/',
c3fc2621 761 'export' => TRUE,
522a26c9 762 'table_name' => 'civicrm_contribution',
763 'entity' => 'Contribution',
764 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 765 'localizable' => 0,
c3fc2621 766 'html' => [
e501603b 767 'type' => 'Select Date',
24317d89 768 'formatType' => 'activityDateTime',
c3fc2621 769 ],
a9d0587b 770 'add' => '1.3',
c3fc2621
CW
771 ],
772 'contribution_source' => [
e501603b
TO
773 'name' => 'source',
774 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 775 'title' => ts('Contribution Source'),
215b423e 776 'description' => ts('Origin of this Contribution.'),
e501603b
TO
777 'maxlength' => 255,
778 'size' => CRM_Utils_Type::HUGE,
c3fc2621 779 'import' => TRUE,
e501603b
TO
780 'where' => 'civicrm_contribution.source',
781 'headerPattern' => '/source/i',
c3fc2621 782 'export' => TRUE,
522a26c9 783 'table_name' => 'civicrm_contribution',
784 'entity' => 'Contribution',
785 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 786 'localizable' => 0,
c3fc2621 787 'html' => [
e501603b 788 'type' => 'Text',
c3fc2621 789 ],
a9d0587b 790 'add' => '1.3',
c3fc2621
CW
791 ],
792 'amount_level' => [
e501603b
TO
793 'name' => 'amount_level',
794 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621
CW
795 'title' => ts('Amount Label'),
796 'import' => TRUE,
e501603b 797 'where' => 'civicrm_contribution.amount_level',
c3fc2621 798 'export' => TRUE,
522a26c9 799 'table_name' => 'civicrm_contribution',
800 'entity' => 'Contribution',
801 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 802 'localizable' => 0,
c3fc2621 803 'html' => [
e501603b 804 'type' => 'Text',
c3fc2621 805 ],
a9d0587b 806 'add' => '1.7',
c3fc2621
CW
807 ],
808 'contribution_recur_id' => [
e501603b
TO
809 'name' => 'contribution_recur_id',
810 'type' => CRM_Utils_Type::T_INT,
c3fc2621 811 'title' => ts('Recurring Contribution ID'),
215b423e 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.'),
3123273f 813 'where' => 'civicrm_contribution.contribution_recur_id',
a36434b9 814 'export' => TRUE,
522a26c9 815 'table_name' => 'civicrm_contribution',
816 'entity' => 'Contribution',
817 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 818 'localizable' => 0,
e501603b 819 'FKClassName' => 'CRM_Contribute_DAO_ContributionRecur',
2cbbebe8
A
820 'html' => [
821 'label' => ts("Recurring Contribution"),
822 ],
58b0bf5a 823 'readonly' => TRUE,
a9d0587b 824 'add' => '1.4',
c3fc2621
CW
825 ],
826 'is_test' => [
e501603b
TO
827 'name' => 'is_test',
828 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621
CW
829 'title' => ts('Test'),
830 'import' => TRUE,
e501603b 831 'where' => 'civicrm_contribution.is_test',
c3fc2621 832 'export' => TRUE,
45a83e42 833 'default' => '0',
522a26c9 834 'table_name' => 'civicrm_contribution',
835 'entity' => 'Contribution',
836 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 837 'localizable' => 0,
c3fc2621 838 'html' => [
e501603b 839 'type' => 'CheckBox',
c3fc2621 840 ],
a9d0587b 841 'add' => NULL,
c3fc2621
CW
842 ],
843 'is_pay_later' => [
e501603b
TO
844 'name' => 'is_pay_later',
845 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621
CW
846 'title' => ts('Is Pay Later'),
847 'import' => TRUE,
e501603b 848 'where' => 'civicrm_contribution.is_pay_later',
c3fc2621 849 'export' => TRUE,
45a83e42 850 'default' => '0',
522a26c9 851 'table_name' => 'civicrm_contribution',
852 'entity' => 'Contribution',
853 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 854 'localizable' => 0,
c3fc2621 855 'html' => [
e501603b 856 'type' => 'CheckBox',
c3fc2621 857 ],
a9d0587b 858 'add' => '2.1',
c3fc2621
CW
859 ],
860 'contribution_status_id' => [
e501603b
TO
861 'name' => 'contribution_status_id',
862 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
863 'title' => ts('Contribution Status ID'),
864 'import' => TRUE,
e501603b
TO
865 'where' => 'civicrm_contribution.contribution_status_id',
866 'headerPattern' => '/status/i',
c3fc2621 867 'export' => TRUE,
e501603b 868 'default' => '1',
522a26c9 869 'table_name' => 'civicrm_contribution',
870 'entity' => 'Contribution',
871 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 872 'localizable' => 0,
c3fc2621 873 'html' => [
e501603b 874 'type' => 'Select',
ad5b7f44 875 'label' => ts("Contribution Status"),
c3fc2621
CW
876 ],
877 'pseudoconstant' => [
e501603b
TO
878 'optionGroupName' => 'contribution_status',
879 'optionEditPath' => 'civicrm/admin/options/contribution_status',
e6ca0a57 880 ],
a9d0587b 881 'add' => '1.6',
c3fc2621
CW
882 ],
883 'contribution_address_id' => [
e501603b
TO
884 'name' => 'address_id',
885 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 886 'title' => ts('Address ID'),
215b423e 887 '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.'),
3123273f 888 'where' => 'civicrm_contribution.address_id',
a36434b9 889 'export' => TRUE,
522a26c9 890 'table_name' => 'civicrm_contribution',
891 'entity' => 'Contribution',
892 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 893 'localizable' => 0,
e501603b 894 'FKClassName' => 'CRM_Core_DAO_Address',
2cbbebe8
A
895 'html' => [
896 'label' => ts("Address"),
897 ],
a9d0587b 898 'add' => '2.2',
c3fc2621
CW
899 ],
900 'contribution_check_number' => [
e501603b
TO
901 'name' => 'check_number',
902 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 903 'title' => ts('Check Number'),
e501603b
TO
904 'maxlength' => 255,
905 'size' => 6,
c3fc2621 906 'import' => TRUE,
e501603b
TO
907 'where' => 'civicrm_contribution.check_number',
908 'headerPattern' => '/check(.?number)?/i',
c3fc2621 909 'export' => TRUE,
522a26c9 910 'table_name' => 'civicrm_contribution',
911 'entity' => 'Contribution',
912 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 913 'localizable' => 0,
c3fc2621 914 'html' => [
e501603b 915 'type' => 'Text',
c3fc2621 916 ],
a9d0587b 917 'add' => '2.2',
c3fc2621
CW
918 ],
919 'contribution_campaign_id' => [
e501603b
TO
920 'name' => 'campaign_id',
921 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 922 'title' => ts('Campaign ID'),
215b423e 923 'description' => ts('The campaign for which this contribution has been triggered.'),
c3fc2621 924 'import' => TRUE,
e501603b 925 'where' => 'civicrm_contribution.campaign_id',
c3fc2621 926 'export' => TRUE,
522a26c9 927 'table_name' => 'civicrm_contribution',
928 'entity' => 'Contribution',
929 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 930 'localizable' => 0,
e501603b 931 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
88c31c05 932 'component' => 'CiviCampaign',
c3fc2621 933 'html' => [
8813f972 934 'type' => 'EntityRef',
2cbbebe8 935 'label' => ts("Campaign"),
c3fc2621 936 ],
9b97477d
EM
937 'pseudoconstant' => [
938 'table' => 'civicrm_campaign',
939 'keyColumn' => 'id',
940 'labelColumn' => 'title',
941 'prefetch' => 'FALSE',
942 ],
a9d0587b 943 'add' => '3.4',
c3fc2621
CW
944 ],
945 'creditnote_id' => [
e501603b
TO
946 'name' => 'creditnote_id',
947 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 948 'title' => ts('Credit Note ID'),
215b423e 949 'description' => ts('unique credit note id, system generated or passed in'),
e501603b
TO
950 'maxlength' => 255,
951 'size' => CRM_Utils_Type::HUGE,
c3fc2621 952 'import' => TRUE,
e501603b
TO
953 'where' => 'civicrm_contribution.creditnote_id',
954 'headerPattern' => '/creditnote(.?id)?/i',
c3fc2621 955 'export' => TRUE,
522a26c9 956 'table_name' => 'civicrm_contribution',
957 'entity' => 'Contribution',
958 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 959 'localizable' => 0,
c3fc2621 960 'html' => [
e501603b 961 'type' => 'Text',
c3fc2621 962 ],
a9d0587b 963 'add' => '4.6',
c3fc2621
CW
964 ],
965 'tax_amount' => [
e501603b
TO
966 'name' => 'tax_amount',
967 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 968 'title' => ts('Tax Amount'),
215b423e 969 'description' => ts('Total tax amount of this contribution.'),
c3fc2621 970 'precision' => [
e501603b 971 20,
fb607354 972 2,
c3fc2621
CW
973 ],
974 'import' => TRUE,
e501603b
TO
975 'where' => 'civicrm_contribution.tax_amount',
976 'headerPattern' => '/tax(.?am(ou)?nt)?/i',
977 'dataPattern' => '/^\d+(\.\d{2})?$/',
c3fc2621 978 'export' => TRUE,
522a26c9 979 'table_name' => 'civicrm_contribution',
980 'entity' => 'Contribution',
981 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 982 'localizable' => 0,
c3fc2621 983 'html' => [
e501603b 984 'type' => 'Text',
c3fc2621 985 ],
a9d0587b 986 'add' => '4.6',
c3fc2621
CW
987 ],
988 'revenue_recognition_date' => [
e501603b
TO
989 'name' => 'revenue_recognition_date',
990 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 991 'title' => ts('Revenue Recognition Date'),
215b423e 992 'description' => ts('Stores the date when revenue should be recognized.'),
c3fc2621 993 'import' => TRUE,
e501603b
TO
994 'where' => 'civicrm_contribution.revenue_recognition_date',
995 'headerPattern' => '/revenue(.?date)?/i',
996 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/',
c3fc2621 997 'export' => TRUE,
522a26c9 998 'table_name' => 'civicrm_contribution',
999 'entity' => 'Contribution',
1000 'bao' => 'CRM_Contribute_BAO_Contribution',
6a7e5e5d 1001 'localizable' => 0,
c3fc2621 1002 'html' => [
e501603b 1003 'type' => 'Select Date',
24317d89 1004 'formatType' => 'activityDateTime',
c23563e3 1005 'label' => ts("Revenue Recognition Date"),
c3fc2621 1006 ],
a9d0587b 1007 'add' => '4.7',
c3fc2621 1008 ],
dc396835
AS
1009 'is_template' => [
1010 'name' => 'is_template',
1011 'type' => CRM_Utils_Type::T_BOOLEAN,
1012 'title' => ts('Is a Template Contribution'),
1013 'description' => ts('Shows this is a template for recurring contributions.'),
1014 'import' => TRUE,
1015 'where' => 'civicrm_contribution.is_template',
1016 'export' => TRUE,
1017 'default' => '0',
1018 'table_name' => 'civicrm_contribution',
1019 'entity' => 'Contribution',
1020 'bao' => 'CRM_Contribute_BAO_Contribution',
1021 'localizable' => 0,
1022 'html' => [
1023 'type' => 'CheckBox',
1024 ],
58b0bf5a 1025 'readonly' => TRUE,
a9d0587b 1026 'add' => '5.20',
dc396835 1027 ],
c3fc2621 1028 ];
346aaaba 1029 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 1030 }
346aaaba 1031 return Civi::$statics[__CLASS__]['fields'];
e501603b 1032 }
c3fc2621 1033
e501603b 1034 /**
bd8e0b14 1035 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
1036 *
1037 * @return array
bd8e0b14 1038 * Array(string $name => string $uniqueName).
e501603b 1039 */
c3fc2621 1040 public static function &fieldKeys() {
bd8e0b14
TO
1041 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
1042 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 1043 }
bd8e0b14 1044 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 1045 }
c3fc2621 1046
e501603b
TO
1047 /**
1048 * Returns the names of this table
1049 *
1050 * @return string
1051 */
c3fc2621 1052 public static function getTableName() {
e501603b
TO
1053 return self::$_tableName;
1054 }
c3fc2621 1055
e501603b
TO
1056 /**
1057 * Returns if this table needs to be logged
1058 *
c3fc2621 1059 * @return bool
e501603b 1060 */
c3fc2621 1061 public function getLog() {
e501603b
TO
1062 return self::$_log;
1063 }
c3fc2621 1064
e501603b
TO
1065 /**
1066 * Returns the list of fields that can be imported
1067 *
1068 * @param bool $prefix
1069 *
1070 * @return array
1071 */
c3fc2621
CW
1072 public static function &import($prefix = FALSE) {
1073 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution', $prefix, []);
60808919 1074 return $r;
e501603b 1075 }
c3fc2621 1076
e501603b
TO
1077 /**
1078 * Returns the list of fields that can be exported
1079 *
1080 * @param bool $prefix
1081 *
1082 * @return array
1083 */
c3fc2621
CW
1084 public static function &export($prefix = FALSE) {
1085 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution', $prefix, []);
60808919 1086 return $r;
e501603b 1087 }
c3fc2621 1088
e7a6b91a
AS
1089 /**
1090 * Returns the list of indices
c3fc2621
CW
1091 *
1092 * @param bool $localize
1093 *
1094 * @return array
e7a6b91a
AS
1095 */
1096 public static function indices($localize = TRUE) {
c3fc2621
CW
1097 $indices = [
1098 'UI_contrib_payment_instrument_id' => [
e7a6b91a 1099 'name' => 'UI_contrib_payment_instrument_id',
c3fc2621 1100 'field' => [
e7a6b91a 1101 0 => 'payment_instrument_id',
c3fc2621
CW
1102 ],
1103 'localizable' => FALSE,
e7a6b91a 1104 'sig' => 'civicrm_contribution::0::payment_instrument_id',
c3fc2621
CW
1105 ],
1106 'index_total_amount_receive_date' => [
e7a6b91a 1107 'name' => 'index_total_amount_receive_date',
c3fc2621 1108 'field' => [
e7a6b91a
AS
1109 0 => 'total_amount',
1110 1 => 'receive_date',
c3fc2621
CW
1111 ],
1112 'localizable' => FALSE,
e7a6b91a 1113 'sig' => 'civicrm_contribution::0::total_amount::receive_date',
c3fc2621
CW
1114 ],
1115 'index_source' => [
e7a6b91a 1116 'name' => 'index_source',
c3fc2621 1117 'field' => [
e7a6b91a 1118 0 => 'source',
c3fc2621
CW
1119 ],
1120 'localizable' => FALSE,
e7a6b91a 1121 'sig' => 'civicrm_contribution::0::source',
c3fc2621
CW
1122 ],
1123 'UI_contrib_trxn_id' => [
e7a6b91a 1124 'name' => 'UI_contrib_trxn_id',
c3fc2621 1125 'field' => [
e7a6b91a 1126 0 => 'trxn_id',
c3fc2621
CW
1127 ],
1128 'localizable' => FALSE,
1129 'unique' => TRUE,
e7a6b91a 1130 'sig' => 'civicrm_contribution::1::trxn_id',
c3fc2621
CW
1131 ],
1132 'UI_contrib_invoice_id' => [
e7a6b91a 1133 'name' => 'UI_contrib_invoice_id',
c3fc2621 1134 'field' => [
e7a6b91a 1135 0 => 'invoice_id',
c3fc2621
CW
1136 ],
1137 'localizable' => FALSE,
1138 'unique' => TRUE,
e7a6b91a 1139 'sig' => 'civicrm_contribution::1::invoice_id',
c3fc2621
CW
1140 ],
1141 'index_contribution_status' => [
e7a6b91a 1142 'name' => 'index_contribution_status',
c3fc2621 1143 'field' => [
e7a6b91a 1144 0 => 'contribution_status_id',
c3fc2621
CW
1145 ],
1146 'localizable' => FALSE,
e7a6b91a 1147 'sig' => 'civicrm_contribution::0::contribution_status_id',
c3fc2621
CW
1148 ],
1149 'received_date' => [
e7a6b91a 1150 'name' => 'received_date',
c3fc2621 1151 'field' => [
e7a6b91a 1152 0 => 'receive_date',
c3fc2621
CW
1153 ],
1154 'localizable' => FALSE,
e7a6b91a 1155 'sig' => 'civicrm_contribution::0::receive_date',
c3fc2621
CW
1156 ],
1157 'check_number' => [
e7a6b91a 1158 'name' => 'check_number',
c3fc2621 1159 'field' => [
e7a6b91a 1160 0 => 'check_number',
c3fc2621
CW
1161 ],
1162 'localizable' => FALSE,
e7a6b91a 1163 'sig' => 'civicrm_contribution::0::check_number',
c3fc2621
CW
1164 ],
1165 'index_creditnote_id' => [
e7a6b91a 1166 'name' => 'index_creditnote_id',
c3fc2621 1167 'field' => [
e7a6b91a 1168 0 => 'creditnote_id',
c3fc2621
CW
1169 ],
1170 'localizable' => FALSE,
e7a6b91a 1171 'sig' => 'civicrm_contribution::0::creditnote_id',
c3fc2621
CW
1172 ],
1173 ];
e7a6b91a
AS
1174 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
1175 }
c3fc2621 1176
e501603b 1177}