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:2c30f842e4a913eaac8e180219bc522e)
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
141 public $card_type_id;
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 'type' => 'Select Date',
245 'formatType' => 'activityDateTime',
248 'total_amount' => array(
249 'name' => 'total_amount',
250 'type' => CRM_Utils_Type
::T_MONEY
,
251 'title' => ts('Financial Total Amount') ,
252 'description' => 'amount of transaction',
254 'precision' => array(
258 'table_name' => 'civicrm_financial_trxn',
259 'entity' => 'FinancialTrxn',
260 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
263 'fee_amount' => array(
264 'name' => 'fee_amount',
265 'type' => CRM_Utils_Type
::T_MONEY
,
266 'title' => ts('Financial Fee Amount') ,
267 'description' => 'actual processor fee if known - may be 0.',
268 'precision' => array(
272 'table_name' => 'civicrm_financial_trxn',
273 'entity' => 'FinancialTrxn',
274 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
277 'net_amount' => array(
278 'name' => 'net_amount',
279 'type' => CRM_Utils_Type
::T_MONEY
,
280 'title' => ts('Financial Net Amount') ,
281 'description' => 'actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.',
282 'precision' => array(
286 'table_name' => 'civicrm_financial_trxn',
287 'entity' => 'FinancialTrxn',
288 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
292 'name' => 'currency',
293 'type' => CRM_Utils_Type
::T_STRING
,
294 'title' => ts('Financial Currency') ,
295 'description' => '3 character string, value from config setting or input via user.',
297 'size' => CRM_Utils_Type
::FOUR
,
299 'where' => 'civicrm_financial_trxn.currency',
300 'headerPattern' => '/cur(rency)?/i',
301 'dataPattern' => '/^[A-Z]{3}$/',
304 'table_name' => 'civicrm_financial_trxn',
305 'entity' => 'FinancialTrxn',
306 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
311 'pseudoconstant' => array(
312 'table' => 'civicrm_currency',
313 'keyColumn' => 'name',
314 'labelColumn' => 'full_name',
315 'nameColumn' => 'name',
318 'is_payment' => array(
319 'name' => 'is_payment',
320 'type' => CRM_Utils_Type
::T_BOOLEAN
,
321 'title' => ts('Is Payment?') ,
322 'description' => 'Is this entry either a payment or a reversal of a payment?',
324 'where' => 'civicrm_financial_trxn.is_payment',
325 'headerPattern' => '',
328 'table_name' => 'civicrm_financial_trxn',
329 'entity' => 'FinancialTrxn',
330 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
335 'type' => CRM_Utils_Type
::T_STRING
,
336 'title' => ts('Transaction ID') ,
337 'description' => 'Transaction id supplied by external processor. This may not be unique.',
339 'size' => CRM_Utils_Type
::HUGE
,
340 'table_name' => 'civicrm_financial_trxn',
341 'entity' => 'FinancialTrxn',
342 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
345 'trxn_result_code' => array(
346 'name' => 'trxn_result_code',
347 'type' => CRM_Utils_Type
::T_STRING
,
348 'title' => ts('Transaction Result Code') ,
349 'description' => 'processor result code',
351 'size' => CRM_Utils_Type
::HUGE
,
352 'table_name' => 'civicrm_financial_trxn',
353 'entity' => 'FinancialTrxn',
354 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
357 'status_id' => array(
358 'name' => 'status_id',
359 'type' => CRM_Utils_Type
::T_INT
,
360 'title' => ts('Financial Transaction Status Id') ,
361 'description' => 'pseudo FK to civicrm_option_value of contribution_status_id option_group',
363 'where' => 'civicrm_financial_trxn.status_id',
364 'headerPattern' => '/status/i',
367 'table_name' => 'civicrm_financial_trxn',
368 'entity' => 'FinancialTrxn',
369 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
371 'pseudoconstant' => array(
372 'optionGroupName' => 'contribution_status',
373 'optionEditPath' => 'civicrm/admin/options/contribution_status',
376 'payment_processor_id' => array(
377 'name' => 'payment_processor_id',
378 'type' => CRM_Utils_Type
::T_INT
,
379 'title' => ts('Payment Processor') ,
380 'description' => 'Payment Processor for this financial transaction',
381 'table_name' => 'civicrm_financial_trxn',
382 'entity' => 'FinancialTrxn',
383 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
385 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
387 'financial_trxn_payment_instrument_id' => array(
388 'name' => 'payment_instrument_id',
389 'type' => CRM_Utils_Type
::T_INT
,
390 'title' => ts('Payment Method') ,
391 'description' => 'FK to payment_instrument option group values',
392 'table_name' => 'civicrm_financial_trxn',
393 'entity' => 'FinancialTrxn',
394 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
399 'pseudoconstant' => array(
400 'optionGroupName' => 'payment_instrument',
401 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
404 'financial_trxn_card_type_id' => array(
405 'name' => 'card_type_id',
406 'type' => CRM_Utils_Type
::T_INT
,
407 'title' => ts('Card Type ID') ,
408 'description' => 'FK to accept_creditcard option group values',
409 'table_name' => 'civicrm_financial_trxn',
410 'entity' => 'FinancialTrxn',
411 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
416 'pseudoconstant' => array(
417 'optionGroupName' => 'accept_creditcard',
418 'optionEditPath' => 'civicrm/admin/options/accept_creditcard',
421 'financial_trxn_check_number' => array(
422 'name' => 'check_number',
423 'type' => CRM_Utils_Type
::T_STRING
,
424 'title' => ts('Check Number') ,
425 'description' => 'Check number',
428 'table_name' => 'civicrm_financial_trxn',
429 'entity' => 'FinancialTrxn',
430 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
436 'financial_trxn_pan_truncation' => array(
437 'name' => 'pan_truncation',
438 'type' => CRM_Utils_Type
::T_INT
,
439 'title' => ts('Pan Truncation') ,
440 'description' => 'Last 4 digits of credit card',
441 'table_name' => 'civicrm_financial_trxn',
442 'entity' => 'FinancialTrxn',
443 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
450 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
452 return Civi
::$statics[__CLASS__
]['fields'];
455 * Return a mapping from field-name to the corresponding key (as used in fields()).
458 * Array(string $name => string $uniqueName).
460 static function &fieldKeys() {
461 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
462 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
464 return Civi
::$statics[__CLASS__
]['fieldKeys'];
467 * Returns the names of this table
471 static function getTableName() {
472 return self
::$_tableName;
475 * Returns if this table needs to be logged
483 * Returns the list of fields that can be imported
485 * @param bool $prefix
489 static function &import($prefix = false) {
490 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'financial_trxn', $prefix, array());
494 * Returns the list of fields that can be exported
496 * @param bool $prefix
500 static function &export($prefix = false) {
501 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'financial_trxn', $prefix, array());
505 * Returns the list of indices
507 public static function indices($localize = TRUE) {
509 'UI_ftrxn_trxn_id' => array(
510 'name' => 'UI_ftrxn_trxn_id',
514 'localizable' => false,
515 'sig' => 'civicrm_financial_trxn::0::trxn_id',
517 'UI_ftrxn_payment_instrument_id' => array(
518 'name' => 'UI_ftrxn_payment_instrument_id',
520 0 => 'payment_instrument_id',
522 'localizable' => false,
523 'sig' => 'civicrm_financial_trxn::0::payment_instrument_id',
525 'UI_ftrxn_check_number' => array(
526 'name' => 'UI_ftrxn_check_number',
530 'localizable' => false,
531 'sig' => 'civicrm_financial_trxn::0::check_number',
534 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;