3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
29 * @copyright CiviCRM LLC (c) 2004-2017
31 * Generated from xml/schema/CRM/Financial/FinancialTrxn.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:68f0081011769a1c3286c7d7a74324e3)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
38 * CRM_Financial_DAO_FinancialTrxn constructor.
40 class CRM_Financial_DAO_FinancialTrxn
extends CRM_Core_DAO
{
42 * Static instance to hold the table name.
46 static $_tableName = 'civicrm_financial_trxn';
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
59 * FK to financial_account table.
63 public $from_financial_account_id;
65 * FK to financial_financial_account table.
69 public $to_financial_account_id;
71 * date transaction occurred
77 * amount of transaction
83 * actual processor fee if known - may be 0.
89 * actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.
95 * 3 character string, value from config setting or input via user.
101 * Is this entry either a payment or a reversal of a payment?
107 * Transaction id supplied by external processor. This may not be unique.
113 * processor result code
117 public $trxn_result_code;
119 * pseudo FK to civicrm_option_value of contribution_status_id option_group
125 * Payment Processor for this financial transaction
129 public $payment_processor_id;
131 * FK to payment_instrument option group values
135 public $payment_instrument_id;
137 * FK to accept_creditcard option group values
147 public $check_number;
149 * Last 4 digits of credit card
153 public $pan_truncation;
157 function __construct() {
158 $this->__table
= 'civicrm_financial_trxn';
159 parent
::__construct();
162 * Returns foreign keys and entity references.
165 * [CRM_Core_Reference_Interface]
167 static function getReferenceColumns() {
168 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
169 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
170 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'from_financial_account_id', 'civicrm_financial_account', 'id');
171 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'to_financial_account_id', 'civicrm_financial_account', 'id');
172 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'payment_processor_id', 'civicrm_payment_processor', 'id');
173 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
175 return Civi
::$statics[__CLASS__
]['links'];
178 * Returns all the column names of this table
182 static function &fields() {
183 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
184 Civi
::$statics[__CLASS__
]['fields'] = array(
187 'type' => CRM_Utils_Type
::T_INT
,
188 'title' => ts('Financial Transaction ID') ,
190 'table_name' => 'civicrm_financial_trxn',
191 'entity' => 'FinancialTrxn',
192 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
195 'from_financial_account_id' => array(
196 'name' => 'from_financial_account_id',
197 'type' => CRM_Utils_Type
::T_INT
,
198 'title' => ts('Financial Transaction From Account') ,
199 'description' => 'FK to financial_account table.',
200 'table_name' => 'civicrm_financial_trxn',
201 'entity' => 'FinancialTrxn',
202 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
204 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
208 'pseudoconstant' => array(
209 'table' => 'civicrm_financial_account',
211 'labelColumn' => 'name',
214 'to_financial_account_id' => array(
215 'name' => 'to_financial_account_id',
216 'type' => CRM_Utils_Type
::T_INT
,
217 'title' => ts('Financial Transaction To Account') ,
218 'description' => 'FK to financial_financial_account table.',
219 'table_name' => 'civicrm_financial_trxn',
220 'entity' => 'FinancialTrxn',
221 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
223 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
227 'pseudoconstant' => array(
228 'table' => 'civicrm_financial_account',
230 'labelColumn' => 'name',
233 'trxn_date' => array(
234 'name' => 'trxn_date',
235 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
236 'title' => ts('Financial Transaction Date') ,
237 'description' => 'date transaction occurred',
239 'table_name' => 'civicrm_financial_trxn',
240 'entity' => 'FinancialTrxn',
241 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
244 'total_amount' => array(
245 'name' => 'total_amount',
246 'type' => CRM_Utils_Type
::T_MONEY
,
247 'title' => ts('Financial Total Amount') ,
248 'description' => 'amount of transaction',
250 'precision' => array(
254 'table_name' => 'civicrm_financial_trxn',
255 'entity' => 'FinancialTrxn',
256 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
259 'fee_amount' => array(
260 'name' => 'fee_amount',
261 'type' => CRM_Utils_Type
::T_MONEY
,
262 'title' => ts('Financial Fee Amount') ,
263 'description' => 'actual processor fee if known - may be 0.',
264 'precision' => array(
268 'table_name' => 'civicrm_financial_trxn',
269 'entity' => 'FinancialTrxn',
270 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
273 'net_amount' => array(
274 'name' => 'net_amount',
275 'type' => CRM_Utils_Type
::T_MONEY
,
276 'title' => ts('Financial Net Amount') ,
277 'description' => 'actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.',
278 'precision' => array(
282 'table_name' => 'civicrm_financial_trxn',
283 'entity' => 'FinancialTrxn',
284 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
288 'name' => 'currency',
289 'type' => CRM_Utils_Type
::T_STRING
,
290 'title' => ts('Financial Currency') ,
291 'description' => '3 character string, value from config setting or input via user.',
293 'size' => CRM_Utils_Type
::FOUR
,
295 'where' => 'civicrm_financial_trxn.currency',
296 'headerPattern' => '/cur(rency)?/i',
297 'dataPattern' => '/^[A-Z]{3}$/',
300 'table_name' => 'civicrm_financial_trxn',
301 'entity' => 'FinancialTrxn',
302 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
307 'pseudoconstant' => array(
308 'table' => 'civicrm_currency',
309 'keyColumn' => 'name',
310 'labelColumn' => 'full_name',
311 'nameColumn' => 'name',
314 'is_payment' => array(
315 'name' => 'is_payment',
316 'type' => CRM_Utils_Type
::T_BOOLEAN
,
317 'title' => ts('Is Payment?') ,
318 'description' => 'Is this entry either a payment or a reversal of a payment?',
320 'where' => 'civicrm_financial_trxn.is_payment',
321 'headerPattern' => '',
324 'table_name' => 'civicrm_financial_trxn',
325 'entity' => 'FinancialTrxn',
326 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
331 'type' => CRM_Utils_Type
::T_STRING
,
332 'title' => ts('Transaction ID') ,
333 'description' => 'Transaction id supplied by external processor. This may not be unique.',
335 'size' => CRM_Utils_Type
::HUGE
,
336 'table_name' => 'civicrm_financial_trxn',
337 'entity' => 'FinancialTrxn',
338 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
341 'trxn_result_code' => array(
342 'name' => 'trxn_result_code',
343 'type' => CRM_Utils_Type
::T_STRING
,
344 'title' => ts('Transaction Result Code') ,
345 'description' => 'processor result code',
347 'size' => CRM_Utils_Type
::HUGE
,
348 'table_name' => 'civicrm_financial_trxn',
349 'entity' => 'FinancialTrxn',
350 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
353 'status_id' => array(
354 'name' => 'status_id',
355 'type' => CRM_Utils_Type
::T_INT
,
356 'title' => ts('Financial Transaction Status Id') ,
357 'description' => 'pseudo FK to civicrm_option_value of contribution_status_id option_group',
359 'where' => 'civicrm_financial_trxn.status_id',
360 'headerPattern' => '/status/i',
363 'table_name' => 'civicrm_financial_trxn',
364 'entity' => 'FinancialTrxn',
365 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
367 'pseudoconstant' => array(
368 'optionGroupName' => 'contribution_status',
369 'optionEditPath' => 'civicrm/admin/options/contribution_status',
372 'payment_processor_id' => array(
373 'name' => 'payment_processor_id',
374 'type' => CRM_Utils_Type
::T_INT
,
375 'title' => ts('Payment Processor') ,
376 'description' => 'Payment Processor for this financial transaction',
377 'table_name' => 'civicrm_financial_trxn',
378 'entity' => 'FinancialTrxn',
379 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
381 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
383 'financial_trxn_payment_instrument_id' => array(
384 'name' => 'payment_instrument_id',
385 'type' => CRM_Utils_Type
::T_INT
,
386 'title' => ts('Payment Method') ,
387 'description' => 'FK to payment_instrument option group values',
388 'table_name' => 'civicrm_financial_trxn',
389 'entity' => 'FinancialTrxn',
390 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
395 'pseudoconstant' => array(
396 'optionGroupName' => 'payment_instrument',
397 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
400 'financial_trxn_card_type' => array(
401 'name' => 'card_type',
402 'type' => CRM_Utils_Type
::T_INT
,
403 'title' => ts('Card Type') ,
404 'description' => 'FK to accept_creditcard option group values',
405 'table_name' => 'civicrm_financial_trxn',
406 'entity' => 'FinancialTrxn',
407 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
412 'pseudoconstant' => array(
413 'optionGroupName' => 'accept_creditcard',
414 'optionEditPath' => 'civicrm/admin/options/accept_creditcard',
417 'financial_trxn_check_number' => array(
418 'name' => 'check_number',
419 'type' => CRM_Utils_Type
::T_STRING
,
420 'title' => ts('Check Number') ,
421 'description' => 'Check number',
424 'table_name' => 'civicrm_financial_trxn',
425 'entity' => 'FinancialTrxn',
426 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
432 'financial_trxn_pan_truncation' => array(
433 'name' => 'pan_truncation',
434 'type' => CRM_Utils_Type
::T_INT
,
435 'title' => ts('Pan Truncation') ,
436 'description' => 'Last 4 digits of credit card',
437 'table_name' => 'civicrm_financial_trxn',
438 'entity' => 'FinancialTrxn',
439 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
446 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
448 return Civi
::$statics[__CLASS__
]['fields'];
451 * Return a mapping from field-name to the corresponding key (as used in fields()).
454 * Array(string $name => string $uniqueName).
456 static function &fieldKeys() {
457 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
458 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
460 return Civi
::$statics[__CLASS__
]['fieldKeys'];
463 * Returns the names of this table
467 static function getTableName() {
468 return self
::$_tableName;
471 * Returns if this table needs to be logged
479 * Returns the list of fields that can be imported
481 * @param bool $prefix
485 static function &import($prefix = false) {
486 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'financial_trxn', $prefix, array());
490 * Returns the list of fields that can be exported
492 * @param bool $prefix
496 static function &export($prefix = false) {
497 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'financial_trxn', $prefix, array());
501 * Returns the list of indices
503 public static function indices($localize = TRUE) {
505 'UI_ftrxn_trxn_id' => array(
506 'name' => 'UI_ftrxn_trxn_id',
510 'localizable' => false,
511 'sig' => 'civicrm_financial_trxn::0::trxn_id',
513 'UI_ftrxn_payment_instrument_id' => array(
514 'name' => 'UI_ftrxn_payment_instrument_id',
516 0 => 'payment_instrument_id',
518 'localizable' => false,
519 'sig' => 'civicrm_financial_trxn::0::payment_instrument_id',
521 'UI_ftrxn_check_number' => array(
522 'name' => 'UI_ftrxn_check_number',
526 'localizable' => false,
527 'sig' => 'civicrm_financial_trxn::0::check_number',
530 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;