Merge pull request #21548 from eileenmcnaughton/cleanup
[civicrm-core.git] / CRM / Financial / DAO / FinancialTrxn.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/Financial/FinancialTrxn.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
2562d09a 9 * (GenCodeChecksum:330be109309bcc6fc543b287c805e606)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the FinancialTrxn entity.
f41f0342 14 */
e501603b 15class CRM_Financial_DAO_FinancialTrxn 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_financial_trxn';
c3fc2621 26
e501603b 27 /**
f41f0342 28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 29 *
c3fc2621 30 * @var bool
e501603b 31 */
fa45b5b9 32 public static $_log = TRUE;
c3fc2621 33
e501603b 34 /**
e6ca0a57 35 * @var int
e501603b
TO
36 */
37 public $id;
c3fc2621 38
e501603b
TO
39 /**
40 * FK to financial_account table.
41 *
e6ca0a57 42 * @var int
e501603b
TO
43 */
44 public $from_financial_account_id;
c3fc2621 45
e501603b
TO
46 /**
47 * FK to financial_financial_account table.
48 *
e6ca0a57 49 * @var int
e501603b
TO
50 */
51 public $to_financial_account_id;
c3fc2621 52
e501603b
TO
53 /**
54 * date transaction occurred
55 *
56 * @var datetime
57 */
58 public $trxn_date;
c3fc2621 59
e501603b
TO
60 /**
61 * amount of transaction
62 *
63 * @var float
64 */
65 public $total_amount;
c3fc2621 66
e501603b
TO
67 /**
68 * actual processor fee if known - may be 0.
69 *
70 * @var float
71 */
72 public $fee_amount;
c3fc2621 73
e501603b
TO
74 /**
75 * actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.
76 *
77 * @var float
78 */
79 public $net_amount;
c3fc2621 80
e501603b
TO
81 /**
82 * 3 character string, value from config setting or input via user.
83 *
84 * @var string
85 */
86 public $currency;
c3fc2621 87
e501603b
TO
88 /**
89 * Is this entry either a payment or a reversal of a payment?
90 *
e6ca0a57 91 * @var bool
e501603b
TO
92 */
93 public $is_payment;
c3fc2621 94
e501603b
TO
95 /**
96 * Transaction id supplied by external processor. This may not be unique.
97 *
98 * @var string
99 */
100 public $trxn_id;
c3fc2621 101
e501603b
TO
102 /**
103 * processor result code
104 *
105 * @var string
106 */
107 public $trxn_result_code;
c3fc2621 108
e501603b
TO
109 /**
110 * pseudo FK to civicrm_option_value of contribution_status_id option_group
111 *
e6ca0a57 112 * @var int
e501603b
TO
113 */
114 public $status_id;
c3fc2621 115
e501603b
TO
116 /**
117 * Payment Processor for this financial transaction
118 *
e6ca0a57 119 * @var int
e501603b
TO
120 */
121 public $payment_processor_id;
c3fc2621 122
e501603b
TO
123 /**
124 * FK to payment_instrument option group values
125 *
e6ca0a57 126 * @var int
e501603b
TO
127 */
128 public $payment_instrument_id;
c3fc2621 129
ea927522
PN
130 /**
131 * FK to accept_creditcard option group values
132 *
e6ca0a57 133 * @var int
ea927522 134 */
5e0343e8 135 public $card_type_id;
c3fc2621 136
e501603b
TO
137 /**
138 * Check number
139 *
140 * @var string
141 */
142 public $check_number;
c3fc2621 143
ea927522
PN
144 /**
145 * Last 4 digits of credit card
146 *
4e0ede5a 147 * @var string
ea927522
PN
148 */
149 public $pan_truncation;
c3fc2621 150
1f34d30a
AS
151 /**
152 * Payment Processor external order reference
153 *
154 * @var string
155 */
156 public $order_reference;
157
e501603b 158 /**
f41f0342 159 * Class constructor.
e501603b 160 */
c3fc2621 161 public function __construct() {
e501603b
TO
162 $this->__table = 'civicrm_financial_trxn';
163 parent::__construct();
164 }
c3fc2621 165
449c4e6b
CW
166 /**
167 * Returns localized title of this entity.
7b66c3b5
AH
168 *
169 * @param bool $plural
170 * Whether to return the plural version of the title.
449c4e6b 171 */
7b66c3b5
AH
172 public static function getEntityTitle($plural = FALSE) {
173 return $plural ? ts('Financial Trxns') : ts('Financial Trxn');
449c4e6b
CW
174 }
175
e501603b 176 /**
f41f0342 177 * Returns foreign keys and entity references.
e501603b
TO
178 *
179 * @return array
180 * [CRM_Core_Reference_Interface]
181 */
c3fc2621 182 public static function getReferenceColumns() {
346aaaba 183 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 184 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
185 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'from_financial_account_id', 'civicrm_financial_account', 'id');
186 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'to_financial_account_id', 'civicrm_financial_account', 'id');
187 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'payment_processor_id', 'civicrm_payment_processor', 'id');
346aaaba 188 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 189 }
346aaaba 190 return Civi::$statics[__CLASS__]['links'];
e501603b 191 }
c3fc2621 192
e501603b
TO
193 /**
194 * Returns all the column names of this table
195 *
196 * @return array
197 */
c3fc2621 198 public static function &fields() {
346aaaba 199 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
200 Civi::$statics[__CLASS__]['fields'] = [
201 'id' => [
e501603b
TO
202 'name' => 'id',
203 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
204 'title' => ts('Financial Transaction ID'),
205 'required' => TRUE,
a36434b9 206 'where' => 'civicrm_financial_trxn.id',
522a26c9 207 'table_name' => 'civicrm_financial_trxn',
208 'entity' => 'FinancialTrxn',
209 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
6a7e5e5d 210 'localizable' => 0,
2cbbebe8
A
211 'html' => [
212 'type' => 'Number',
213 ],
1fe423d6 214 'readonly' => TRUE,
a9d0587b 215 'add' => '1.3',
c3fc2621
CW
216 ],
217 'from_financial_account_id' => [
e501603b
TO
218 'name' => 'from_financial_account_id',
219 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 220 'title' => ts('From Account ID'),
215b423e 221 'description' => ts('FK to financial_account table.'),
a36434b9 222 'where' => 'civicrm_financial_trxn.from_financial_account_id',
522a26c9 223 'table_name' => 'civicrm_financial_trxn',
224 'entity' => 'FinancialTrxn',
225 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
6a7e5e5d 226 'localizable' => 0,
e501603b 227 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
c3fc2621 228 'html' => [
e501603b 229 'type' => 'Select',
2cbbebe8 230 'label' => ts("From Account"),
c3fc2621
CW
231 ],
232 'pseudoconstant' => [
e501603b
TO
233 'table' => 'civicrm_financial_account',
234 'keyColumn' => 'id',
235 'labelColumn' => 'name',
e6ca0a57 236 ],
a9d0587b 237 'add' => '4.3',
c3fc2621
CW
238 ],
239 'to_financial_account_id' => [
e501603b
TO
240 'name' => 'to_financial_account_id',
241 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 242 'title' => ts('To Account ID'),
215b423e 243 'description' => ts('FK to financial_financial_account table.'),
a36434b9 244 'where' => 'civicrm_financial_trxn.to_financial_account_id',
522a26c9 245 'table_name' => 'civicrm_financial_trxn',
246 'entity' => 'FinancialTrxn',
247 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
6a7e5e5d 248 'localizable' => 0,
e501603b 249 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
c3fc2621 250 'html' => [
e501603b 251 'type' => 'Select',
2cbbebe8 252 'label' => ts("To Account"),
c3fc2621
CW
253 ],
254 'pseudoconstant' => [
e501603b
TO
255 'table' => 'civicrm_financial_account',
256 'keyColumn' => 'id',
257 'labelColumn' => 'name',
e6ca0a57 258 ],
a9d0587b 259 'add' => '4.3',
c3fc2621
CW
260 ],
261 'trxn_date' => [
e501603b
TO
262 'name' => 'trxn_date',
263 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 264 'title' => ts('Financial Transaction Date'),
215b423e 265 'description' => ts('date transaction occurred'),
a36434b9 266 'where' => 'civicrm_financial_trxn.trxn_date',
e501603b 267 'default' => 'NULL',
522a26c9 268 'table_name' => 'civicrm_financial_trxn',
269 'entity' => 'FinancialTrxn',
270 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
6a7e5e5d 271 'localizable' => 0,
c3fc2621 272 'html' => [
f7fb5615 273 'type' => 'Select Date',
274 'formatType' => 'activityDateTime',
c3fc2621 275 ],
a9d0587b 276 'add' => '1.3',
c3fc2621
CW
277 ],
278 'total_amount' => [
e501603b
TO
279 'name' => 'total_amount',
280 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 281 'title' => ts('Financial Total Amount'),
215b423e 282 'description' => ts('amount of transaction'),
c3fc2621
CW
283 'required' => TRUE,
284 'precision' => [
e501603b 285 20,
fb607354 286 2,
c3fc2621 287 ],
a36434b9 288 'where' => 'civicrm_financial_trxn.total_amount',
522a26c9 289 'table_name' => 'civicrm_financial_trxn',
290 'entity' => 'FinancialTrxn',
291 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
6a7e5e5d 292 'localizable' => 0,
a9d0587b 293 'add' => '1.3',
c3fc2621
CW
294 ],
295 'fee_amount' => [
e501603b
TO
296 'name' => 'fee_amount',
297 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 298 'title' => ts('Financial Fee Amount'),
215b423e 299 'description' => ts('actual processor fee if known - may be 0.'),
c3fc2621 300 'precision' => [
e501603b 301 20,
fb607354 302 2,
c3fc2621 303 ],
a36434b9 304 'where' => 'civicrm_financial_trxn.fee_amount',
522a26c9 305 'table_name' => 'civicrm_financial_trxn',
306 'entity' => 'FinancialTrxn',
307 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
6a7e5e5d 308 'localizable' => 0,
a9d0587b 309 'add' => '1.3',
c3fc2621
CW
310 ],
311 'net_amount' => [
e501603b
TO
312 'name' => 'net_amount',
313 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 314 'title' => ts('Financial Net Amount'),
215b423e 315 '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 316 'precision' => [
e501603b 317 20,
fb607354 318 2,
c3fc2621 319 ],
a36434b9 320 'where' => 'civicrm_financial_trxn.net_amount',
522a26c9 321 'table_name' => 'civicrm_financial_trxn',
322 'entity' => 'FinancialTrxn',
323 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
6a7e5e5d 324 'localizable' => 0,
a9d0587b 325 'add' => '1.3',
c3fc2621
CW
326 ],
327 'currency' => [
e501603b
TO
328 'name' => 'currency',
329 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 330 'title' => ts('Financial Currency'),
215b423e 331 'description' => ts('3 character string, value from config setting or input via user.'),
e501603b
TO
332 'maxlength' => 3,
333 'size' => CRM_Utils_Type::FOUR,
c3fc2621 334 'import' => TRUE,
e501603b
TO
335 'where' => 'civicrm_financial_trxn.currency',
336 'headerPattern' => '/cur(rency)?/i',
337 'dataPattern' => '/^[A-Z]{3}$/',
c3fc2621 338 'export' => TRUE,
e501603b 339 'default' => 'NULL',
522a26c9 340 'table_name' => 'civicrm_financial_trxn',
341 'entity' => 'FinancialTrxn',
342 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
6a7e5e5d 343 'localizable' => 0,
c3fc2621 344 'html' => [
e501603b 345 'type' => 'Select',
c3fc2621
CW
346 ],
347 'pseudoconstant' => [
e501603b
TO
348 'table' => 'civicrm_currency',
349 'keyColumn' => 'name',
350 'labelColumn' => 'full_name',
351 'nameColumn' => 'name',
a8fdb24e 352 'abbrColumn' => 'symbol',
e6ca0a57 353 ],
a9d0587b 354 'add' => '1.3',
c3fc2621
CW
355 ],
356 'is_payment' => [
e501603b
TO
357 'name' => 'is_payment',
358 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 359 'title' => ts('Is Payment?'),
215b423e 360 'description' => ts('Is this entry either a payment or a reversal of a payment?'),
c3fc2621 361 'import' => TRUE,
e501603b 362 'where' => 'civicrm_financial_trxn.is_payment',
c3fc2621 363 'export' => TRUE,
45a83e42 364 'default' => '0',
522a26c9 365 'table_name' => 'civicrm_financial_trxn',
366 'entity' => 'FinancialTrxn',
367 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
6a7e5e5d 368 'localizable' => 0,
a9d0587b 369 'add' => '4.7',
c3fc2621
CW
370 ],
371 'trxn_id' => [
e501603b
TO
372 'name' => 'trxn_id',
373 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 374 'title' => ts('Transaction ID'),
215b423e 375 'description' => ts('Transaction id supplied by external processor. This may not be unique.'),
e501603b 376 'maxlength' => 255,
a7a8f17d 377 'size' => 10,
a36434b9 378 'where' => 'civicrm_financial_trxn.trxn_id',
522a26c9 379 'table_name' => 'civicrm_financial_trxn',
380 'entity' => 'FinancialTrxn',
381 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
6a7e5e5d 382 'localizable' => 0,
c3fc2621 383 'html' => [
a7a8f17d 384 'type' => 'Text',
c3fc2621 385 ],
a9d0587b 386 'add' => '1.3',
c3fc2621
CW
387 ],
388 'trxn_result_code' => [
e501603b
TO
389 'name' => 'trxn_result_code',
390 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 391 'title' => ts('Transaction Result Code'),
215b423e 392 'description' => ts('processor result code'),
e501603b
TO
393 'maxlength' => 255,
394 'size' => CRM_Utils_Type::HUGE,
a36434b9 395 'where' => 'civicrm_financial_trxn.trxn_result_code',
522a26c9 396 'table_name' => 'civicrm_financial_trxn',
397 'entity' => 'FinancialTrxn',
398 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
6a7e5e5d 399 'localizable' => 0,
a9d0587b 400 'add' => '1.3',
c3fc2621
CW
401 ],
402 'status_id' => [
e501603b
TO
403 'name' => 'status_id',
404 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 405 'title' => ts('Financial Transaction Status ID'),
215b423e 406 'description' => ts('pseudo FK to civicrm_option_value of contribution_status_id option_group'),
c3fc2621 407 'import' => TRUE,
e501603b
TO
408 'where' => 'civicrm_financial_trxn.status_id',
409 'headerPattern' => '/status/i',
c3fc2621 410 'export' => TRUE,
522a26c9 411 'table_name' => 'civicrm_financial_trxn',
412 'entity' => 'FinancialTrxn',
413 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
6a7e5e5d 414 'localizable' => 0,
c3fc2621 415 'pseudoconstant' => [
e501603b
TO
416 'optionGroupName' => 'contribution_status',
417 'optionEditPath' => 'civicrm/admin/options/contribution_status',
e6ca0a57 418 ],
a9d0587b 419 'add' => '4.3',
c3fc2621
CW
420 ],
421 'payment_processor_id' => [
e501603b
TO
422 'name' => 'payment_processor_id',
423 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 424 'title' => ts('Payment Processor ID'),
215b423e 425 'description' => ts('Payment Processor for this financial transaction'),
a36434b9 426 'where' => 'civicrm_financial_trxn.payment_processor_id',
522a26c9 427 'table_name' => 'civicrm_financial_trxn',
428 'entity' => 'FinancialTrxn',
429 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
6a7e5e5d 430 'localizable' => 0,
e501603b 431 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
68fba329
MW
432 'html' => [
433 'type' => 'Select',
2cbbebe8 434 'label' => ts("Payment Processor"),
68fba329
MW
435 ],
436 'pseudoconstant' => [
437 'table' => 'civicrm_payment_processor',
438 'keyColumn' => 'id',
439 'labelColumn' => 'name',
440 ],
a9d0587b 441 'add' => '4.3',
c3fc2621
CW
442 ],
443 'financial_trxn_payment_instrument_id' => [
e501603b
TO
444 'name' => 'payment_instrument_id',
445 'type' => CRM_Utils_Type::T_INT,
c3fc2621 446 'title' => ts('Payment Method'),
215b423e 447 'description' => ts('FK to payment_instrument option group values'),
a36434b9 448 'where' => 'civicrm_financial_trxn.payment_instrument_id',
522a26c9 449 'table_name' => 'civicrm_financial_trxn',
450 'entity' => 'FinancialTrxn',
451 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
6a7e5e5d 452 'localizable' => 0,
c3fc2621 453 'html' => [
e501603b 454 'type' => 'Select',
c3fc2621
CW
455 ],
456 'pseudoconstant' => [
e501603b
TO
457 'optionGroupName' => 'payment_instrument',
458 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
e6ca0a57 459 ],
a9d0587b 460 'add' => '4.3',
c3fc2621
CW
461 ],
462 'financial_trxn_card_type_id' => [
5e0343e8 463 'name' => 'card_type_id',
ea927522 464 'type' => CRM_Utils_Type::T_INT,
c3fc2621 465 'title' => ts('Card Type ID'),
215b423e 466 'description' => ts('FK to accept_creditcard option group values'),
a36434b9 467 'where' => 'civicrm_financial_trxn.card_type_id',
ea927522
PN
468 'table_name' => 'civicrm_financial_trxn',
469 'entity' => 'FinancialTrxn',
470 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
6a7e5e5d 471 'localizable' => 0,
c3fc2621 472 'html' => [
ea927522 473 'type' => 'Select',
c3fc2621
CW
474 ],
475 'pseudoconstant' => [
ea927522
PN
476 'optionGroupName' => 'accept_creditcard',
477 'optionEditPath' => 'civicrm/admin/options/accept_creditcard',
e6ca0a57 478 ],
a9d0587b 479 'add' => '4.7',
c3fc2621
CW
480 ],
481 'financial_trxn_check_number' => [
e501603b
TO
482 'name' => 'check_number',
483 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 484 'title' => ts('Check Number'),
215b423e 485 'description' => ts('Check number'),
e501603b
TO
486 'maxlength' => 255,
487 'size' => 6,
a36434b9 488 'where' => 'civicrm_financial_trxn.check_number',
522a26c9 489 'table_name' => 'civicrm_financial_trxn',
490 'entity' => 'FinancialTrxn',
491 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
6a7e5e5d 492 'localizable' => 0,
c3fc2621 493 'html' => [
e501603b 494 'type' => 'Text',
c3fc2621 495 ],
a9d0587b 496 'add' => '4.3',
c3fc2621
CW
497 ],
498 'financial_trxn_pan_truncation' => [
ea927522 499 'name' => 'pan_truncation',
4e0ede5a 500 'type' => CRM_Utils_Type::T_STRING,
031f6a5f 501 'title' => ts('PAN Truncation'),
215b423e 502 'description' => ts('Last 4 digits of credit card'),
4e0ede5a
PN
503 'maxlength' => 4,
504 'size' => 4,
a36434b9 505 'where' => 'civicrm_financial_trxn.pan_truncation',
ea927522
PN
506 'table_name' => 'civicrm_financial_trxn',
507 'entity' => 'FinancialTrxn',
508 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
6a7e5e5d 509 'localizable' => 0,
c3fc2621 510 'html' => [
ea927522 511 'type' => 'Text',
c3fc2621 512 ],
a9d0587b 513 'add' => '4.7',
c3fc2621 514 ],
1f34d30a
AS
515 'financial_trxn_order_reference' => [
516 'name' => 'order_reference',
517 'type' => CRM_Utils_Type::T_STRING,
518 'title' => ts('Order Reference'),
519 'description' => ts('Payment Processor external order reference'),
520 'maxlength' => 255,
521 'size' => 25,
522 'where' => 'civicrm_financial_trxn.order_reference',
523 'table_name' => 'civicrm_financial_trxn',
524 'entity' => 'FinancialTrxn',
525 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
526 'localizable' => 0,
527 'html' => [
528 'type' => 'Text',
529 ],
a9d0587b 530 'add' => '5.20',
1f34d30a 531 ],
c3fc2621 532 ];
346aaaba 533 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 534 }
346aaaba 535 return Civi::$statics[__CLASS__]['fields'];
e501603b 536 }
c3fc2621 537
e501603b 538 /**
bd8e0b14 539 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
540 *
541 * @return array
bd8e0b14 542 * Array(string $name => string $uniqueName).
e501603b 543 */
c3fc2621 544 public static function &fieldKeys() {
bd8e0b14
TO
545 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
546 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 547 }
bd8e0b14 548 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 549 }
c3fc2621 550
e501603b
TO
551 /**
552 * Returns the names of this table
553 *
554 * @return string
555 */
c3fc2621 556 public static function getTableName() {
e501603b
TO
557 return self::$_tableName;
558 }
c3fc2621 559
e501603b
TO
560 /**
561 * Returns if this table needs to be logged
562 *
c3fc2621 563 * @return bool
e501603b 564 */
c3fc2621 565 public function getLog() {
e501603b
TO
566 return self::$_log;
567 }
c3fc2621 568
e501603b
TO
569 /**
570 * Returns the list of fields that can be imported
571 *
572 * @param bool $prefix
573 *
574 * @return array
575 */
c3fc2621
CW
576 public static function &import($prefix = FALSE) {
577 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'financial_trxn', $prefix, []);
60808919 578 return $r;
e501603b 579 }
c3fc2621 580
e501603b
TO
581 /**
582 * Returns the list of fields that can be exported
583 *
584 * @param bool $prefix
585 *
586 * @return array
587 */
c3fc2621
CW
588 public static function &export($prefix = FALSE) {
589 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'financial_trxn', $prefix, []);
60808919 590 return $r;
e501603b 591 }
c3fc2621 592
e7a6b91a
AS
593 /**
594 * Returns the list of indices
c3fc2621
CW
595 *
596 * @param bool $localize
597 *
598 * @return array
e7a6b91a
AS
599 */
600 public static function indices($localize = TRUE) {
c3fc2621
CW
601 $indices = [
602 'UI_ftrxn_trxn_id' => [
e7a6b91a 603 'name' => 'UI_ftrxn_trxn_id',
c3fc2621 604 'field' => [
e7a6b91a 605 0 => 'trxn_id',
c3fc2621
CW
606 ],
607 'localizable' => FALSE,
e7a6b91a 608 'sig' => 'civicrm_financial_trxn::0::trxn_id',
c3fc2621
CW
609 ],
610 'UI_ftrxn_payment_instrument_id' => [
e7a6b91a 611 'name' => 'UI_ftrxn_payment_instrument_id',
c3fc2621 612 'field' => [
e7a6b91a 613 0 => 'payment_instrument_id',
c3fc2621
CW
614 ],
615 'localizable' => FALSE,
e7a6b91a 616 'sig' => 'civicrm_financial_trxn::0::payment_instrument_id',
c3fc2621
CW
617 ],
618 'UI_ftrxn_check_number' => [
e7a6b91a 619 'name' => 'UI_ftrxn_check_number',
c3fc2621 620 'field' => [
e7a6b91a 621 0 => 'check_number',
c3fc2621
CW
622 ],
623 'localizable' => FALSE,
e7a6b91a 624 'sig' => 'civicrm_financial_trxn::0::check_number',
c3fc2621
CW
625 ],
626 ];
e7a6b91a
AS
627 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
628 }
c3fc2621 629
e501603b 630}