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:5b87e37bc3aa9d445e74d1f5d38bdb61)
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 foreign keys and entity references.
167 * [CRM_Core_Reference_Interface]
169 public static function getReferenceColumns() {
170 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
171 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
172 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'from_financial_account_id', 'civicrm_financial_account', 'id');
173 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'to_financial_account_id', 'civicrm_financial_account', 'id');
174 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'payment_processor_id', 'civicrm_payment_processor', 'id');
175 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
177 return Civi
::$statics[__CLASS__
]['links'];
181 * Returns all the column names of this table
185 public static function &fields() {
186 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
187 Civi
::$statics[__CLASS__
]['fields'] = [
190 'type' => CRM_Utils_Type
::T_INT
,
191 'title' => ts('Financial Transaction ID'),
193 'where' => 'civicrm_financial_trxn.id',
194 'table_name' => 'civicrm_financial_trxn',
195 'entity' => 'FinancialTrxn',
196 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
199 'from_financial_account_id' => [
200 'name' => 'from_financial_account_id',
201 'type' => CRM_Utils_Type
::T_INT
,
202 'title' => ts('Financial Transaction From Account'),
203 'description' => ts('FK to financial_account table.'),
204 'where' => 'civicrm_financial_trxn.from_financial_account_id',
205 'table_name' => 'civicrm_financial_trxn',
206 'entity' => 'FinancialTrxn',
207 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
209 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
213 'pseudoconstant' => [
214 'table' => 'civicrm_financial_account',
216 'labelColumn' => 'name',
219 'to_financial_account_id' => [
220 'name' => 'to_financial_account_id',
221 'type' => CRM_Utils_Type
::T_INT
,
222 'title' => ts('Financial Transaction To Account'),
223 'description' => ts('FK to financial_financial_account table.'),
224 'where' => 'civicrm_financial_trxn.to_financial_account_id',
225 'table_name' => 'civicrm_financial_trxn',
226 'entity' => 'FinancialTrxn',
227 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
229 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
233 'pseudoconstant' => [
234 'table' => 'civicrm_financial_account',
236 'labelColumn' => 'name',
240 'name' => 'trxn_date',
241 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
242 'title' => ts('Financial Transaction Date'),
243 'description' => ts('date transaction occurred'),
244 'where' => 'civicrm_financial_trxn.trxn_date',
246 'table_name' => 'civicrm_financial_trxn',
247 'entity' => 'FinancialTrxn',
248 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
251 'type' => 'Select Date',
252 'formatType' => 'activityDateTime',
256 'name' => 'total_amount',
257 'type' => CRM_Utils_Type
::T_MONEY
,
258 'title' => ts('Financial Total Amount'),
259 'description' => ts('amount of transaction'),
265 'where' => 'civicrm_financial_trxn.total_amount',
266 'table_name' => 'civicrm_financial_trxn',
267 'entity' => 'FinancialTrxn',
268 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
272 'name' => 'fee_amount',
273 'type' => CRM_Utils_Type
::T_MONEY
,
274 'title' => ts('Financial Fee Amount'),
275 'description' => ts('actual processor fee if known - may be 0.'),
280 'where' => 'civicrm_financial_trxn.fee_amount',
281 'table_name' => 'civicrm_financial_trxn',
282 'entity' => 'FinancialTrxn',
283 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
287 'name' => 'net_amount',
288 'type' => CRM_Utils_Type
::T_MONEY
,
289 'title' => ts('Financial Net Amount'),
290 'description' => ts('actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.'),
295 'where' => 'civicrm_financial_trxn.net_amount',
296 'table_name' => 'civicrm_financial_trxn',
297 'entity' => 'FinancialTrxn',
298 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
302 'name' => 'currency',
303 'type' => CRM_Utils_Type
::T_STRING
,
304 'title' => ts('Financial Currency'),
305 'description' => ts('3 character string, value from config setting or input via user.'),
307 'size' => CRM_Utils_Type
::FOUR
,
309 'where' => 'civicrm_financial_trxn.currency',
310 'headerPattern' => '/cur(rency)?/i',
311 'dataPattern' => '/^[A-Z]{3}$/',
314 'table_name' => 'civicrm_financial_trxn',
315 'entity' => 'FinancialTrxn',
316 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
321 'pseudoconstant' => [
322 'table' => 'civicrm_currency',
323 'keyColumn' => 'name',
324 'labelColumn' => 'full_name',
325 'nameColumn' => 'name',
326 'abbrColumn' => 'symbol',
330 'name' => 'is_payment',
331 'type' => CRM_Utils_Type
::T_BOOLEAN
,
332 'title' => ts('Is Payment?'),
333 'description' => ts('Is this entry either a payment or a reversal of a payment?'),
335 'where' => 'civicrm_financial_trxn.is_payment',
338 'table_name' => 'civicrm_financial_trxn',
339 'entity' => 'FinancialTrxn',
340 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
345 'type' => CRM_Utils_Type
::T_STRING
,
346 'title' => ts('Transaction ID'),
347 'description' => ts('Transaction id supplied by external processor. This may not be unique.'),
350 'where' => 'civicrm_financial_trxn.trxn_id',
351 'table_name' => 'civicrm_financial_trxn',
352 'entity' => 'FinancialTrxn',
353 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
359 'trxn_result_code' => [
360 'name' => 'trxn_result_code',
361 'type' => CRM_Utils_Type
::T_STRING
,
362 'title' => ts('Transaction Result Code'),
363 'description' => ts('processor result code'),
365 'size' => CRM_Utils_Type
::HUGE
,
366 'where' => 'civicrm_financial_trxn.trxn_result_code',
367 'table_name' => 'civicrm_financial_trxn',
368 'entity' => 'FinancialTrxn',
369 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
373 'name' => 'status_id',
374 'type' => CRM_Utils_Type
::T_INT
,
375 'title' => ts('Financial Transaction Status Id'),
376 'description' => ts('pseudo FK to civicrm_option_value of contribution_status_id option_group'),
378 'where' => 'civicrm_financial_trxn.status_id',
379 'headerPattern' => '/status/i',
381 'table_name' => 'civicrm_financial_trxn',
382 'entity' => 'FinancialTrxn',
383 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
385 'pseudoconstant' => [
386 'optionGroupName' => 'contribution_status',
387 'optionEditPath' => 'civicrm/admin/options/contribution_status',
390 'payment_processor_id' => [
391 'name' => 'payment_processor_id',
392 'type' => CRM_Utils_Type
::T_INT
,
393 'title' => ts('Payment Processor'),
394 'description' => ts('Payment Processor for this financial transaction'),
395 'where' => 'civicrm_financial_trxn.payment_processor_id',
396 'table_name' => 'civicrm_financial_trxn',
397 'entity' => 'FinancialTrxn',
398 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
400 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
402 'financial_trxn_payment_instrument_id' => [
403 'name' => 'payment_instrument_id',
404 'type' => CRM_Utils_Type
::T_INT
,
405 'title' => ts('Payment Method'),
406 'description' => ts('FK to payment_instrument option group values'),
407 'where' => 'civicrm_financial_trxn.payment_instrument_id',
408 'table_name' => 'civicrm_financial_trxn',
409 'entity' => 'FinancialTrxn',
410 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
415 'pseudoconstant' => [
416 'optionGroupName' => 'payment_instrument',
417 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
420 'financial_trxn_card_type_id' => [
421 'name' => 'card_type_id',
422 'type' => CRM_Utils_Type
::T_INT
,
423 'title' => ts('Card Type ID'),
424 'description' => ts('FK to accept_creditcard option group values'),
425 'where' => 'civicrm_financial_trxn.card_type_id',
426 'table_name' => 'civicrm_financial_trxn',
427 'entity' => 'FinancialTrxn',
428 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
433 'pseudoconstant' => [
434 'optionGroupName' => 'accept_creditcard',
435 'optionEditPath' => 'civicrm/admin/options/accept_creditcard',
438 'financial_trxn_check_number' => [
439 'name' => 'check_number',
440 'type' => CRM_Utils_Type
::T_STRING
,
441 'title' => ts('Check Number'),
442 'description' => ts('Check number'),
445 'where' => 'civicrm_financial_trxn.check_number',
446 'table_name' => 'civicrm_financial_trxn',
447 'entity' => 'FinancialTrxn',
448 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
454 'financial_trxn_pan_truncation' => [
455 'name' => 'pan_truncation',
456 'type' => CRM_Utils_Type
::T_STRING
,
457 'title' => ts('PAN Truncation'),
458 'description' => ts('Last 4 digits of credit card'),
461 'where' => 'civicrm_financial_trxn.pan_truncation',
462 'table_name' => 'civicrm_financial_trxn',
463 'entity' => 'FinancialTrxn',
464 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
470 'financial_trxn_order_reference' => [
471 'name' => 'order_reference',
472 'type' => CRM_Utils_Type
::T_STRING
,
473 'title' => ts('Order Reference'),
474 'description' => ts('Payment Processor external order reference'),
477 'where' => 'civicrm_financial_trxn.order_reference',
478 'table_name' => 'civicrm_financial_trxn',
479 'entity' => 'FinancialTrxn',
480 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
487 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
489 return Civi
::$statics[__CLASS__
]['fields'];
493 * Return a mapping from field-name to the corresponding key (as used in fields()).
496 * Array(string $name => string $uniqueName).
498 public static function &fieldKeys() {
499 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
500 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
502 return Civi
::$statics[__CLASS__
]['fieldKeys'];
506 * Returns the names of this table
510 public static function getTableName() {
511 return self
::$_tableName;
515 * Returns if this table needs to be logged
519 public function getLog() {
524 * Returns the list of fields that can be imported
526 * @param bool $prefix
530 public static function &import($prefix = FALSE) {
531 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'financial_trxn', $prefix, []);
536 * Returns the list of fields that can be exported
538 * @param bool $prefix
542 public static function &export($prefix = FALSE) {
543 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'financial_trxn', $prefix, []);
548 * Returns the list of indices
550 * @param bool $localize
554 public static function indices($localize = TRUE) {
556 'UI_ftrxn_trxn_id' => [
557 'name' => 'UI_ftrxn_trxn_id',
561 'localizable' => FALSE,
562 'sig' => 'civicrm_financial_trxn::0::trxn_id',
564 'UI_ftrxn_payment_instrument_id' => [
565 'name' => 'UI_ftrxn_payment_instrument_id',
567 0 => 'payment_instrument_id',
569 'localizable' => FALSE,
570 'sig' => 'civicrm_financial_trxn::0::payment_instrument_id',
572 'UI_ftrxn_check_number' => [
573 'name' => 'UI_ftrxn_check_number',
577 'localizable' => FALSE,
578 'sig' => 'civicrm_financial_trxn::0::check_number',
581 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;