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