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/Contribute/Contribution.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
437fafcf | 33 | * (GenCodeChecksum:f4c8d34b6650ac5eafbfbd3d6b8a51ca) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
37 | class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO { | |
38 | /** | |
39 | * static instance to hold the table name | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | static $_tableName = 'civicrm_contribution'; | |
44 | /** | |
45 | * static instance to hold the field values | |
46 | * | |
47 | * @var array | |
48 | */ | |
49 | static $_fields = null; | |
e501603b TO |
50 | /** |
51 | * static instance to hold the FK relationships | |
52 | * | |
53 | * @var string | |
54 | */ | |
55 | static $_links = null; | |
e501603b TO |
56 | /** |
57 | * static value to see if we should log any modifications to | |
58 | * this table in the civicrm_log table | |
59 | * | |
60 | * @var boolean | |
61 | */ | |
62 | static $_log = true; | |
63 | /** | |
64 | * Contribution ID | |
65 | * | |
66 | * @var int unsigned | |
67 | */ | |
68 | public $id; | |
69 | /** | |
70 | * FK to Contact ID | |
71 | * | |
72 | * @var int unsigned | |
73 | */ | |
74 | public $contact_id; | |
75 | /** | |
76 | * FK to Financial Type for (total_amount - non_deductible_amount). | |
77 | * | |
78 | * @var int unsigned | |
79 | */ | |
80 | public $financial_type_id; | |
81 | /** | |
82 | * The Contribution Page which triggered this contribution | |
83 | * | |
84 | * @var int unsigned | |
85 | */ | |
86 | public $contribution_page_id; | |
87 | /** | |
88 | * FK to Payment Instrument | |
89 | * | |
90 | * @var int unsigned | |
91 | */ | |
92 | public $payment_instrument_id; | |
93 | /** | |
94 | * Date contribution was received - not necessarily the creation date of the record | |
95 | * | |
96 | * @var datetime | |
97 | */ | |
98 | public $receive_date; | |
99 | /** | |
100 | * Portion of total amount which is NOT tax deductible. Equal to total_amount for non-deductible financial types. | |
101 | * | |
102 | * @var float | |
103 | */ | |
104 | public $non_deductible_amount; | |
105 | /** | |
106 | * Total amount of this contribution. Use market value for non-monetary gifts. | |
107 | * | |
108 | * @var float | |
109 | */ | |
110 | public $total_amount; | |
111 | /** | |
112 | * actual processor fee if known - may be 0. | |
113 | * | |
114 | * @var float | |
115 | */ | |
116 | public $fee_amount; | |
117 | /** | |
118 | * actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount. | |
119 | * | |
120 | * @var float | |
121 | */ | |
122 | public $net_amount; | |
123 | /** | |
124 | * unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method | |
125 | * | |
126 | * @var string | |
127 | */ | |
128 | public $trxn_id; | |
129 | /** | |
130 | * unique invoice id, system generated or passed in | |
131 | * | |
132 | * @var string | |
133 | */ | |
134 | public $invoice_id; | |
135 | /** | |
136 | * 3 character string, value from config setting or input via user. | |
137 | * | |
138 | * @var string | |
139 | */ | |
140 | public $currency; | |
141 | /** | |
142 | * when was gift cancelled | |
143 | * | |
144 | * @var datetime | |
145 | */ | |
146 | public $cancel_date; | |
147 | /** | |
148 | * | |
149 | * @var text | |
150 | */ | |
151 | public $cancel_reason; | |
152 | /** | |
153 | * when (if) receipt was sent. populated automatically for online donations w/ automatic receipting | |
154 | * | |
155 | * @var datetime | |
156 | */ | |
157 | public $receipt_date; | |
158 | /** | |
159 | * when (if) was donor thanked | |
160 | * | |
161 | * @var datetime | |
162 | */ | |
163 | public $thankyou_date; | |
164 | /** | |
165 | * Origin of this Contribution. | |
166 | * | |
167 | * @var string | |
168 | */ | |
169 | public $source; | |
170 | /** | |
171 | * | |
172 | * @var text | |
173 | */ | |
174 | public $amount_level; | |
175 | /** | |
176 | * Conditional foreign key to civicrm_contribution_recur id. Each contribution made in connection with a recurring contribution carries a foreign key to the recurring contribution record. This assumes we can track these processor initiated events. | |
177 | * | |
178 | * @var int unsigned | |
179 | */ | |
180 | public $contribution_recur_id; | |
181 | /** | |
182 | * | |
183 | * @var boolean | |
184 | */ | |
185 | public $is_test; | |
186 | /** | |
187 | * | |
188 | * @var boolean | |
189 | */ | |
190 | public $is_pay_later; | |
191 | /** | |
192 | * | |
193 | * @var int unsigned | |
194 | */ | |
195 | public $contribution_status_id; | |
196 | /** | |
197 | * Conditional foreign key to civicrm_address.id. We insert an address record for each contribution when we have associated billing name and address data. | |
198 | * | |
199 | * @var int unsigned | |
200 | */ | |
201 | public $address_id; | |
202 | /** | |
203 | * | |
204 | * @var string | |
205 | */ | |
206 | public $check_number; | |
207 | /** | |
208 | * The campaign for which this contribution has been triggered. | |
209 | * | |
210 | * @var int unsigned | |
211 | */ | |
212 | public $campaign_id; | |
213 | /** | |
214 | * unique credit note id, system generated or passed in | |
215 | * | |
216 | * @var string | |
217 | */ | |
218 | public $creditnote_id; | |
219 | /** | |
220 | * Total tax amount of this contribution. | |
221 | * | |
222 | * @var float | |
223 | */ | |
224 | public $tax_amount; | |
225 | /** | |
226 | * Stores the date when revenue should be recognized. | |
227 | * | |
228 | * @var datetime | |
229 | */ | |
230 | public $revenue_recognition_date; | |
231 | /** | |
232 | * class constructor | |
233 | * | |
234 | * @return civicrm_contribution | |
235 | */ | |
236 | function __construct() { | |
237 | $this->__table = 'civicrm_contribution'; | |
238 | parent::__construct(); | |
239 | } | |
240 | /** | |
241 | * Returns foreign keys and entity references | |
242 | * | |
243 | * @return array | |
244 | * [CRM_Core_Reference_Interface] | |
245 | */ | |
246 | static function getReferenceColumns() { | |
247 | if (!self::$_links) { | |
248 | self::$_links = static ::createReferenceColumns(__CLASS__); | |
249 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); | |
250 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); | |
251 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_page_id', 'civicrm_contribution_page', 'id'); | |
252 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_recur_id', 'civicrm_contribution_recur', 'id'); | |
253 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'address_id', 'civicrm_address', 'id'); | |
254 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); | |
255 | } | |
256 | return self::$_links; | |
257 | } | |
258 | /** | |
259 | * Returns all the column names of this table | |
260 | * | |
261 | * @return array | |
262 | */ | |
263 | static function &fields() { | |
264 | if (!(self::$_fields)) { | |
265 | self::$_fields = array( | |
266 | 'contribution_id' => array( | |
267 | 'name' => 'id', | |
268 | 'type' => CRM_Utils_Type::T_INT, | |
269 | 'title' => ts('Contribution ID') , | |
270 | 'description' => 'Contribution ID', | |
271 | 'required' => true, | |
272 | 'import' => true, | |
273 | 'where' => 'civicrm_contribution.id', | |
274 | 'headerPattern' => '', | |
275 | 'dataPattern' => '', | |
276 | 'export' => true, | |
277 | ) , | |
278 | 'contribution_contact_id' => array( | |
279 | 'name' => 'contact_id', | |
280 | 'type' => CRM_Utils_Type::T_INT, | |
281 | 'title' => ts('Contact ID') , | |
282 | 'description' => 'FK to Contact ID', | |
283 | 'required' => true, | |
284 | 'import' => true, | |
285 | 'where' => 'civicrm_contribution.contact_id', | |
286 | 'headerPattern' => '/contact(.?id)?/i', | |
287 | 'dataPattern' => '/^\d+$/', | |
288 | 'export' => true, | |
289 | 'FKClassName' => 'CRM_Contact_DAO_Contact', | |
290 | 'html' => array( | |
291 | 'type' => 'EntityRef', | |
292 | ) , | |
293 | ) , | |
294 | 'financial_type_id' => array( | |
295 | 'name' => 'financial_type_id', | |
296 | 'type' => CRM_Utils_Type::T_INT, | |
297 | 'title' => ts('Financial Type') , | |
298 | 'description' => 'FK to Financial Type for (total_amount - non_deductible_amount).', | |
299 | 'export' => false, | |
300 | 'where' => 'civicrm_contribution.financial_type_id', | |
301 | 'headerPattern' => '', | |
302 | 'dataPattern' => '', | |
303 | 'FKClassName' => 'CRM_Financial_DAO_FinancialType', | |
304 | 'html' => array( | |
305 | 'type' => 'Select', | |
306 | ) , | |
307 | 'pseudoconstant' => array( | |
308 | 'table' => 'civicrm_financial_type', | |
309 | 'keyColumn' => 'id', | |
310 | 'labelColumn' => 'name', | |
311 | ) | |
312 | ) , | |
313 | 'contribution_page_id' => array( | |
314 | 'name' => 'contribution_page_id', | |
315 | 'type' => CRM_Utils_Type::T_INT, | |
316 | 'title' => ts('Contribution Page ID') , | |
317 | 'description' => 'The Contribution Page which triggered this contribution', | |
318 | 'import' => true, | |
319 | 'where' => 'civicrm_contribution.contribution_page_id', | |
320 | 'headerPattern' => '', | |
321 | 'dataPattern' => '', | |
322 | 'export' => true, | |
323 | 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage', | |
324 | 'html' => array( | |
325 | 'type' => 'Select', | |
326 | ) , | |
327 | 'pseudoconstant' => array( | |
328 | 'table' => 'civicrm_contribution_page', | |
329 | 'keyColumn' => 'id', | |
330 | 'labelColumn' => 'title', | |
331 | ) | |
332 | ) , | |
333 | 'payment_instrument_id' => array( | |
334 | 'name' => 'payment_instrument_id', | |
335 | 'type' => CRM_Utils_Type::T_INT, | |
336 | 'title' => ts('Payment Method') , | |
337 | 'description' => 'FK to Payment Instrument', | |
338 | 'html' => array( | |
339 | 'type' => 'Select', | |
340 | ) , | |
341 | 'pseudoconstant' => array( | |
342 | 'optionGroupName' => 'payment_instrument', | |
343 | 'optionEditPath' => 'civicrm/admin/options/payment_instrument', | |
344 | ) | |
345 | ) , | |
346 | 'receive_date' => array( | |
347 | 'name' => 'receive_date', | |
348 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
349 | 'title' => ts('Date Received') , | |
350 | 'description' => 'Date contribution was received - not necessarily the creation date of the record', | |
351 | 'import' => true, | |
352 | 'where' => 'civicrm_contribution.receive_date', | |
353 | 'headerPattern' => '/receive(.?date)?/i', | |
354 | 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', | |
355 | 'export' => true, | |
356 | 'html' => array( | |
357 | 'type' => 'Select Date', | |
358 | ) , | |
359 | ) , | |
360 | 'non_deductible_amount' => array( | |
361 | 'name' => 'non_deductible_amount', | |
362 | 'type' => CRM_Utils_Type::T_MONEY, | |
363 | 'title' => ts('Non-deductible Amount') , | |
364 | 'description' => 'Portion of total amount which is NOT tax deductible. Equal to total_amount for non-deductible financial types.', | |
365 | 'precision' => array( | |
366 | 20, | |
367 | 2 | |
368 | ) , | |
369 | 'import' => true, | |
370 | 'where' => 'civicrm_contribution.non_deductible_amount', | |
371 | 'headerPattern' => '/non?.?deduct/i', | |
372 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
373 | 'export' => true, | |
374 | 'html' => array( | |
375 | 'type' => 'Text', | |
376 | ) , | |
377 | ) , | |
378 | 'total_amount' => array( | |
379 | 'name' => 'total_amount', | |
380 | 'type' => CRM_Utils_Type::T_MONEY, | |
381 | 'title' => ts('Total Amount') , | |
382 | 'description' => 'Total amount of this contribution. Use market value for non-monetary gifts.', | |
383 | 'required' => true, | |
384 | 'precision' => array( | |
385 | 20, | |
386 | 2 | |
387 | ) , | |
388 | 'import' => true, | |
389 | 'where' => 'civicrm_contribution.total_amount', | |
390 | 'headerPattern' => '/^total|(.?^am(ou)?nt)/i', | |
391 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
392 | 'export' => true, | |
393 | 'html' => array( | |
394 | 'type' => 'Text', | |
395 | ) , | |
396 | ) , | |
397 | 'fee_amount' => array( | |
398 | 'name' => 'fee_amount', | |
399 | 'type' => CRM_Utils_Type::T_MONEY, | |
400 | 'title' => ts('Fee Amount') , | |
401 | 'description' => 'actual processor fee if known - may be 0.', | |
402 | 'precision' => array( | |
403 | 20, | |
404 | 2 | |
405 | ) , | |
406 | 'import' => true, | |
407 | 'where' => 'civicrm_contribution.fee_amount', | |
408 | 'headerPattern' => '/fee(.?am(ou)?nt)?/i', | |
409 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
410 | 'export' => true, | |
411 | 'html' => array( | |
412 | 'type' => 'Text', | |
413 | ) , | |
414 | ) , | |
415 | 'net_amount' => array( | |
416 | 'name' => 'net_amount', | |
417 | 'type' => CRM_Utils_Type::T_MONEY, | |
418 | 'title' => ts('Net Amount') , | |
419 | 'description' => 'actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.', | |
420 | 'precision' => array( | |
421 | 20, | |
422 | 2 | |
423 | ) , | |
424 | 'import' => true, | |
425 | 'where' => 'civicrm_contribution.net_amount', | |
426 | 'headerPattern' => '/net(.?am(ou)?nt)?/i', | |
427 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
428 | 'export' => true, | |
429 | 'html' => array( | |
430 | 'type' => 'Text', | |
431 | ) , | |
432 | ) , | |
433 | 'trxn_id' => array( | |
434 | 'name' => 'trxn_id', | |
435 | 'type' => CRM_Utils_Type::T_STRING, | |
436 | 'title' => ts('Transaction ID') , | |
437 | 'description' => 'unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method', | |
438 | 'maxlength' => 255, | |
439 | 'size' => CRM_Utils_Type::HUGE, | |
440 | 'import' => true, | |
441 | 'where' => 'civicrm_contribution.trxn_id', | |
442 | 'headerPattern' => '/tr(ansactio|x)n(.?id)?/i', | |
443 | 'dataPattern' => '', | |
444 | 'export' => true, | |
445 | 'html' => array( | |
446 | 'type' => 'Text', | |
447 | ) , | |
448 | ) , | |
449 | 'invoice_id' => array( | |
450 | 'name' => 'invoice_id', | |
451 | 'type' => CRM_Utils_Type::T_STRING, | |
452 | 'title' => ts('Invoice ID') , | |
453 | 'description' => 'unique invoice id, system generated or passed in', | |
454 | 'maxlength' => 255, | |
455 | 'size' => CRM_Utils_Type::HUGE, | |
456 | 'import' => true, | |
457 | 'where' => 'civicrm_contribution.invoice_id', | |
458 | 'headerPattern' => '/invoice(.?id)?/i', | |
459 | 'dataPattern' => '', | |
460 | 'export' => true, | |
461 | 'html' => array( | |
462 | 'type' => 'Text', | |
463 | ) , | |
464 | ) , | |
465 | 'currency' => array( | |
466 | 'name' => 'currency', | |
467 | 'type' => CRM_Utils_Type::T_STRING, | |
468 | 'title' => ts('Currency') , | |
469 | 'description' => '3 character string, value from config setting or input via user.', | |
470 | 'maxlength' => 3, | |
471 | 'size' => CRM_Utils_Type::FOUR, | |
472 | 'import' => true, | |
473 | 'where' => 'civicrm_contribution.currency', | |
474 | 'headerPattern' => '/cur(rency)?/i', | |
475 | 'dataPattern' => '/^[A-Z]{3}$/i', | |
476 | 'export' => true, | |
477 | 'default' => 'NULL', | |
478 | 'html' => array( | |
479 | 'type' => 'Select', | |
480 | ) , | |
481 | 'pseudoconstant' => array( | |
482 | 'table' => 'civicrm_currency', | |
483 | 'keyColumn' => 'name', | |
484 | 'labelColumn' => 'full_name', | |
485 | 'nameColumn' => 'name', | |
486 | ) | |
487 | ) , | |
488 | 'cancel_date' => array( | |
489 | 'name' => 'cancel_date', | |
490 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
491 | 'title' => ts('Cancel Date') , | |
492 | 'description' => 'when was gift cancelled', | |
493 | 'import' => true, | |
494 | 'where' => 'civicrm_contribution.cancel_date', | |
495 | 'headerPattern' => '/cancel(.?date)?/i', | |
496 | 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', | |
497 | 'export' => true, | |
498 | 'html' => array( | |
499 | 'type' => 'Select Date', | |
500 | ) , | |
501 | ) , | |
502 | 'cancel_reason' => array( | |
503 | 'name' => 'cancel_reason', | |
504 | 'type' => CRM_Utils_Type::T_TEXT, | |
505 | 'title' => ts('Cancel Reason') , | |
506 | 'import' => true, | |
507 | 'where' => 'civicrm_contribution.cancel_reason', | |
508 | 'headerPattern' => '/(cancel.?)?reason/i', | |
509 | 'dataPattern' => '', | |
510 | 'export' => true, | |
511 | 'html' => array( | |
512 | 'type' => 'Text', | |
513 | ) , | |
514 | ) , | |
515 | 'receipt_date' => array( | |
516 | 'name' => 'receipt_date', | |
517 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
518 | 'title' => ts('Receipt Date') , | |
519 | 'description' => 'when (if) receipt was sent. populated automatically for online donations w/ automatic receipting', | |
520 | 'import' => true, | |
521 | 'where' => 'civicrm_contribution.receipt_date', | |
522 | 'headerPattern' => '/receipt(.?date)?/i', | |
523 | 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', | |
524 | 'export' => true, | |
525 | 'html' => array( | |
526 | 'type' => 'Select Date', | |
527 | ) , | |
528 | ) , | |
529 | 'thankyou_date' => array( | |
530 | 'name' => 'thankyou_date', | |
531 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
532 | 'title' => ts('Thank-you Date') , | |
533 | 'description' => 'when (if) was donor thanked', | |
534 | 'import' => true, | |
535 | 'where' => 'civicrm_contribution.thankyou_date', | |
536 | 'headerPattern' => '/thank(s|(.?you))?(.?date)?/i', | |
537 | 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', | |
538 | 'export' => true, | |
539 | 'html' => array( | |
540 | 'type' => 'Select Date', | |
541 | ) , | |
542 | ) , | |
543 | 'contribution_source' => array( | |
544 | 'name' => 'source', | |
545 | 'type' => CRM_Utils_Type::T_STRING, | |
546 | 'title' => ts('Contribution Source') , | |
547 | 'description' => 'Origin of this Contribution.', | |
548 | 'maxlength' => 255, | |
549 | 'size' => CRM_Utils_Type::HUGE, | |
550 | 'import' => true, | |
551 | 'where' => 'civicrm_contribution.source', | |
552 | 'headerPattern' => '/source/i', | |
553 | 'dataPattern' => '', | |
554 | 'export' => true, | |
555 | 'html' => array( | |
556 | 'type' => 'Text', | |
557 | ) , | |
558 | ) , | |
559 | 'amount_level' => array( | |
560 | 'name' => 'amount_level', | |
561 | 'type' => CRM_Utils_Type::T_TEXT, | |
562 | 'title' => ts('Amount Label') , | |
563 | 'import' => true, | |
564 | 'where' => 'civicrm_contribution.amount_level', | |
565 | 'headerPattern' => '', | |
566 | 'dataPattern' => '', | |
567 | 'export' => true, | |
568 | 'html' => array( | |
569 | 'type' => 'Text', | |
570 | ) , | |
571 | ) , | |
572 | 'contribution_recur_id' => array( | |
573 | 'name' => 'contribution_recur_id', | |
574 | 'type' => CRM_Utils_Type::T_INT, | |
575 | 'title' => ts('Recurring Contribution ID') , | |
576 | 'description' => 'Conditional foreign key to civicrm_contribution_recur id. Each contribution made in connection with a recurring contribution carries a foreign key to the recurring contribution record. This assumes we can track these processor initiated events.', | |
577 | 'FKClassName' => 'CRM_Contribute_DAO_ContributionRecur', | |
578 | ) , | |
579 | 'is_test' => array( | |
580 | 'name' => 'is_test', | |
581 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
582 | 'title' => ts('Test') , | |
583 | 'import' => true, | |
584 | 'where' => 'civicrm_contribution.is_test', | |
585 | 'headerPattern' => '', | |
586 | 'dataPattern' => '', | |
587 | 'export' => true, | |
588 | 'html' => array( | |
589 | 'type' => 'CheckBox', | |
590 | ) , | |
591 | ) , | |
592 | 'is_pay_later' => array( | |
593 | 'name' => 'is_pay_later', | |
594 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
595 | 'title' => ts('Is Pay Later') , | |
596 | 'import' => true, | |
597 | 'where' => 'civicrm_contribution.is_pay_later', | |
598 | 'headerPattern' => '', | |
599 | 'dataPattern' => '', | |
600 | 'export' => true, | |
601 | 'html' => array( | |
602 | 'type' => 'CheckBox', | |
603 | ) , | |
604 | ) , | |
605 | 'contribution_status_id' => array( | |
606 | 'name' => 'contribution_status_id', | |
607 | 'type' => CRM_Utils_Type::T_INT, | |
608 | 'title' => ts('Contribution Status ID') , | |
609 | 'import' => true, | |
610 | 'where' => 'civicrm_contribution.contribution_status_id', | |
611 | 'headerPattern' => '/status/i', | |
612 | 'dataPattern' => '', | |
613 | 'export' => true, | |
614 | 'default' => '1', | |
615 | 'html' => array( | |
616 | 'type' => 'Select', | |
617 | ) , | |
618 | 'pseudoconstant' => array( | |
619 | 'optionGroupName' => 'contribution_status', | |
620 | 'optionEditPath' => 'civicrm/admin/options/contribution_status', | |
621 | ) | |
622 | ) , | |
623 | 'address_id' => array( | |
624 | 'name' => 'address_id', | |
625 | 'type' => CRM_Utils_Type::T_INT, | |
626 | 'title' => ts('Contribution Address') , | |
627 | 'description' => 'Conditional foreign key to civicrm_address.id. We insert an address record for each contribution when we have associated billing name and address data.', | |
628 | 'FKClassName' => 'CRM_Core_DAO_Address', | |
629 | ) , | |
630 | 'check_number' => array( | |
631 | 'name' => 'check_number', | |
632 | 'type' => CRM_Utils_Type::T_STRING, | |
633 | 'title' => ts('Check Number') , | |
634 | 'maxlength' => 255, | |
635 | 'size' => 6, | |
636 | 'import' => true, | |
637 | 'where' => 'civicrm_contribution.check_number', | |
638 | 'headerPattern' => '/check(.?number)?/i', | |
639 | 'dataPattern' => '', | |
640 | 'export' => true, | |
641 | 'html' => array( | |
642 | 'type' => 'Text', | |
643 | ) , | |
644 | ) , | |
645 | 'contribution_campaign_id' => array( | |
646 | 'name' => 'campaign_id', | |
647 | 'type' => CRM_Utils_Type::T_INT, | |
648 | 'title' => ts('Campaign') , | |
649 | 'description' => 'The campaign for which this contribution has been triggered.', | |
650 | 'import' => true, | |
651 | 'where' => 'civicrm_contribution.campaign_id', | |
652 | 'headerPattern' => '', | |
653 | 'dataPattern' => '', | |
654 | 'export' => true, | |
655 | 'FKClassName' => 'CRM_Campaign_DAO_Campaign', | |
656 | 'html' => array( | |
657 | 'type' => 'Select', | |
658 | ) , | |
659 | 'pseudoconstant' => array( | |
660 | 'table' => 'civicrm_campaign', | |
661 | 'keyColumn' => 'id', | |
662 | 'labelColumn' => 'title', | |
663 | ) | |
664 | ) , | |
665 | 'creditnote_id' => array( | |
666 | 'name' => 'creditnote_id', | |
667 | 'type' => CRM_Utils_Type::T_STRING, | |
668 | 'title' => ts('Credit Note ID') , | |
669 | 'description' => 'unique credit note id, system generated or passed in', | |
670 | 'maxlength' => 255, | |
671 | 'size' => CRM_Utils_Type::HUGE, | |
672 | 'import' => true, | |
673 | 'where' => 'civicrm_contribution.creditnote_id', | |
674 | 'headerPattern' => '/creditnote(.?id)?/i', | |
675 | 'dataPattern' => '', | |
676 | 'export' => true, | |
677 | 'html' => array( | |
678 | 'type' => 'Text', | |
679 | ) , | |
680 | ) , | |
681 | 'tax_amount' => array( | |
682 | 'name' => 'tax_amount', | |
683 | 'type' => CRM_Utils_Type::T_MONEY, | |
684 | 'title' => ts('Tax Amount') , | |
685 | 'description' => 'Total tax amount of this contribution.', | |
686 | 'precision' => array( | |
687 | 20, | |
688 | 2 | |
689 | ) , | |
690 | 'import' => true, | |
691 | 'where' => 'civicrm_contribution.tax_amount', | |
692 | 'headerPattern' => '/tax(.?am(ou)?nt)?/i', | |
693 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
694 | 'export' => true, | |
695 | 'html' => array( | |
696 | 'type' => 'Text', | |
697 | ) , | |
698 | ) , | |
699 | 'revenue_recognition_date' => array( | |
700 | 'name' => 'revenue_recognition_date', | |
701 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
702 | 'title' => ts('Revenue Recognition Date') , | |
703 | 'description' => 'Stores the date when revenue should be recognized.', | |
704 | 'import' => true, | |
705 | 'where' => 'civicrm_contribution.revenue_recognition_date', | |
706 | 'headerPattern' => '/revenue(.?date)?/i', | |
707 | 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', | |
708 | 'export' => true, | |
709 | 'html' => array( | |
710 | 'type' => 'Select Date', | |
711 | ) , | |
712 | ) , | |
713 | ); | |
714 | } | |
715 | return self::$_fields; | |
716 | } | |
717 | /** | |
bd8e0b14 | 718 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
719 | * |
720 | * @return array | |
bd8e0b14 | 721 | * Array(string $name => string $uniqueName). |
e501603b TO |
722 | */ |
723 | static function &fieldKeys() { | |
bd8e0b14 TO |
724 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
725 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 726 | } |
bd8e0b14 | 727 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
728 | } |
729 | /** | |
730 | * Returns the names of this table | |
731 | * | |
732 | * @return string | |
733 | */ | |
734 | static function getTableName() { | |
735 | return self::$_tableName; | |
736 | } | |
737 | /** | |
738 | * Returns if this table needs to be logged | |
739 | * | |
740 | * @return boolean | |
741 | */ | |
742 | function getLog() { | |
743 | return self::$_log; | |
744 | } | |
745 | /** | |
746 | * Returns the list of fields that can be imported | |
747 | * | |
748 | * @param bool $prefix | |
749 | * | |
750 | * @return array | |
751 | */ | |
752 | static function &import($prefix = false) { | |
60808919 TO |
753 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution', $prefix, array()); |
754 | return $r; | |
e501603b TO |
755 | } |
756 | /** | |
757 | * Returns the list of fields that can be exported | |
758 | * | |
759 | * @param bool $prefix | |
760 | * | |
761 | * @return array | |
762 | */ | |
763 | static function &export($prefix = false) { | |
60808919 TO |
764 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution', $prefix, array()); |
765 | return $r; | |
e501603b TO |
766 | } |
767 | } |