Commit | Line | Data |
---|---|---|
e501603b TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
6 | | Copyright CiviCRM LLC (c) 2004-2016 | | |
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 | |
29 | * @copyright CiviCRM LLC (c) 2004-2016 | |
30 | * | |
31 | * Generated from xml/schema/CRM/Financial/FinancialTrxn.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
437fafcf | 33 | * (GenCodeChecksum:fec5d6572bfe0de3f9dc41afd33fee9b) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
37 | class CRM_Financial_DAO_FinancialTrxn extends CRM_Core_DAO { | |
38 | /** | |
39 | * static instance to hold the table name | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | static $_tableName = 'civicrm_financial_trxn'; | |
44 | /** | |
45 | * static instance to hold the field values | |
46 | * | |
47 | * @var array | |
48 | */ | |
49 | static $_fields = null; | |
50 | /** | |
51 | * static instance to hold the keys used in $_fields for each field. | |
52 | * | |
53 | * @var array | |
54 | */ | |
55 | static $_fieldKeys = null; | |
56 | /** | |
57 | * static instance to hold the FK relationships | |
58 | * | |
59 | * @var string | |
60 | */ | |
61 | static $_links = null; | |
62 | /** | |
63 | * static instance to hold the values that can | |
64 | * be imported | |
65 | * | |
66 | * @var array | |
67 | */ | |
68 | static $_import = null; | |
69 | /** | |
70 | * static instance to hold the values that can | |
71 | * be exported | |
72 | * | |
73 | * @var array | |
74 | */ | |
75 | static $_export = null; | |
76 | /** | |
77 | * static value to see if we should log any modifications to | |
78 | * this table in the civicrm_log table | |
79 | * | |
80 | * @var boolean | |
81 | */ | |
82 | static $_log = true; | |
83 | /** | |
84 | * | |
85 | * @var int unsigned | |
86 | */ | |
87 | public $id; | |
88 | /** | |
89 | * FK to financial_account table. | |
90 | * | |
91 | * @var int unsigned | |
92 | */ | |
93 | public $from_financial_account_id; | |
94 | /** | |
95 | * FK to financial_financial_account table. | |
96 | * | |
97 | * @var int unsigned | |
98 | */ | |
99 | public $to_financial_account_id; | |
100 | /** | |
101 | * date transaction occurred | |
102 | * | |
103 | * @var datetime | |
104 | */ | |
105 | public $trxn_date; | |
106 | /** | |
107 | * amount of transaction | |
108 | * | |
109 | * @var float | |
110 | */ | |
111 | public $total_amount; | |
112 | /** | |
113 | * actual processor fee if known - may be 0. | |
114 | * | |
115 | * @var float | |
116 | */ | |
117 | public $fee_amount; | |
118 | /** | |
119 | * actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount. | |
120 | * | |
121 | * @var float | |
122 | */ | |
123 | public $net_amount; | |
124 | /** | |
125 | * 3 character string, value from config setting or input via user. | |
126 | * | |
127 | * @var string | |
128 | */ | |
129 | public $currency; | |
130 | /** | |
131 | * Is this entry either a payment or a reversal of a payment? | |
132 | * | |
133 | * @var boolean | |
134 | */ | |
135 | public $is_payment; | |
136 | /** | |
137 | * Transaction id supplied by external processor. This may not be unique. | |
138 | * | |
139 | * @var string | |
140 | */ | |
141 | public $trxn_id; | |
142 | /** | |
143 | * processor result code | |
144 | * | |
145 | * @var string | |
146 | */ | |
147 | public $trxn_result_code; | |
148 | /** | |
149 | * pseudo FK to civicrm_option_value of contribution_status_id option_group | |
150 | * | |
151 | * @var int unsigned | |
152 | */ | |
153 | public $status_id; | |
154 | /** | |
155 | * Payment Processor for this financial transaction | |
156 | * | |
157 | * @var int unsigned | |
158 | */ | |
159 | public $payment_processor_id; | |
160 | /** | |
161 | * FK to payment_instrument option group values | |
162 | * | |
163 | * @var int unsigned | |
164 | */ | |
165 | public $payment_instrument_id; | |
166 | /** | |
167 | * Check number | |
168 | * | |
169 | * @var string | |
170 | */ | |
171 | public $check_number; | |
172 | /** | |
173 | * class constructor | |
174 | * | |
175 | * @return civicrm_financial_trxn | |
176 | */ | |
177 | function __construct() { | |
178 | $this->__table = 'civicrm_financial_trxn'; | |
179 | parent::__construct(); | |
180 | } | |
181 | /** | |
182 | * Returns foreign keys and entity references | |
183 | * | |
184 | * @return array | |
185 | * [CRM_Core_Reference_Interface] | |
186 | */ | |
187 | static function getReferenceColumns() { | |
188 | if (!self::$_links) { | |
189 | self::$_links = static ::createReferenceColumns(__CLASS__); | |
190 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'from_financial_account_id', 'civicrm_financial_account', 'id'); | |
191 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'to_financial_account_id', 'civicrm_financial_account', 'id'); | |
192 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'payment_processor_id', 'civicrm_payment_processor', 'id'); | |
193 | } | |
194 | return self::$_links; | |
195 | } | |
196 | /** | |
197 | * Returns all the column names of this table | |
198 | * | |
199 | * @return array | |
200 | */ | |
201 | static function &fields() { | |
202 | if (!(self::$_fields)) { | |
203 | self::$_fields = array( | |
204 | 'id' => array( | |
205 | 'name' => 'id', | |
206 | 'type' => CRM_Utils_Type::T_INT, | |
207 | 'title' => ts('Financial Transaction ID') , | |
208 | 'required' => true, | |
209 | ) , | |
210 | 'from_financial_account_id' => array( | |
211 | 'name' => 'from_financial_account_id', | |
212 | 'type' => CRM_Utils_Type::T_INT, | |
213 | 'title' => ts('Financial Transaction From Account') , | |
214 | 'description' => 'FK to financial_account table.', | |
215 | 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount', | |
216 | 'html' => array( | |
217 | 'type' => 'Select', | |
218 | ) , | |
219 | 'pseudoconstant' => array( | |
220 | 'table' => 'civicrm_financial_account', | |
221 | 'keyColumn' => 'id', | |
222 | 'labelColumn' => 'name', | |
223 | ) | |
224 | ) , | |
225 | 'to_financial_account_id' => array( | |
226 | 'name' => 'to_financial_account_id', | |
227 | 'type' => CRM_Utils_Type::T_INT, | |
228 | 'title' => ts('Financial Transaction To Account') , | |
229 | 'description' => 'FK to financial_financial_account table.', | |
230 | 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount', | |
231 | 'html' => array( | |
232 | 'type' => 'Select', | |
233 | ) , | |
234 | 'pseudoconstant' => array( | |
235 | 'table' => 'civicrm_financial_account', | |
236 | 'keyColumn' => 'id', | |
237 | 'labelColumn' => 'name', | |
238 | ) | |
239 | ) , | |
240 | 'trxn_date' => array( | |
241 | 'name' => 'trxn_date', | |
242 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
243 | 'title' => ts('Financial Transaction Date') , | |
244 | 'description' => 'date transaction occurred', | |
245 | 'default' => 'NULL', | |
246 | ) , | |
247 | 'total_amount' => array( | |
248 | 'name' => 'total_amount', | |
249 | 'type' => CRM_Utils_Type::T_MONEY, | |
250 | 'title' => ts('Financial Total Amount') , | |
251 | 'description' => 'amount of transaction', | |
252 | 'required' => true, | |
253 | 'precision' => array( | |
254 | 20, | |
255 | 2 | |
256 | ) , | |
257 | ) , | |
258 | 'fee_amount' => array( | |
259 | 'name' => 'fee_amount', | |
260 | 'type' => CRM_Utils_Type::T_MONEY, | |
261 | 'title' => ts('Financial Fee Amount') , | |
262 | 'description' => 'actual processor fee if known - may be 0.', | |
263 | 'precision' => array( | |
264 | 20, | |
265 | 2 | |
266 | ) , | |
267 | ) , | |
268 | 'net_amount' => array( | |
269 | 'name' => 'net_amount', | |
270 | 'type' => CRM_Utils_Type::T_MONEY, | |
271 | 'title' => ts('Financial Net Amount') , | |
272 | 'description' => 'actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.', | |
273 | 'precision' => array( | |
274 | 20, | |
275 | 2 | |
276 | ) , | |
277 | ) , | |
278 | 'currency' => array( | |
279 | 'name' => 'currency', | |
280 | 'type' => CRM_Utils_Type::T_STRING, | |
281 | 'title' => ts('Financial Currency') , | |
282 | 'description' => '3 character string, value from config setting or input via user.', | |
283 | 'maxlength' => 3, | |
284 | 'size' => CRM_Utils_Type::FOUR, | |
285 | 'import' => true, | |
286 | 'where' => 'civicrm_financial_trxn.currency', | |
287 | 'headerPattern' => '/cur(rency)?/i', | |
288 | 'dataPattern' => '/^[A-Z]{3}$/', | |
289 | 'export' => true, | |
290 | 'default' => 'NULL', | |
291 | 'html' => array( | |
292 | 'type' => 'Select', | |
293 | ) , | |
294 | 'pseudoconstant' => array( | |
295 | 'table' => 'civicrm_currency', | |
296 | 'keyColumn' => 'name', | |
297 | 'labelColumn' => 'full_name', | |
298 | 'nameColumn' => 'name', | |
299 | ) | |
300 | ) , | |
301 | 'is_payment' => array( | |
302 | 'name' => 'is_payment', | |
303 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
304 | 'title' => ts('Is Payment?') , | |
305 | 'description' => 'Is this entry either a payment or a reversal of a payment?', | |
306 | 'import' => true, | |
307 | 'where' => 'civicrm_financial_trxn.is_payment', | |
308 | 'headerPattern' => '', | |
309 | 'dataPattern' => '', | |
310 | 'export' => true, | |
311 | ) , | |
312 | 'trxn_id' => array( | |
313 | 'name' => 'trxn_id', | |
314 | 'type' => CRM_Utils_Type::T_STRING, | |
315 | 'title' => ts('Transaction ID') , | |
316 | 'description' => 'Transaction id supplied by external processor. This may not be unique.', | |
317 | 'maxlength' => 255, | |
318 | 'size' => CRM_Utils_Type::HUGE, | |
319 | ) , | |
320 | 'trxn_result_code' => array( | |
321 | 'name' => 'trxn_result_code', | |
322 | 'type' => CRM_Utils_Type::T_STRING, | |
323 | 'title' => ts('Transaction Result Code') , | |
324 | 'description' => 'processor result code', | |
325 | 'maxlength' => 255, | |
326 | 'size' => CRM_Utils_Type::HUGE, | |
327 | ) , | |
328 | 'status_id' => array( | |
329 | 'name' => 'status_id', | |
330 | 'type' => CRM_Utils_Type::T_INT, | |
331 | 'title' => ts('Financial Transaction Status Id') , | |
332 | 'description' => 'pseudo FK to civicrm_option_value of contribution_status_id option_group', | |
333 | 'import' => true, | |
334 | 'where' => 'civicrm_financial_trxn.status_id', | |
335 | 'headerPattern' => '/status/i', | |
336 | 'dataPattern' => '', | |
337 | 'export' => true, | |
338 | 'pseudoconstant' => array( | |
339 | 'optionGroupName' => 'contribution_status', | |
340 | 'optionEditPath' => 'civicrm/admin/options/contribution_status', | |
341 | ) | |
342 | ) , | |
343 | 'payment_processor_id' => array( | |
344 | 'name' => 'payment_processor_id', | |
345 | 'type' => CRM_Utils_Type::T_INT, | |
346 | 'title' => ts('Payment Processor') , | |
347 | 'description' => 'Payment Processor for this financial transaction', | |
348 | 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor', | |
349 | ) , | |
350 | 'financial_trxn_payment_instrument_id' => array( | |
351 | 'name' => 'payment_instrument_id', | |
352 | 'type' => CRM_Utils_Type::T_INT, | |
353 | 'title' => ts('Payment Method') , | |
354 | 'description' => 'FK to payment_instrument option group values', | |
355 | 'html' => array( | |
356 | 'type' => 'Select', | |
357 | ) , | |
358 | 'pseudoconstant' => array( | |
359 | 'optionGroupName' => 'payment_instrument', | |
360 | 'optionEditPath' => 'civicrm/admin/options/payment_instrument', | |
361 | ) | |
362 | ) , | |
363 | 'financial_trxn_check_number' => array( | |
364 | 'name' => 'check_number', | |
365 | 'type' => CRM_Utils_Type::T_STRING, | |
366 | 'title' => ts('Check Number') , | |
367 | 'description' => 'Check number', | |
368 | 'maxlength' => 255, | |
369 | 'size' => 6, | |
370 | 'html' => array( | |
371 | 'type' => 'Text', | |
372 | ) , | |
373 | ) , | |
374 | ); | |
375 | } | |
376 | return self::$_fields; | |
377 | } | |
378 | /** | |
379 | * Returns an array containing, for each field, the arary key used for that | |
380 | * field in self::$_fields. | |
381 | * | |
382 | * @return array | |
383 | */ | |
384 | static function &fieldKeys() { | |
385 | if (!(self::$_fieldKeys)) { | |
386 | self::$_fieldKeys = array( | |
387 | 'id' => 'id', | |
388 | 'from_financial_account_id' => 'from_financial_account_id', | |
389 | 'to_financial_account_id' => 'to_financial_account_id', | |
390 | 'trxn_date' => 'trxn_date', | |
391 | 'total_amount' => 'total_amount', | |
392 | 'fee_amount' => 'fee_amount', | |
393 | 'net_amount' => 'net_amount', | |
394 | 'currency' => 'currency', | |
395 | 'is_payment' => 'is_payment', | |
396 | 'trxn_id' => 'trxn_id', | |
397 | 'trxn_result_code' => 'trxn_result_code', | |
398 | 'status_id' => 'status_id', | |
399 | 'payment_processor_id' => 'payment_processor_id', | |
400 | 'payment_instrument_id' => 'financial_trxn_payment_instrument_id', | |
401 | 'check_number' => 'financial_trxn_check_number', | |
402 | ); | |
403 | } | |
404 | return self::$_fieldKeys; | |
405 | } | |
406 | /** | |
407 | * Returns the names of this table | |
408 | * | |
409 | * @return string | |
410 | */ | |
411 | static function getTableName() { | |
412 | return self::$_tableName; | |
413 | } | |
414 | /** | |
415 | * Returns if this table needs to be logged | |
416 | * | |
417 | * @return boolean | |
418 | */ | |
419 | function getLog() { | |
420 | return self::$_log; | |
421 | } | |
422 | /** | |
423 | * Returns the list of fields that can be imported | |
424 | * | |
425 | * @param bool $prefix | |
426 | * | |
427 | * @return array | |
428 | */ | |
429 | static function &import($prefix = false) { | |
430 | if (!(self::$_import)) { | |
431 | self::$_import = array(); | |
432 | $fields = self::fields(); | |
433 | foreach($fields as $name => $field) { | |
434 | if (CRM_Utils_Array::value('import', $field)) { | |
435 | if ($prefix) { | |
436 | self::$_import['financial_trxn'] = & $fields[$name]; | |
437 | } else { | |
438 | self::$_import[$name] = & $fields[$name]; | |
439 | } | |
440 | } | |
441 | } | |
442 | } | |
443 | return self::$_import; | |
444 | } | |
445 | /** | |
446 | * Returns the list of fields that can be exported | |
447 | * | |
448 | * @param bool $prefix | |
449 | * | |
450 | * @return array | |
451 | */ | |
452 | static function &export($prefix = false) { | |
453 | if (!(self::$_export)) { | |
454 | self::$_export = array(); | |
455 | $fields = self::fields(); | |
456 | foreach($fields as $name => $field) { | |
457 | if (CRM_Utils_Array::value('export', $field)) { | |
458 | if ($prefix) { | |
459 | self::$_export['financial_trxn'] = & $fields[$name]; | |
460 | } else { | |
461 | self::$_export[$name] = & $fields[$name]; | |
462 | } | |
463 | } | |
464 | } | |
465 | } | |
466 | return self::$_export; | |
467 | } | |
468 | } |