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:fec5d6572bfe0de3f9dc41afd33fee9b)
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;
141 public $check_number;
145 function __construct() {
146 $this->__table
= 'civicrm_financial_trxn';
147 parent
::__construct();
150 * Returns foreign keys and entity references.
153 * [CRM_Core_Reference_Interface]
155 static function getReferenceColumns() {
156 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
157 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
158 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'from_financial_account_id', 'civicrm_financial_account', 'id');
159 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'to_financial_account_id', 'civicrm_financial_account', 'id');
160 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'payment_processor_id', 'civicrm_payment_processor', 'id');
161 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
163 return Civi
::$statics[__CLASS__
]['links'];
166 * Returns all the column names of this table
170 static function &fields() {
171 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
172 Civi
::$statics[__CLASS__
]['fields'] = array(
175 'type' => CRM_Utils_Type
::T_INT
,
176 'title' => ts('Financial Transaction ID') ,
179 'from_financial_account_id' => array(
180 'name' => 'from_financial_account_id',
181 'type' => CRM_Utils_Type
::T_INT
,
182 'title' => ts('Financial Transaction From Account') ,
183 'description' => 'FK to financial_account table.',
184 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
188 'pseudoconstant' => array(
189 'table' => 'civicrm_financial_account',
191 'labelColumn' => 'name',
194 'to_financial_account_id' => array(
195 'name' => 'to_financial_account_id',
196 'type' => CRM_Utils_Type
::T_INT
,
197 'title' => ts('Financial Transaction To Account') ,
198 'description' => 'FK to financial_financial_account table.',
199 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
203 'pseudoconstant' => array(
204 'table' => 'civicrm_financial_account',
206 'labelColumn' => 'name',
209 'trxn_date' => array(
210 'name' => 'trxn_date',
211 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
212 'title' => ts('Financial Transaction Date') ,
213 'description' => 'date transaction occurred',
216 'total_amount' => array(
217 'name' => 'total_amount',
218 'type' => CRM_Utils_Type
::T_MONEY
,
219 'title' => ts('Financial Total Amount') ,
220 'description' => 'amount of transaction',
222 'precision' => array(
227 'fee_amount' => array(
228 'name' => 'fee_amount',
229 'type' => CRM_Utils_Type
::T_MONEY
,
230 'title' => ts('Financial Fee Amount') ,
231 'description' => 'actual processor fee if known - may be 0.',
232 'precision' => array(
237 'net_amount' => array(
238 'name' => 'net_amount',
239 'type' => CRM_Utils_Type
::T_MONEY
,
240 'title' => ts('Financial Net Amount') ,
241 'description' => 'actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.',
242 'precision' => array(
248 'name' => 'currency',
249 'type' => CRM_Utils_Type
::T_STRING
,
250 'title' => ts('Financial Currency') ,
251 'description' => '3 character string, value from config setting or input via user.',
253 'size' => CRM_Utils_Type
::FOUR
,
255 'where' => 'civicrm_financial_trxn.currency',
256 'headerPattern' => '/cur(rency)?/i',
257 'dataPattern' => '/^[A-Z]{3}$/',
263 'pseudoconstant' => array(
264 'table' => 'civicrm_currency',
265 'keyColumn' => 'name',
266 'labelColumn' => 'full_name',
267 'nameColumn' => 'name',
270 'is_payment' => array(
271 'name' => 'is_payment',
272 'type' => CRM_Utils_Type
::T_BOOLEAN
,
273 'title' => ts('Is Payment?') ,
274 'description' => 'Is this entry either a payment or a reversal of a payment?',
276 'where' => 'civicrm_financial_trxn.is_payment',
277 'headerPattern' => '',
283 'type' => CRM_Utils_Type
::T_STRING
,
284 'title' => ts('Transaction ID') ,
285 'description' => 'Transaction id supplied by external processor. This may not be unique.',
287 'size' => CRM_Utils_Type
::HUGE
,
289 'trxn_result_code' => array(
290 'name' => 'trxn_result_code',
291 'type' => CRM_Utils_Type
::T_STRING
,
292 'title' => ts('Transaction Result Code') ,
293 'description' => 'processor result code',
295 'size' => CRM_Utils_Type
::HUGE
,
297 'status_id' => array(
298 'name' => 'status_id',
299 'type' => CRM_Utils_Type
::T_INT
,
300 'title' => ts('Financial Transaction Status Id') ,
301 'description' => 'pseudo FK to civicrm_option_value of contribution_status_id option_group',
303 'where' => 'civicrm_financial_trxn.status_id',
304 'headerPattern' => '/status/i',
307 'pseudoconstant' => array(
308 'optionGroupName' => 'contribution_status',
309 'optionEditPath' => 'civicrm/admin/options/contribution_status',
312 'payment_processor_id' => array(
313 'name' => 'payment_processor_id',
314 'type' => CRM_Utils_Type
::T_INT
,
315 'title' => ts('Payment Processor') ,
316 'description' => 'Payment Processor for this financial transaction',
317 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
319 'financial_trxn_payment_instrument_id' => array(
320 'name' => 'payment_instrument_id',
321 'type' => CRM_Utils_Type
::T_INT
,
322 'title' => ts('Payment Method') ,
323 'description' => 'FK to payment_instrument option group values',
327 'pseudoconstant' => array(
328 'optionGroupName' => 'payment_instrument',
329 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
332 'financial_trxn_check_number' => array(
333 'name' => 'check_number',
334 'type' => CRM_Utils_Type
::T_STRING
,
335 'title' => ts('Check Number') ,
336 'description' => 'Check number',
344 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
346 return Civi
::$statics[__CLASS__
]['fields'];
349 * Return a mapping from field-name to the corresponding key (as used in fields()).
352 * Array(string $name => string $uniqueName).
354 static function &fieldKeys() {
355 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
356 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
358 return Civi
::$statics[__CLASS__
]['fieldKeys'];
361 * Returns the names of this table
365 static function getTableName() {
366 return self
::$_tableName;
369 * Returns if this table needs to be logged
377 * Returns the list of fields that can be imported
379 * @param bool $prefix
383 static function &import($prefix = false) {
384 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'financial_trxn', $prefix, array());
388 * Returns the list of fields that can be exported
390 * @param bool $prefix
394 static function &export($prefix = false) {
395 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'financial_trxn', $prefix, array());