5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Financial/FinancialTrxn.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:7e2cf7d374cc6e0af61672c0318248b6)
13 * Database access object for the FinancialTrxn entity.
15 class CRM_Financial_DAO_FinancialTrxn
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_financial_trxn';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
37 * FK to financial_account table.
41 public $from_financial_account_id;
44 * FK to financial_financial_account table.
48 public $to_financial_account_id;
51 * date transaction occurred
58 * amount of transaction
65 * actual processor fee if known - may be 0.
72 * actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.
79 * 3 character string, value from config setting or input via user.
86 * Is this entry either a payment or a reversal of a payment?
93 * Transaction id supplied by external processor. This may not be unique.
100 * processor result code
104 public $trxn_result_code;
107 * pseudo FK to civicrm_option_value of contribution_status_id option_group
114 * Payment Processor for this financial transaction
118 public $payment_processor_id;
121 * FK to payment_instrument option group values
125 public $payment_instrument_id;
128 * FK to accept_creditcard option group values
132 public $card_type_id;
139 public $check_number;
142 * Last 4 digits of credit card
146 public $pan_truncation;
149 * Payment Processor external order reference
153 public $order_reference;
158 public function __construct() {
159 $this->__table
= 'civicrm_financial_trxn';
160 parent
::__construct();
164 * Returns localized title of this entity.
166 public static function getEntityTitle() {
167 return ts('Financial Trxns');
171 * Returns foreign keys and entity references.
174 * [CRM_Core_Reference_Interface]
176 public static function getReferenceColumns() {
177 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
178 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
179 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'from_financial_account_id', 'civicrm_financial_account', 'id');
180 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'to_financial_account_id', 'civicrm_financial_account', 'id');
181 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'payment_processor_id', 'civicrm_payment_processor', 'id');
182 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
184 return Civi
::$statics[__CLASS__
]['links'];
188 * Returns all the column names of this table
192 public static function &fields() {
193 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
194 Civi
::$statics[__CLASS__
]['fields'] = [
197 'type' => CRM_Utils_Type
::T_INT
,
198 'title' => ts('Financial Transaction ID'),
200 'where' => 'civicrm_financial_trxn.id',
201 'table_name' => 'civicrm_financial_trxn',
202 'entity' => 'FinancialTrxn',
203 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
207 'from_financial_account_id' => [
208 'name' => 'from_financial_account_id',
209 'type' => CRM_Utils_Type
::T_INT
,
210 'title' => ts('Financial Transaction From Account'),
211 'description' => ts('FK to financial_account table.'),
212 'where' => 'civicrm_financial_trxn.from_financial_account_id',
213 'table_name' => 'civicrm_financial_trxn',
214 'entity' => 'FinancialTrxn',
215 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
217 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
221 'pseudoconstant' => [
222 'table' => 'civicrm_financial_account',
224 'labelColumn' => 'name',
228 'to_financial_account_id' => [
229 'name' => 'to_financial_account_id',
230 'type' => CRM_Utils_Type
::T_INT
,
231 'title' => ts('Financial Transaction To Account'),
232 'description' => ts('FK to financial_financial_account table.'),
233 'where' => 'civicrm_financial_trxn.to_financial_account_id',
234 'table_name' => 'civicrm_financial_trxn',
235 'entity' => 'FinancialTrxn',
236 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
238 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
242 'pseudoconstant' => [
243 'table' => 'civicrm_financial_account',
245 'labelColumn' => 'name',
250 'name' => 'trxn_date',
251 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
252 'title' => ts('Financial Transaction Date'),
253 'description' => ts('date transaction occurred'),
254 'where' => 'civicrm_financial_trxn.trxn_date',
256 'table_name' => 'civicrm_financial_trxn',
257 'entity' => 'FinancialTrxn',
258 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
261 'type' => 'Select Date',
262 'formatType' => 'activityDateTime',
267 'name' => 'total_amount',
268 'type' => CRM_Utils_Type
::T_MONEY
,
269 'title' => ts('Financial Total Amount'),
270 'description' => ts('amount of transaction'),
276 'where' => 'civicrm_financial_trxn.total_amount',
277 'table_name' => 'civicrm_financial_trxn',
278 'entity' => 'FinancialTrxn',
279 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
284 'name' => 'fee_amount',
285 'type' => CRM_Utils_Type
::T_MONEY
,
286 'title' => ts('Financial Fee Amount'),
287 'description' => ts('actual processor fee if known - may be 0.'),
292 'where' => 'civicrm_financial_trxn.fee_amount',
293 'table_name' => 'civicrm_financial_trxn',
294 'entity' => 'FinancialTrxn',
295 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
300 'name' => 'net_amount',
301 'type' => CRM_Utils_Type
::T_MONEY
,
302 'title' => ts('Financial Net Amount'),
303 'description' => ts('actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.'),
308 'where' => 'civicrm_financial_trxn.net_amount',
309 'table_name' => 'civicrm_financial_trxn',
310 'entity' => 'FinancialTrxn',
311 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
316 'name' => 'currency',
317 'type' => CRM_Utils_Type
::T_STRING
,
318 'title' => ts('Financial Currency'),
319 'description' => ts('3 character string, value from config setting or input via user.'),
321 'size' => CRM_Utils_Type
::FOUR
,
323 'where' => 'civicrm_financial_trxn.currency',
324 'headerPattern' => '/cur(rency)?/i',
325 'dataPattern' => '/^[A-Z]{3}$/',
328 'table_name' => 'civicrm_financial_trxn',
329 'entity' => 'FinancialTrxn',
330 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
335 'pseudoconstant' => [
336 'table' => 'civicrm_currency',
337 'keyColumn' => 'name',
338 'labelColumn' => 'full_name',
339 'nameColumn' => 'name',
340 'abbrColumn' => 'symbol',
345 'name' => 'is_payment',
346 'type' => CRM_Utils_Type
::T_BOOLEAN
,
347 'title' => ts('Is Payment?'),
348 'description' => ts('Is this entry either a payment or a reversal of a payment?'),
350 'where' => 'civicrm_financial_trxn.is_payment',
353 'table_name' => 'civicrm_financial_trxn',
354 'entity' => 'FinancialTrxn',
355 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
361 'type' => CRM_Utils_Type
::T_STRING
,
362 'title' => ts('Transaction ID'),
363 'description' => ts('Transaction id supplied by external processor. This may not be unique.'),
366 'where' => 'civicrm_financial_trxn.trxn_id',
367 'table_name' => 'civicrm_financial_trxn',
368 'entity' => 'FinancialTrxn',
369 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
376 'trxn_result_code' => [
377 'name' => 'trxn_result_code',
378 'type' => CRM_Utils_Type
::T_STRING
,
379 'title' => ts('Transaction Result Code'),
380 'description' => ts('processor result code'),
382 'size' => CRM_Utils_Type
::HUGE
,
383 'where' => 'civicrm_financial_trxn.trxn_result_code',
384 'table_name' => 'civicrm_financial_trxn',
385 'entity' => 'FinancialTrxn',
386 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
391 'name' => 'status_id',
392 'type' => CRM_Utils_Type
::T_INT
,
393 'title' => ts('Financial Transaction Status Id'),
394 'description' => ts('pseudo FK to civicrm_option_value of contribution_status_id option_group'),
396 'where' => 'civicrm_financial_trxn.status_id',
397 'headerPattern' => '/status/i',
399 'table_name' => 'civicrm_financial_trxn',
400 'entity' => 'FinancialTrxn',
401 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
403 'pseudoconstant' => [
404 'optionGroupName' => 'contribution_status',
405 'optionEditPath' => 'civicrm/admin/options/contribution_status',
409 'payment_processor_id' => [
410 'name' => 'payment_processor_id',
411 'type' => CRM_Utils_Type
::T_INT
,
412 'title' => ts('Payment Processor'),
413 'description' => ts('Payment Processor for this financial transaction'),
414 'where' => 'civicrm_financial_trxn.payment_processor_id',
415 'table_name' => 'civicrm_financial_trxn',
416 'entity' => 'FinancialTrxn',
417 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
419 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
422 'financial_trxn_payment_instrument_id' => [
423 'name' => 'payment_instrument_id',
424 'type' => CRM_Utils_Type
::T_INT
,
425 'title' => ts('Payment Method'),
426 'description' => ts('FK to payment_instrument option group values'),
427 'where' => 'civicrm_financial_trxn.payment_instrument_id',
428 'table_name' => 'civicrm_financial_trxn',
429 'entity' => 'FinancialTrxn',
430 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
435 'pseudoconstant' => [
436 'optionGroupName' => 'payment_instrument',
437 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
441 'financial_trxn_card_type_id' => [
442 'name' => 'card_type_id',
443 'type' => CRM_Utils_Type
::T_INT
,
444 'title' => ts('Card Type ID'),
445 'description' => ts('FK to accept_creditcard option group values'),
446 'where' => 'civicrm_financial_trxn.card_type_id',
447 'table_name' => 'civicrm_financial_trxn',
448 'entity' => 'FinancialTrxn',
449 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
454 'pseudoconstant' => [
455 'optionGroupName' => 'accept_creditcard',
456 'optionEditPath' => 'civicrm/admin/options/accept_creditcard',
460 'financial_trxn_check_number' => [
461 'name' => 'check_number',
462 'type' => CRM_Utils_Type
::T_STRING
,
463 'title' => ts('Check Number'),
464 'description' => ts('Check number'),
467 'where' => 'civicrm_financial_trxn.check_number',
468 'table_name' => 'civicrm_financial_trxn',
469 'entity' => 'FinancialTrxn',
470 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
477 'financial_trxn_pan_truncation' => [
478 'name' => 'pan_truncation',
479 'type' => CRM_Utils_Type
::T_STRING
,
480 'title' => ts('PAN Truncation'),
481 'description' => ts('Last 4 digits of credit card'),
484 'where' => 'civicrm_financial_trxn.pan_truncation',
485 'table_name' => 'civicrm_financial_trxn',
486 'entity' => 'FinancialTrxn',
487 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
494 'financial_trxn_order_reference' => [
495 'name' => 'order_reference',
496 'type' => CRM_Utils_Type
::T_STRING
,
497 'title' => ts('Order Reference'),
498 'description' => ts('Payment Processor external order reference'),
501 'where' => 'civicrm_financial_trxn.order_reference',
502 'table_name' => 'civicrm_financial_trxn',
503 'entity' => 'FinancialTrxn',
504 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
512 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
514 return Civi
::$statics[__CLASS__
]['fields'];
518 * Return a mapping from field-name to the corresponding key (as used in fields()).
521 * Array(string $name => string $uniqueName).
523 public static function &fieldKeys() {
524 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
525 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
527 return Civi
::$statics[__CLASS__
]['fieldKeys'];
531 * Returns the names of this table
535 public static function getTableName() {
536 return self
::$_tableName;
540 * Returns if this table needs to be logged
544 public function getLog() {
549 * Returns the list of fields that can be imported
551 * @param bool $prefix
555 public static function &import($prefix = FALSE) {
556 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'financial_trxn', $prefix, []);
561 * Returns the list of fields that can be exported
563 * @param bool $prefix
567 public static function &export($prefix = FALSE) {
568 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'financial_trxn', $prefix, []);
573 * Returns the list of indices
575 * @param bool $localize
579 public static function indices($localize = TRUE) {
581 'UI_ftrxn_trxn_id' => [
582 'name' => 'UI_ftrxn_trxn_id',
586 'localizable' => FALSE,
587 'sig' => 'civicrm_financial_trxn::0::trxn_id',
589 'UI_ftrxn_payment_instrument_id' => [
590 'name' => 'UI_ftrxn_payment_instrument_id',
592 0 => 'payment_instrument_id',
594 'localizable' => FALSE,
595 'sig' => 'civicrm_financial_trxn::0::payment_instrument_id',
597 'UI_ftrxn_check_number' => [
598 'name' => 'UI_ftrxn_check_number',
602 'localizable' => FALSE,
603 'sig' => 'civicrm_financial_trxn::0::check_number',
606 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;