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'; | |
e501603b TO |
44 | /** |
45 | * static value to see if we should log any modifications to | |
46 | * this table in the civicrm_log table | |
47 | * | |
48 | * @var boolean | |
49 | */ | |
50 | static $_log = true; | |
51 | /** | |
52 | * | |
53 | * @var int unsigned | |
54 | */ | |
55 | public $id; | |
56 | /** | |
57 | * FK to financial_account table. | |
58 | * | |
59 | * @var int unsigned | |
60 | */ | |
61 | public $from_financial_account_id; | |
62 | /** | |
63 | * FK to financial_financial_account table. | |
64 | * | |
65 | * @var int unsigned | |
66 | */ | |
67 | public $to_financial_account_id; | |
68 | /** | |
69 | * date transaction occurred | |
70 | * | |
71 | * @var datetime | |
72 | */ | |
73 | public $trxn_date; | |
74 | /** | |
75 | * amount of transaction | |
76 | * | |
77 | * @var float | |
78 | */ | |
79 | public $total_amount; | |
80 | /** | |
81 | * actual processor fee if known - may be 0. | |
82 | * | |
83 | * @var float | |
84 | */ | |
85 | public $fee_amount; | |
86 | /** | |
87 | * actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount. | |
88 | * | |
89 | * @var float | |
90 | */ | |
91 | public $net_amount; | |
92 | /** | |
93 | * 3 character string, value from config setting or input via user. | |
94 | * | |
95 | * @var string | |
96 | */ | |
97 | public $currency; | |
98 | /** | |
99 | * Is this entry either a payment or a reversal of a payment? | |
100 | * | |
101 | * @var boolean | |
102 | */ | |
103 | public $is_payment; | |
104 | /** | |
105 | * Transaction id supplied by external processor. This may not be unique. | |
106 | * | |
107 | * @var string | |
108 | */ | |
109 | public $trxn_id; | |
110 | /** | |
111 | * processor result code | |
112 | * | |
113 | * @var string | |
114 | */ | |
115 | public $trxn_result_code; | |
116 | /** | |
117 | * pseudo FK to civicrm_option_value of contribution_status_id option_group | |
118 | * | |
119 | * @var int unsigned | |
120 | */ | |
121 | public $status_id; | |
122 | /** | |
123 | * Payment Processor for this financial transaction | |
124 | * | |
125 | * @var int unsigned | |
126 | */ | |
127 | public $payment_processor_id; | |
128 | /** | |
129 | * FK to payment_instrument option group values | |
130 | * | |
131 | * @var int unsigned | |
132 | */ | |
133 | public $payment_instrument_id; | |
134 | /** | |
135 | * Check number | |
136 | * | |
137 | * @var string | |
138 | */ | |
139 | public $check_number; | |
140 | /** | |
141 | * class constructor | |
142 | * | |
143 | * @return civicrm_financial_trxn | |
144 | */ | |
145 | function __construct() { | |
146 | $this->__table = 'civicrm_financial_trxn'; | |
147 | parent::__construct(); | |
148 | } | |
149 | /** | |
150 | * Returns foreign keys and entity references | |
151 | * | |
152 | * @return array | |
153 | * [CRM_Core_Reference_Interface] | |
154 | */ | |
155 | static function getReferenceColumns() { | |
346aaaba TO |
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']); | |
e501603b | 162 | } |
346aaaba | 163 | return Civi::$statics[__CLASS__]['links']; |
e501603b TO |
164 | } |
165 | /** | |
166 | * Returns all the column names of this table | |
167 | * | |
168 | * @return array | |
169 | */ | |
170 | static function &fields() { | |
346aaaba TO |
171 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
172 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
173 | 'id' => array( |
174 | 'name' => 'id', | |
175 | 'type' => CRM_Utils_Type::T_INT, | |
176 | 'title' => ts('Financial Transaction ID') , | |
177 | 'required' => true, | |
178 | ) , | |
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', | |
185 | 'html' => array( | |
186 | 'type' => 'Select', | |
187 | ) , | |
188 | 'pseudoconstant' => array( | |
189 | 'table' => 'civicrm_financial_account', | |
190 | 'keyColumn' => 'id', | |
191 | 'labelColumn' => 'name', | |
192 | ) | |
193 | ) , | |
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', | |
200 | 'html' => array( | |
201 | 'type' => 'Select', | |
202 | ) , | |
203 | 'pseudoconstant' => array( | |
204 | 'table' => 'civicrm_financial_account', | |
205 | 'keyColumn' => 'id', | |
206 | 'labelColumn' => 'name', | |
207 | ) | |
208 | ) , | |
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', | |
214 | 'default' => 'NULL', | |
215 | ) , | |
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', | |
221 | 'required' => true, | |
222 | 'precision' => array( | |
223 | 20, | |
224 | 2 | |
225 | ) , | |
226 | ) , | |
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( | |
233 | 20, | |
234 | 2 | |
235 | ) , | |
236 | ) , | |
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( | |
243 | 20, | |
244 | 2 | |
245 | ) , | |
246 | ) , | |
247 | 'currency' => 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.', | |
252 | 'maxlength' => 3, | |
253 | 'size' => CRM_Utils_Type::FOUR, | |
254 | 'import' => true, | |
255 | 'where' => 'civicrm_financial_trxn.currency', | |
256 | 'headerPattern' => '/cur(rency)?/i', | |
257 | 'dataPattern' => '/^[A-Z]{3}$/', | |
258 | 'export' => true, | |
259 | 'default' => 'NULL', | |
260 | 'html' => array( | |
261 | 'type' => 'Select', | |
262 | ) , | |
263 | 'pseudoconstant' => array( | |
264 | 'table' => 'civicrm_currency', | |
265 | 'keyColumn' => 'name', | |
266 | 'labelColumn' => 'full_name', | |
267 | 'nameColumn' => 'name', | |
268 | ) | |
269 | ) , | |
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?', | |
275 | 'import' => true, | |
276 | 'where' => 'civicrm_financial_trxn.is_payment', | |
277 | 'headerPattern' => '', | |
278 | 'dataPattern' => '', | |
279 | 'export' => true, | |
280 | ) , | |
281 | 'trxn_id' => array( | |
282 | 'name' => 'trxn_id', | |
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.', | |
286 | 'maxlength' => 255, | |
287 | 'size' => CRM_Utils_Type::HUGE, | |
288 | ) , | |
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', | |
294 | 'maxlength' => 255, | |
295 | 'size' => CRM_Utils_Type::HUGE, | |
296 | ) , | |
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', | |
302 | 'import' => true, | |
303 | 'where' => 'civicrm_financial_trxn.status_id', | |
304 | 'headerPattern' => '/status/i', | |
305 | 'dataPattern' => '', | |
306 | 'export' => true, | |
307 | 'pseudoconstant' => array( | |
308 | 'optionGroupName' => 'contribution_status', | |
309 | 'optionEditPath' => 'civicrm/admin/options/contribution_status', | |
310 | ) | |
311 | ) , | |
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', | |
318 | ) , | |
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', | |
324 | 'html' => array( | |
325 | 'type' => 'Select', | |
326 | ) , | |
327 | 'pseudoconstant' => array( | |
328 | 'optionGroupName' => 'payment_instrument', | |
329 | 'optionEditPath' => 'civicrm/admin/options/payment_instrument', | |
330 | ) | |
331 | ) , | |
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', | |
337 | 'maxlength' => 255, | |
338 | 'size' => 6, | |
339 | 'html' => array( | |
340 | 'type' => 'Text', | |
341 | ) , | |
342 | ) , | |
343 | ); | |
346aaaba | 344 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 345 | } |
346aaaba | 346 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
347 | } |
348 | /** | |
bd8e0b14 | 349 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
350 | * |
351 | * @return array | |
bd8e0b14 | 352 | * Array(string $name => string $uniqueName). |
e501603b TO |
353 | */ |
354 | static function &fieldKeys() { | |
bd8e0b14 TO |
355 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
356 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 357 | } |
bd8e0b14 | 358 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
359 | } |
360 | /** | |
361 | * Returns the names of this table | |
362 | * | |
363 | * @return string | |
364 | */ | |
365 | static function getTableName() { | |
366 | return self::$_tableName; | |
367 | } | |
368 | /** | |
369 | * Returns if this table needs to be logged | |
370 | * | |
371 | * @return boolean | |
372 | */ | |
373 | function getLog() { | |
374 | return self::$_log; | |
375 | } | |
376 | /** | |
377 | * Returns the list of fields that can be imported | |
378 | * | |
379 | * @param bool $prefix | |
380 | * | |
381 | * @return array | |
382 | */ | |
383 | static function &import($prefix = false) { | |
60808919 TO |
384 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'financial_trxn', $prefix, array()); |
385 | return $r; | |
e501603b TO |
386 | } |
387 | /** | |
388 | * Returns the list of fields that can be exported | |
389 | * | |
390 | * @param bool $prefix | |
391 | * | |
392 | * @return array | |
393 | */ | |
394 | static function &export($prefix = false) { | |
60808919 TO |
395 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'financial_trxn', $prefix, array()); |
396 | return $r; | |
e501603b TO |
397 | } |
398 | } |