Commit | Line | Data |
---|---|---|
e501603b TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
0f03f337 | 6 | | Copyright CiviCRM LLC (c) 2004-2017 | |
e501603b TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
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. | | |
13 | | | | |
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. | | |
18 | | | | |
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 | +--------------------------------------------------------------------+ | |
26 | */ | |
27 | /** | |
28 | * @package CRM | |
0f03f337 | 29 | * @copyright CiviCRM LLC (c) 2004-2017 |
e501603b TO |
30 | * |
31 | * Generated from xml/schema/CRM/Financial/FinancialTrxn.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
ea927522 | 33 | * (GenCodeChecksum:52a627d344bca95d30eb8b22aad1e245) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
f41f0342 | 37 | /** |
38 | * CRM_Financial_DAO_FinancialTrxn constructor. | |
39 | */ | |
e501603b TO |
40 | class CRM_Financial_DAO_FinancialTrxn extends CRM_Core_DAO { |
41 | /** | |
f41f0342 | 42 | * Static instance to hold the table name. |
e501603b TO |
43 | * |
44 | * @var string | |
45 | */ | |
46 | static $_tableName = 'civicrm_financial_trxn'; | |
e501603b | 47 | /** |
f41f0342 | 48 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b TO |
49 | * |
50 | * @var boolean | |
51 | */ | |
52 | static $_log = true; | |
53 | /** | |
54 | * | |
55 | * @var int unsigned | |
56 | */ | |
57 | public $id; | |
58 | /** | |
59 | * FK to financial_account table. | |
60 | * | |
61 | * @var int unsigned | |
62 | */ | |
63 | public $from_financial_account_id; | |
64 | /** | |
65 | * FK to financial_financial_account table. | |
66 | * | |
67 | * @var int unsigned | |
68 | */ | |
69 | public $to_financial_account_id; | |
70 | /** | |
71 | * date transaction occurred | |
72 | * | |
73 | * @var datetime | |
74 | */ | |
75 | public $trxn_date; | |
76 | /** | |
77 | * amount of transaction | |
78 | * | |
79 | * @var float | |
80 | */ | |
81 | public $total_amount; | |
82 | /** | |
83 | * actual processor fee if known - may be 0. | |
84 | * | |
85 | * @var float | |
86 | */ | |
87 | public $fee_amount; | |
88 | /** | |
89 | * actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount. | |
90 | * | |
91 | * @var float | |
92 | */ | |
93 | public $net_amount; | |
94 | /** | |
95 | * 3 character string, value from config setting or input via user. | |
96 | * | |
97 | * @var string | |
98 | */ | |
99 | public $currency; | |
100 | /** | |
101 | * Is this entry either a payment or a reversal of a payment? | |
102 | * | |
103 | * @var boolean | |
104 | */ | |
105 | public $is_payment; | |
106 | /** | |
107 | * Transaction id supplied by external processor. This may not be unique. | |
108 | * | |
109 | * @var string | |
110 | */ | |
111 | public $trxn_id; | |
112 | /** | |
113 | * processor result code | |
114 | * | |
115 | * @var string | |
116 | */ | |
117 | public $trxn_result_code; | |
118 | /** | |
119 | * pseudo FK to civicrm_option_value of contribution_status_id option_group | |
120 | * | |
121 | * @var int unsigned | |
122 | */ | |
123 | public $status_id; | |
124 | /** | |
125 | * Payment Processor for this financial transaction | |
126 | * | |
127 | * @var int unsigned | |
128 | */ | |
129 | public $payment_processor_id; | |
130 | /** | |
131 | * FK to payment_instrument option group values | |
132 | * | |
133 | * @var int unsigned | |
134 | */ | |
135 | public $payment_instrument_id; | |
ea927522 PN |
136 | /** |
137 | * FK to accept_creditcard option group values | |
138 | * | |
139 | * @var int unsigned | |
140 | */ | |
141 | public $card_type; | |
e501603b TO |
142 | /** |
143 | * Check number | |
144 | * | |
145 | * @var string | |
146 | */ | |
147 | public $check_number; | |
ea927522 PN |
148 | /** |
149 | * Last 4 digits of credit card | |
150 | * | |
151 | * @var int unsigned | |
152 | */ | |
153 | public $pan_truncation; | |
e501603b | 154 | /** |
f41f0342 | 155 | * Class constructor. |
e501603b TO |
156 | */ |
157 | function __construct() { | |
158 | $this->__table = 'civicrm_financial_trxn'; | |
159 | parent::__construct(); | |
160 | } | |
161 | /** | |
f41f0342 | 162 | * Returns foreign keys and entity references. |
e501603b TO |
163 | * |
164 | * @return array | |
165 | * [CRM_Core_Reference_Interface] | |
166 | */ | |
167 | static function getReferenceColumns() { | |
346aaaba TO |
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']); | |
e501603b | 174 | } |
346aaaba | 175 | return Civi::$statics[__CLASS__]['links']; |
e501603b TO |
176 | } |
177 | /** | |
178 | * Returns all the column names of this table | |
179 | * | |
180 | * @return array | |
181 | */ | |
182 | static function &fields() { | |
346aaaba TO |
183 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
184 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
185 | 'id' => array( |
186 | 'name' => 'id', | |
187 | 'type' => CRM_Utils_Type::T_INT, | |
188 | 'title' => ts('Financial Transaction ID') , | |
189 | 'required' => true, | |
522a26c9 | 190 | 'table_name' => 'civicrm_financial_trxn', |
191 | 'entity' => 'FinancialTrxn', | |
192 | 'bao' => 'CRM_Financial_DAO_FinancialTrxn', | |
e501603b TO |
193 | ) , |
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.', | |
522a26c9 | 199 | 'table_name' => 'civicrm_financial_trxn', |
200 | 'entity' => 'FinancialTrxn', | |
201 | 'bao' => 'CRM_Financial_DAO_FinancialTrxn', | |
e501603b TO |
202 | 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount', |
203 | 'html' => array( | |
204 | 'type' => 'Select', | |
205 | ) , | |
206 | 'pseudoconstant' => array( | |
207 | 'table' => 'civicrm_financial_account', | |
208 | 'keyColumn' => 'id', | |
209 | 'labelColumn' => 'name', | |
210 | ) | |
211 | ) , | |
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.', | |
522a26c9 | 217 | 'table_name' => 'civicrm_financial_trxn', |
218 | 'entity' => 'FinancialTrxn', | |
219 | 'bao' => 'CRM_Financial_DAO_FinancialTrxn', | |
e501603b TO |
220 | 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount', |
221 | 'html' => array( | |
222 | 'type' => 'Select', | |
223 | ) , | |
224 | 'pseudoconstant' => array( | |
225 | 'table' => 'civicrm_financial_account', | |
226 | 'keyColumn' => 'id', | |
227 | 'labelColumn' => 'name', | |
228 | ) | |
229 | ) , | |
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', | |
235 | 'default' => 'NULL', | |
522a26c9 | 236 | 'table_name' => 'civicrm_financial_trxn', |
237 | 'entity' => 'FinancialTrxn', | |
238 | 'bao' => 'CRM_Financial_DAO_FinancialTrxn', | |
e501603b TO |
239 | ) , |
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', | |
245 | 'required' => true, | |
246 | 'precision' => array( | |
247 | 20, | |
248 | 2 | |
249 | ) , | |
522a26c9 | 250 | 'table_name' => 'civicrm_financial_trxn', |
251 | 'entity' => 'FinancialTrxn', | |
252 | 'bao' => 'CRM_Financial_DAO_FinancialTrxn', | |
e501603b TO |
253 | ) , |
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( | |
260 | 20, | |
261 | 2 | |
262 | ) , | |
522a26c9 | 263 | 'table_name' => 'civicrm_financial_trxn', |
264 | 'entity' => 'FinancialTrxn', | |
265 | 'bao' => 'CRM_Financial_DAO_FinancialTrxn', | |
e501603b TO |
266 | ) , |
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( | |
273 | 20, | |
274 | 2 | |
275 | ) , | |
522a26c9 | 276 | 'table_name' => 'civicrm_financial_trxn', |
277 | 'entity' => 'FinancialTrxn', | |
278 | 'bao' => 'CRM_Financial_DAO_FinancialTrxn', | |
e501603b TO |
279 | ) , |
280 | 'currency' => array( | |
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.', | |
285 | 'maxlength' => 3, | |
286 | 'size' => CRM_Utils_Type::FOUR, | |
287 | 'import' => true, | |
288 | 'where' => 'civicrm_financial_trxn.currency', | |
289 | 'headerPattern' => '/cur(rency)?/i', | |
290 | 'dataPattern' => '/^[A-Z]{3}$/', | |
291 | 'export' => true, | |
292 | 'default' => 'NULL', | |
522a26c9 | 293 | 'table_name' => 'civicrm_financial_trxn', |
294 | 'entity' => 'FinancialTrxn', | |
295 | 'bao' => 'CRM_Financial_DAO_FinancialTrxn', | |
e501603b TO |
296 | 'html' => array( |
297 | 'type' => 'Select', | |
298 | ) , | |
299 | 'pseudoconstant' => array( | |
300 | 'table' => 'civicrm_currency', | |
301 | 'keyColumn' => 'name', | |
302 | 'labelColumn' => 'full_name', | |
303 | 'nameColumn' => 'name', | |
304 | ) | |
305 | ) , | |
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?', | |
311 | 'import' => true, | |
312 | 'where' => 'civicrm_financial_trxn.is_payment', | |
313 | 'headerPattern' => '', | |
314 | 'dataPattern' => '', | |
315 | 'export' => true, | |
522a26c9 | 316 | 'table_name' => 'civicrm_financial_trxn', |
317 | 'entity' => 'FinancialTrxn', | |
318 | 'bao' => 'CRM_Financial_DAO_FinancialTrxn', | |
e501603b TO |
319 | ) , |
320 | 'trxn_id' => array( | |
321 | 'name' => 'trxn_id', | |
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.', | |
325 | 'maxlength' => 255, | |
326 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 327 | 'table_name' => 'civicrm_financial_trxn', |
328 | 'entity' => 'FinancialTrxn', | |
329 | 'bao' => 'CRM_Financial_DAO_FinancialTrxn', | |
e501603b TO |
330 | ) , |
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', | |
336 | 'maxlength' => 255, | |
337 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 338 | 'table_name' => 'civicrm_financial_trxn', |
339 | 'entity' => 'FinancialTrxn', | |
340 | 'bao' => 'CRM_Financial_DAO_FinancialTrxn', | |
e501603b TO |
341 | ) , |
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', | |
347 | 'import' => true, | |
348 | 'where' => 'civicrm_financial_trxn.status_id', | |
349 | 'headerPattern' => '/status/i', | |
350 | 'dataPattern' => '', | |
351 | 'export' => true, | |
522a26c9 | 352 | 'table_name' => 'civicrm_financial_trxn', |
353 | 'entity' => 'FinancialTrxn', | |
354 | 'bao' => 'CRM_Financial_DAO_FinancialTrxn', | |
e501603b TO |
355 | 'pseudoconstant' => array( |
356 | 'optionGroupName' => 'contribution_status', | |
357 | 'optionEditPath' => 'civicrm/admin/options/contribution_status', | |
358 | ) | |
359 | ) , | |
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', | |
522a26c9 | 365 | 'table_name' => 'civicrm_financial_trxn', |
366 | 'entity' => 'FinancialTrxn', | |
367 | 'bao' => 'CRM_Financial_DAO_FinancialTrxn', | |
e501603b TO |
368 | 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor', |
369 | ) , | |
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', | |
522a26c9 | 375 | 'table_name' => 'civicrm_financial_trxn', |
376 | 'entity' => 'FinancialTrxn', | |
377 | 'bao' => 'CRM_Financial_DAO_FinancialTrxn', | |
e501603b TO |
378 | 'html' => array( |
379 | 'type' => 'Select', | |
380 | ) , | |
381 | 'pseudoconstant' => array( | |
382 | 'optionGroupName' => 'payment_instrument', | |
383 | 'optionEditPath' => 'civicrm/admin/options/payment_instrument', | |
384 | ) | |
385 | ) , | |
ea927522 PN |
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', | |
394 | 'html' => array( | |
395 | 'type' => 'Select', | |
396 | ) , | |
397 | 'pseudoconstant' => array( | |
398 | 'optionGroupName' => 'accept_creditcard', | |
399 | 'optionEditPath' => 'civicrm/admin/options/accept_creditcard', | |
400 | ) | |
401 | ) , | |
e501603b TO |
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', | |
407 | 'maxlength' => 255, | |
408 | 'size' => 6, | |
522a26c9 | 409 | 'table_name' => 'civicrm_financial_trxn', |
410 | 'entity' => 'FinancialTrxn', | |
411 | 'bao' => 'CRM_Financial_DAO_FinancialTrxn', | |
e501603b TO |
412 | 'html' => array( |
413 | 'type' => 'Text', | |
414 | ) , | |
415 | ) , | |
ea927522 PN |
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', | |
424 | 'html' => array( | |
425 | 'type' => 'Text', | |
426 | ) , | |
427 | ) , | |
e501603b | 428 | ); |
346aaaba | 429 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 430 | } |
346aaaba | 431 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
432 | } |
433 | /** | |
bd8e0b14 | 434 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
435 | * |
436 | * @return array | |
bd8e0b14 | 437 | * Array(string $name => string $uniqueName). |
e501603b TO |
438 | */ |
439 | static function &fieldKeys() { | |
bd8e0b14 TO |
440 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
441 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 442 | } |
bd8e0b14 | 443 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
444 | } |
445 | /** | |
446 | * Returns the names of this table | |
447 | * | |
448 | * @return string | |
449 | */ | |
450 | static function getTableName() { | |
451 | return self::$_tableName; | |
452 | } | |
453 | /** | |
454 | * Returns if this table needs to be logged | |
455 | * | |
456 | * @return boolean | |
457 | */ | |
458 | function getLog() { | |
459 | return self::$_log; | |
460 | } | |
461 | /** | |
462 | * Returns the list of fields that can be imported | |
463 | * | |
464 | * @param bool $prefix | |
465 | * | |
466 | * @return array | |
467 | */ | |
468 | static function &import($prefix = false) { | |
60808919 TO |
469 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'financial_trxn', $prefix, array()); |
470 | return $r; | |
e501603b TO |
471 | } |
472 | /** | |
473 | * Returns the list of fields that can be exported | |
474 | * | |
475 | * @param bool $prefix | |
476 | * | |
477 | * @return array | |
478 | */ | |
479 | static function &export($prefix = false) { | |
60808919 TO |
480 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'financial_trxn', $prefix, array()); |
481 | return $r; | |
e501603b TO |
482 | } |
483 | } |