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:84188ea8db9380a96a74a4e577cb8b93)
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',
194 'from_financial_account_id' => array(
195 'name' => 'from_financial_account_id',
196 'type' => CRM_Utils_Type
::T_INT
,
197 'title' => ts('Financial Transaction From Account') ,
198 'description' => 'FK to financial_account table.',
199 'table_name' => 'civicrm_financial_trxn',
200 'entity' => 'FinancialTrxn',
201 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
202 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
206 'pseudoconstant' => array(
207 'table' => 'civicrm_financial_account',
209 'labelColumn' => 'name',
212 'to_financial_account_id' => array(
213 'name' => 'to_financial_account_id',
214 'type' => CRM_Utils_Type
::T_INT
,
215 'title' => ts('Financial Transaction To Account') ,
216 'description' => 'FK to financial_financial_account table.',
217 'table_name' => 'civicrm_financial_trxn',
218 'entity' => 'FinancialTrxn',
219 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
220 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
224 'pseudoconstant' => array(
225 'table' => 'civicrm_financial_account',
227 'labelColumn' => 'name',
230 'trxn_date' => array(
231 'name' => 'trxn_date',
232 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
233 'title' => ts('Financial Transaction Date') ,
234 'description' => 'date transaction occurred',
236 'table_name' => 'civicrm_financial_trxn',
237 'entity' => 'FinancialTrxn',
238 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
240 'total_amount' => array(
241 'name' => 'total_amount',
242 'type' => CRM_Utils_Type
::T_MONEY
,
243 'title' => ts('Financial Total Amount') ,
244 'description' => 'amount of transaction',
246 'precision' => array(
250 'table_name' => 'civicrm_financial_trxn',
251 'entity' => 'FinancialTrxn',
252 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
254 'fee_amount' => array(
255 'name' => 'fee_amount',
256 'type' => CRM_Utils_Type
::T_MONEY
,
257 'title' => ts('Financial Fee Amount') ,
258 'description' => 'actual processor fee if known - may be 0.',
259 'precision' => array(
263 'table_name' => 'civicrm_financial_trxn',
264 'entity' => 'FinancialTrxn',
265 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
267 'net_amount' => array(
268 'name' => 'net_amount',
269 'type' => CRM_Utils_Type
::T_MONEY
,
270 'title' => ts('Financial Net Amount') ,
271 'description' => 'actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.',
272 'precision' => array(
276 'table_name' => 'civicrm_financial_trxn',
277 'entity' => 'FinancialTrxn',
278 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
281 'name' => 'currency',
282 'type' => CRM_Utils_Type
::T_STRING
,
283 'title' => ts('Financial Currency') ,
284 'description' => '3 character string, value from config setting or input via user.',
286 'size' => CRM_Utils_Type
::FOUR
,
288 'where' => 'civicrm_financial_trxn.currency',
289 'headerPattern' => '/cur(rency)?/i',
290 'dataPattern' => '/^[A-Z]{3}$/',
293 'table_name' => 'civicrm_financial_trxn',
294 'entity' => 'FinancialTrxn',
295 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
299 'pseudoconstant' => array(
300 'table' => 'civicrm_currency',
301 'keyColumn' => 'name',
302 'labelColumn' => 'full_name',
303 'nameColumn' => 'name',
306 'is_payment' => array(
307 'name' => 'is_payment',
308 'type' => CRM_Utils_Type
::T_BOOLEAN
,
309 'title' => ts('Is Payment?') ,
310 'description' => 'Is this entry either a payment or a reversal of a payment?',
312 'where' => 'civicrm_financial_trxn.is_payment',
313 'headerPattern' => '',
316 'table_name' => 'civicrm_financial_trxn',
317 'entity' => 'FinancialTrxn',
318 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
322 'type' => CRM_Utils_Type
::T_STRING
,
323 'title' => ts('Transaction ID') ,
324 'description' => 'Transaction id supplied by external processor. This may not be unique.',
326 'size' => CRM_Utils_Type
::HUGE
,
327 'table_name' => 'civicrm_financial_trxn',
328 'entity' => 'FinancialTrxn',
329 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
331 'trxn_result_code' => array(
332 'name' => 'trxn_result_code',
333 'type' => CRM_Utils_Type
::T_STRING
,
334 'title' => ts('Transaction Result Code') ,
335 'description' => 'processor result code',
337 'size' => CRM_Utils_Type
::HUGE
,
338 'table_name' => 'civicrm_financial_trxn',
339 'entity' => 'FinancialTrxn',
340 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
342 'status_id' => array(
343 'name' => 'status_id',
344 'type' => CRM_Utils_Type
::T_INT
,
345 'title' => ts('Financial Transaction Status Id') ,
346 'description' => 'pseudo FK to civicrm_option_value of contribution_status_id option_group',
348 'where' => 'civicrm_financial_trxn.status_id',
349 'headerPattern' => '/status/i',
352 'table_name' => 'civicrm_financial_trxn',
353 'entity' => 'FinancialTrxn',
354 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
355 'pseudoconstant' => array(
356 'optionGroupName' => 'contribution_status',
357 'optionEditPath' => 'civicrm/admin/options/contribution_status',
360 'payment_processor_id' => array(
361 'name' => 'payment_processor_id',
362 'type' => CRM_Utils_Type
::T_INT
,
363 'title' => ts('Payment Processor') ,
364 'description' => 'Payment Processor for this financial transaction',
365 'table_name' => 'civicrm_financial_trxn',
366 'entity' => 'FinancialTrxn',
367 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
368 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
370 'financial_trxn_payment_instrument_id' => array(
371 'name' => 'payment_instrument_id',
372 'type' => CRM_Utils_Type
::T_INT
,
373 'title' => ts('Payment Method') ,
374 'description' => 'FK to payment_instrument option group values',
375 'table_name' => 'civicrm_financial_trxn',
376 'entity' => 'FinancialTrxn',
377 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
381 'pseudoconstant' => array(
382 'optionGroupName' => 'payment_instrument',
383 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
386 'financial_trxn_card_type' => array(
387 'name' => 'card_type',
388 'type' => CRM_Utils_Type
::T_INT
,
389 'title' => ts('Card Type') ,
390 'description' => 'FK to accept_creditcard option group values',
391 'table_name' => 'civicrm_financial_trxn',
392 'entity' => 'FinancialTrxn',
393 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
397 'pseudoconstant' => array(
398 'optionGroupName' => 'accept_creditcard',
399 'optionEditPath' => 'civicrm/admin/options/accept_creditcard',
402 'financial_trxn_check_number' => array(
403 'name' => 'check_number',
404 'type' => CRM_Utils_Type
::T_STRING
,
405 'title' => ts('Check Number') ,
406 'description' => 'Check number',
409 'table_name' => 'civicrm_financial_trxn',
410 'entity' => 'FinancialTrxn',
411 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
416 'financial_trxn_pan_truncation' => array(
417 'name' => 'pan_truncation',
418 'type' => CRM_Utils_Type
::T_INT
,
419 'title' => ts('Pan Truncation') ,
420 'description' => 'Last 4 digits of credit card',
421 'table_name' => 'civicrm_financial_trxn',
422 'entity' => 'FinancialTrxn',
423 'bao' => 'CRM_Financial_DAO_FinancialTrxn',
429 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
431 return Civi
::$statics[__CLASS__
]['fields'];
434 * Return a mapping from field-name to the corresponding key (as used in fields()).
437 * Array(string $name => string $uniqueName).
439 static function &fieldKeys() {
440 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
441 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
443 return Civi
::$statics[__CLASS__
]['fieldKeys'];
446 * Returns the names of this table
450 static function getTableName() {
451 return self
::$_tableName;
454 * Returns if this table needs to be logged
462 * Returns the list of fields that can be imported
464 * @param bool $prefix
468 static function &import($prefix = false) {
469 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'financial_trxn', $prefix, array());
473 * Returns the list of fields that can be exported
475 * @param bool $prefix
479 static function &export($prefix = false) {
480 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'financial_trxn', $prefix, array());