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