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