Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
8c9251b3 | 5 | * @copyright CiviCRM LLC (c) 2004-2018 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Contribute/Contribution.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
9cad3ff4 | 9 | * (GenCodeChecksum:45a20d00d01766a61687cbac5cef1482) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Contribution entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO { |
c3fc2621 | 16 | |
e501603b | 17 | /** |
f41f0342 | 18 | * Static instance to hold the table name. |
e501603b TO |
19 | * |
20 | * @var string | |
21 | */ | |
22 | static $_tableName = 'civicrm_contribution'; | |
c3fc2621 | 23 | |
e501603b | 24 | /** |
f41f0342 | 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 26 | * |
c3fc2621 | 27 | * @var bool |
e501603b | 28 | */ |
c3fc2621 CW |
29 | static $_log = TRUE; |
30 | ||
e501603b TO |
31 | /** |
32 | * Contribution ID | |
33 | * | |
34 | * @var int unsigned | |
35 | */ | |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * FK to Contact ID | |
40 | * | |
41 | * @var int unsigned | |
42 | */ | |
43 | public $contact_id; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * FK to Financial Type for (total_amount - non_deductible_amount). | |
47 | * | |
48 | * @var int unsigned | |
49 | */ | |
50 | public $financial_type_id; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * The Contribution Page which triggered this contribution | |
54 | * | |
55 | * @var int unsigned | |
56 | */ | |
57 | public $contribution_page_id; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * FK to Payment Instrument | |
61 | * | |
62 | * @var int unsigned | |
63 | */ | |
64 | public $payment_instrument_id; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * Date contribution was received - not necessarily the creation date of the record | |
68 | * | |
69 | * @var datetime | |
70 | */ | |
71 | public $receive_date; | |
c3fc2621 | 72 | |
e501603b TO |
73 | /** |
74 | * Portion of total amount which is NOT tax deductible. Equal to total_amount for non-deductible financial types. | |
75 | * | |
76 | * @var float | |
77 | */ | |
78 | public $non_deductible_amount; | |
c3fc2621 | 79 | |
e501603b TO |
80 | /** |
81 | * Total amount of this contribution. Use market value for non-monetary gifts. | |
82 | * | |
83 | * @var float | |
84 | */ | |
85 | public $total_amount; | |
c3fc2621 | 86 | |
e501603b TO |
87 | /** |
88 | * actual processor fee if known - may be 0. | |
89 | * | |
90 | * @var float | |
91 | */ | |
92 | public $fee_amount; | |
c3fc2621 | 93 | |
e501603b TO |
94 | /** |
95 | * actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount. | |
96 | * | |
97 | * @var float | |
98 | */ | |
99 | public $net_amount; | |
c3fc2621 | 100 | |
e501603b TO |
101 | /** |
102 | * unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method | |
103 | * | |
104 | * @var string | |
105 | */ | |
106 | public $trxn_id; | |
c3fc2621 | 107 | |
e501603b TO |
108 | /** |
109 | * unique invoice id, system generated or passed in | |
110 | * | |
111 | * @var string | |
112 | */ | |
113 | public $invoice_id; | |
c3fc2621 | 114 | |
9cad3ff4 CW |
115 | /** |
116 | * Human readable invoice number | |
117 | * | |
118 | * @var string | |
119 | */ | |
120 | public $invoice_number; | |
c3fc2621 | 121 | |
e501603b TO |
122 | /** |
123 | * 3 character string, value from config setting or input via user. | |
124 | * | |
125 | * @var string | |
126 | */ | |
127 | public $currency; | |
c3fc2621 | 128 | |
e501603b TO |
129 | /** |
130 | * when was gift cancelled | |
131 | * | |
132 | * @var datetime | |
133 | */ | |
134 | public $cancel_date; | |
c3fc2621 | 135 | |
e501603b | 136 | /** |
e501603b TO |
137 | * @var text |
138 | */ | |
139 | public $cancel_reason; | |
c3fc2621 | 140 | |
e501603b TO |
141 | /** |
142 | * when (if) receipt was sent. populated automatically for online donations w/ automatic receipting | |
143 | * | |
144 | * @var datetime | |
145 | */ | |
146 | public $receipt_date; | |
c3fc2621 | 147 | |
e501603b TO |
148 | /** |
149 | * when (if) was donor thanked | |
150 | * | |
151 | * @var datetime | |
152 | */ | |
153 | public $thankyou_date; | |
c3fc2621 | 154 | |
e501603b TO |
155 | /** |
156 | * Origin of this Contribution. | |
157 | * | |
158 | * @var string | |
159 | */ | |
160 | public $source; | |
c3fc2621 | 161 | |
e501603b | 162 | /** |
e501603b TO |
163 | * @var text |
164 | */ | |
165 | public $amount_level; | |
c3fc2621 | 166 | |
e501603b TO |
167 | /** |
168 | * 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. | |
169 | * | |
170 | * @var int unsigned | |
171 | */ | |
172 | public $contribution_recur_id; | |
c3fc2621 | 173 | |
e501603b | 174 | /** |
e501603b TO |
175 | * @var boolean |
176 | */ | |
177 | public $is_test; | |
c3fc2621 | 178 | |
e501603b | 179 | /** |
e501603b TO |
180 | * @var boolean |
181 | */ | |
182 | public $is_pay_later; | |
c3fc2621 | 183 | |
e501603b | 184 | /** |
e501603b TO |
185 | * @var int unsigned |
186 | */ | |
187 | public $contribution_status_id; | |
c3fc2621 | 188 | |
e501603b TO |
189 | /** |
190 | * Conditional foreign key to civicrm_address.id. We insert an address record for each contribution when we have associated billing name and address data. | |
191 | * | |
192 | * @var int unsigned | |
193 | */ | |
194 | public $address_id; | |
c3fc2621 | 195 | |
e501603b | 196 | /** |
e501603b TO |
197 | * @var string |
198 | */ | |
199 | public $check_number; | |
c3fc2621 | 200 | |
e501603b TO |
201 | /** |
202 | * The campaign for which this contribution has been triggered. | |
203 | * | |
204 | * @var int unsigned | |
205 | */ | |
206 | public $campaign_id; | |
c3fc2621 | 207 | |
e501603b TO |
208 | /** |
209 | * unique credit note id, system generated or passed in | |
210 | * | |
211 | * @var string | |
212 | */ | |
213 | public $creditnote_id; | |
c3fc2621 | 214 | |
e501603b TO |
215 | /** |
216 | * Total tax amount of this contribution. | |
217 | * | |
218 | * @var float | |
219 | */ | |
220 | public $tax_amount; | |
c3fc2621 | 221 | |
e501603b TO |
222 | /** |
223 | * Stores the date when revenue should be recognized. | |
224 | * | |
225 | * @var datetime | |
226 | */ | |
227 | public $revenue_recognition_date; | |
c3fc2621 | 228 | |
e501603b | 229 | /** |
f41f0342 | 230 | * Class constructor. |
e501603b | 231 | */ |
c3fc2621 | 232 | public function __construct() { |
e501603b TO |
233 | $this->__table = 'civicrm_contribution'; |
234 | parent::__construct(); | |
235 | } | |
c3fc2621 | 236 | |
e501603b | 237 | /** |
f41f0342 | 238 | * Returns foreign keys and entity references. |
e501603b TO |
239 | * |
240 | * @return array | |
241 | * [CRM_Core_Reference_Interface] | |
242 | */ | |
c3fc2621 | 243 | public static function getReferenceColumns() { |
346aaaba TO |
244 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
245 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
c3fc2621 CW |
246 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); |
247 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); | |
248 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_page_id', 'civicrm_contribution_page', 'id'); | |
249 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_recur_id', 'civicrm_contribution_recur', 'id'); | |
250 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'address_id', 'civicrm_address', 'id'); | |
251 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id'); | |
346aaaba | 252 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 253 | } |
346aaaba | 254 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 255 | } |
c3fc2621 | 256 | |
e501603b TO |
257 | /** |
258 | * Returns all the column names of this table | |
259 | * | |
260 | * @return array | |
261 | */ | |
c3fc2621 | 262 | public static function &fields() { |
346aaaba | 263 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
264 | Civi::$statics[__CLASS__]['fields'] = [ |
265 | 'contribution_id' => [ | |
e501603b TO |
266 | 'name' => 'id', |
267 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 268 | 'title' => ts('Contribution ID'), |
215b423e | 269 | 'description' => ts('Contribution ID'), |
c3fc2621 CW |
270 | 'required' => TRUE, |
271 | 'import' => TRUE, | |
e501603b TO |
272 | 'where' => 'civicrm_contribution.id', |
273 | 'headerPattern' => '', | |
274 | 'dataPattern' => '', | |
c3fc2621 | 275 | 'export' => TRUE, |
522a26c9 | 276 | 'table_name' => 'civicrm_contribution', |
277 | 'entity' => 'Contribution', | |
278 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 279 | 'localizable' => 0, |
c3fc2621 CW |
280 | ], |
281 | 'contribution_contact_id' => [ | |
e501603b TO |
282 | 'name' => 'contact_id', |
283 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 284 | 'title' => ts('Contact ID'), |
215b423e | 285 | 'description' => ts('FK to Contact ID'), |
c3fc2621 CW |
286 | 'required' => TRUE, |
287 | 'import' => TRUE, | |
e501603b TO |
288 | 'where' => 'civicrm_contribution.contact_id', |
289 | 'headerPattern' => '/contact(.?id)?/i', | |
290 | 'dataPattern' => '/^\d+$/', | |
c3fc2621 | 291 | 'export' => TRUE, |
522a26c9 | 292 | 'table_name' => 'civicrm_contribution', |
293 | 'entity' => 'Contribution', | |
294 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 295 | 'localizable' => 0, |
e501603b | 296 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c3fc2621 | 297 | 'html' => [ |
e501603b | 298 | 'type' => 'EntityRef', |
c3fc2621 CW |
299 | ], |
300 | ], | |
301 | 'financial_type_id' => [ | |
e501603b TO |
302 | 'name' => 'financial_type_id', |
303 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 304 | 'title' => ts('Financial Type'), |
215b423e | 305 | 'description' => ts('FK to Financial Type for (total_amount - non_deductible_amount).'), |
c3fc2621 | 306 | 'export' => TRUE, |
e501603b TO |
307 | 'where' => 'civicrm_contribution.financial_type_id', |
308 | 'headerPattern' => '', | |
309 | 'dataPattern' => '', | |
522a26c9 | 310 | 'table_name' => 'civicrm_contribution', |
311 | 'entity' => 'Contribution', | |
312 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 313 | 'localizable' => 0, |
e501603b | 314 | 'FKClassName' => 'CRM_Financial_DAO_FinancialType', |
c3fc2621 | 315 | 'html' => [ |
e501603b | 316 | 'type' => 'Select', |
c3fc2621 CW |
317 | ], |
318 | 'pseudoconstant' => [ | |
e501603b TO |
319 | 'table' => 'civicrm_financial_type', |
320 | 'keyColumn' => 'id', | |
321 | 'labelColumn' => 'name', | |
c3fc2621 CW |
322 | ] |
323 | ], | |
324 | 'contribution_page_id' => [ | |
e501603b TO |
325 | 'name' => 'contribution_page_id', |
326 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 327 | 'title' => ts('Contribution Page ID'), |
215b423e | 328 | 'description' => ts('The Contribution Page which triggered this contribution'), |
c3fc2621 | 329 | 'import' => TRUE, |
e501603b TO |
330 | 'where' => 'civicrm_contribution.contribution_page_id', |
331 | 'headerPattern' => '', | |
332 | 'dataPattern' => '', | |
c3fc2621 | 333 | 'export' => TRUE, |
522a26c9 | 334 | 'table_name' => 'civicrm_contribution', |
335 | 'entity' => 'Contribution', | |
336 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 337 | 'localizable' => 0, |
e501603b | 338 | 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage', |
c3fc2621 | 339 | 'html' => [ |
e501603b | 340 | 'type' => 'Select', |
c3fc2621 CW |
341 | ], |
342 | 'pseudoconstant' => [ | |
e501603b TO |
343 | 'table' => 'civicrm_contribution_page', |
344 | 'keyColumn' => 'id', | |
345 | 'labelColumn' => 'title', | |
c3fc2621 CW |
346 | ] |
347 | ], | |
348 | 'payment_instrument_id' => [ | |
e501603b TO |
349 | 'name' => 'payment_instrument_id', |
350 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 351 | 'title' => ts('Payment Method ID'), |
215b423e | 352 | 'description' => ts('FK to Payment Instrument'), |
c3fc2621 | 353 | 'export' => TRUE, |
9d5c7f14 | 354 | 'where' => 'civicrm_contribution.payment_instrument_id', |
355 | 'headerPattern' => '/^payment|(p(ayment\s)?instrument)$/i', | |
356 | 'dataPattern' => '', | |
522a26c9 | 357 | 'table_name' => 'civicrm_contribution', |
358 | 'entity' => 'Contribution', | |
359 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 360 | 'localizable' => 0, |
c3fc2621 | 361 | 'html' => [ |
e501603b | 362 | 'type' => 'Select', |
c3fc2621 CW |
363 | ], |
364 | 'pseudoconstant' => [ | |
e501603b TO |
365 | 'optionGroupName' => 'payment_instrument', |
366 | 'optionEditPath' => 'civicrm/admin/options/payment_instrument', | |
c3fc2621 CW |
367 | ] |
368 | ], | |
369 | 'receive_date' => [ | |
e501603b TO |
370 | 'name' => 'receive_date', |
371 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 372 | 'title' => ts('Date Received'), |
215b423e | 373 | 'description' => ts('Date contribution was received - not necessarily the creation date of the record'), |
c3fc2621 | 374 | 'import' => TRUE, |
e501603b TO |
375 | 'where' => 'civicrm_contribution.receive_date', |
376 | 'headerPattern' => '/receive(.?date)?/i', | |
377 | 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', | |
c3fc2621 | 378 | 'export' => TRUE, |
522a26c9 | 379 | 'table_name' => 'civicrm_contribution', |
380 | 'entity' => 'Contribution', | |
381 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 382 | 'localizable' => 0, |
c3fc2621 | 383 | 'html' => [ |
e501603b | 384 | 'type' => 'Select Date', |
24317d89 | 385 | 'formatType' => 'activityDateTime', |
c3fc2621 CW |
386 | ], |
387 | ], | |
388 | 'non_deductible_amount' => [ | |
e501603b TO |
389 | 'name' => 'non_deductible_amount', |
390 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 391 | 'title' => ts('Non-deductible Amount'), |
215b423e | 392 | 'description' => ts('Portion of total amount which is NOT tax deductible. Equal to total_amount for non-deductible financial types.'), |
c3fc2621 | 393 | 'precision' => [ |
e501603b TO |
394 | 20, |
395 | 2 | |
c3fc2621 CW |
396 | ], |
397 | 'import' => TRUE, | |
e501603b TO |
398 | 'where' => 'civicrm_contribution.non_deductible_amount', |
399 | 'headerPattern' => '/non?.?deduct/i', | |
400 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
c3fc2621 | 401 | 'export' => TRUE, |
45a83e42 | 402 | 'default' => '0', |
522a26c9 | 403 | 'table_name' => 'civicrm_contribution', |
404 | 'entity' => 'Contribution', | |
405 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 406 | 'localizable' => 0, |
c3fc2621 | 407 | 'html' => [ |
e501603b | 408 | 'type' => 'Text', |
c3fc2621 CW |
409 | ], |
410 | ], | |
411 | 'total_amount' => [ | |
e501603b TO |
412 | 'name' => 'total_amount', |
413 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 414 | 'title' => ts('Total Amount'), |
215b423e | 415 | 'description' => ts('Total amount of this contribution. Use market value for non-monetary gifts.'), |
c3fc2621 CW |
416 | 'required' => TRUE, |
417 | 'precision' => [ | |
e501603b TO |
418 | 20, |
419 | 2 | |
c3fc2621 CW |
420 | ], |
421 | 'import' => TRUE, | |
e501603b TO |
422 | 'where' => 'civicrm_contribution.total_amount', |
423 | 'headerPattern' => '/^total|(.?^am(ou)?nt)/i', | |
424 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
c3fc2621 | 425 | 'export' => TRUE, |
522a26c9 | 426 | 'table_name' => 'civicrm_contribution', |
427 | 'entity' => 'Contribution', | |
428 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 429 | 'localizable' => 0, |
c3fc2621 | 430 | 'html' => [ |
e501603b | 431 | 'type' => 'Text', |
c3fc2621 CW |
432 | ], |
433 | ], | |
434 | 'fee_amount' => [ | |
e501603b TO |
435 | 'name' => 'fee_amount', |
436 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 437 | 'title' => ts('Fee Amount'), |
215b423e | 438 | 'description' => ts('actual processor fee if known - may be 0.'), |
c3fc2621 | 439 | 'precision' => [ |
e501603b TO |
440 | 20, |
441 | 2 | |
c3fc2621 CW |
442 | ], |
443 | 'import' => TRUE, | |
e501603b TO |
444 | 'where' => 'civicrm_contribution.fee_amount', |
445 | 'headerPattern' => '/fee(.?am(ou)?nt)?/i', | |
446 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
c3fc2621 | 447 | 'export' => TRUE, |
522a26c9 | 448 | 'table_name' => 'civicrm_contribution', |
449 | 'entity' => 'Contribution', | |
450 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 451 | 'localizable' => 0, |
c3fc2621 | 452 | 'html' => [ |
e501603b | 453 | 'type' => 'Text', |
c3fc2621 CW |
454 | ], |
455 | ], | |
456 | 'net_amount' => [ | |
e501603b TO |
457 | 'name' => 'net_amount', |
458 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 459 | 'title' => ts('Net Amount'), |
215b423e | 460 | 'description' => ts('actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.'), |
c3fc2621 | 461 | 'precision' => [ |
e501603b TO |
462 | 20, |
463 | 2 | |
c3fc2621 CW |
464 | ], |
465 | 'import' => TRUE, | |
e501603b TO |
466 | 'where' => 'civicrm_contribution.net_amount', |
467 | 'headerPattern' => '/net(.?am(ou)?nt)?/i', | |
468 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
c3fc2621 | 469 | 'export' => TRUE, |
522a26c9 | 470 | 'table_name' => 'civicrm_contribution', |
471 | 'entity' => 'Contribution', | |
472 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 473 | 'localizable' => 0, |
c3fc2621 | 474 | 'html' => [ |
e501603b | 475 | 'type' => 'Text', |
c3fc2621 CW |
476 | ], |
477 | ], | |
478 | 'trxn_id' => [ | |
e501603b TO |
479 | 'name' => 'trxn_id', |
480 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 481 | 'title' => ts('Transaction ID'), |
215b423e | 482 | 'description' => ts('unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method'), |
e501603b TO |
483 | 'maxlength' => 255, |
484 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 485 | 'import' => TRUE, |
e501603b TO |
486 | 'where' => 'civicrm_contribution.trxn_id', |
487 | 'headerPattern' => '/tr(ansactio|x)n(.?id)?/i', | |
488 | 'dataPattern' => '', | |
c3fc2621 | 489 | 'export' => TRUE, |
522a26c9 | 490 | 'table_name' => 'civicrm_contribution', |
491 | 'entity' => 'Contribution', | |
492 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 493 | 'localizable' => 0, |
c3fc2621 | 494 | 'html' => [ |
e501603b | 495 | 'type' => 'Text', |
c3fc2621 CW |
496 | ], |
497 | ], | |
498 | 'invoice_id' => [ | |
e501603b TO |
499 | 'name' => 'invoice_id', |
500 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 501 | 'title' => ts('Invoice Reference'), |
215b423e | 502 | 'description' => ts('unique invoice id, system generated or passed in'), |
e501603b TO |
503 | 'maxlength' => 255, |
504 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 505 | 'import' => TRUE, |
e501603b TO |
506 | 'where' => 'civicrm_contribution.invoice_id', |
507 | 'headerPattern' => '/invoice(.?id)?/i', | |
508 | 'dataPattern' => '', | |
c3fc2621 | 509 | 'export' => TRUE, |
522a26c9 | 510 | 'table_name' => 'civicrm_contribution', |
511 | 'entity' => 'Contribution', | |
512 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 513 | 'localizable' => 0, |
c3fc2621 | 514 | 'html' => [ |
e501603b | 515 | 'type' => 'Text', |
c3fc2621 CW |
516 | ], |
517 | ], | |
518 | 'invoice_number' => [ | |
9cad3ff4 CW |
519 | 'name' => 'invoice_number', |
520 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 521 | 'title' => ts('Invoice Number'), |
215b423e | 522 | 'description' => ts('Human readable invoice number'), |
9cad3ff4 CW |
523 | 'maxlength' => 255, |
524 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 525 | 'import' => TRUE, |
9cad3ff4 CW |
526 | 'where' => 'civicrm_contribution.invoice_number', |
527 | 'headerPattern' => '/invoice(.?number)?/i', | |
528 | 'dataPattern' => '', | |
c3fc2621 | 529 | 'export' => TRUE, |
9cad3ff4 CW |
530 | 'table_name' => 'civicrm_contribution', |
531 | 'entity' => 'Contribution', | |
532 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
533 | 'localizable' => 0, | |
c3fc2621 | 534 | 'html' => [ |
9cad3ff4 | 535 | 'type' => 'Text', |
c3fc2621 CW |
536 | ], |
537 | ], | |
538 | 'currency' => [ | |
e501603b TO |
539 | 'name' => 'currency', |
540 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 541 | 'title' => ts('Currency'), |
215b423e | 542 | 'description' => ts('3 character string, value from config setting or input via user.'), |
e501603b TO |
543 | 'maxlength' => 3, |
544 | 'size' => CRM_Utils_Type::FOUR, | |
c3fc2621 | 545 | 'import' => TRUE, |
e501603b TO |
546 | 'where' => 'civicrm_contribution.currency', |
547 | 'headerPattern' => '/cur(rency)?/i', | |
548 | 'dataPattern' => '/^[A-Z]{3}$/i', | |
c3fc2621 | 549 | 'export' => TRUE, |
e501603b | 550 | 'default' => 'NULL', |
522a26c9 | 551 | 'table_name' => 'civicrm_contribution', |
552 | 'entity' => 'Contribution', | |
553 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 554 | 'localizable' => 0, |
c3fc2621 | 555 | 'html' => [ |
e501603b | 556 | 'type' => 'Select', |
c3fc2621 CW |
557 | ], |
558 | 'pseudoconstant' => [ | |
e501603b TO |
559 | 'table' => 'civicrm_currency', |
560 | 'keyColumn' => 'name', | |
561 | 'labelColumn' => 'full_name', | |
562 | 'nameColumn' => 'name', | |
c3fc2621 CW |
563 | ] |
564 | ], | |
565 | 'cancel_date' => [ | |
e501603b TO |
566 | 'name' => 'cancel_date', |
567 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 568 | 'title' => ts('Cancel Date'), |
215b423e | 569 | 'description' => ts('when was gift cancelled'), |
c3fc2621 | 570 | 'import' => TRUE, |
e501603b TO |
571 | 'where' => 'civicrm_contribution.cancel_date', |
572 | 'headerPattern' => '/cancel(.?date)?/i', | |
573 | 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', | |
c3fc2621 | 574 | 'export' => TRUE, |
522a26c9 | 575 | 'table_name' => 'civicrm_contribution', |
576 | 'entity' => 'Contribution', | |
577 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 578 | 'localizable' => 0, |
c3fc2621 | 579 | 'html' => [ |
e501603b | 580 | 'type' => 'Select Date', |
24317d89 | 581 | 'formatType' => 'activityDateTime', |
c3fc2621 CW |
582 | ], |
583 | ], | |
584 | 'cancel_reason' => [ | |
e501603b TO |
585 | 'name' => 'cancel_reason', |
586 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 CW |
587 | 'title' => ts('Cancel Reason'), |
588 | 'import' => TRUE, | |
e501603b TO |
589 | 'where' => 'civicrm_contribution.cancel_reason', |
590 | 'headerPattern' => '/(cancel.?)?reason/i', | |
591 | 'dataPattern' => '', | |
c3fc2621 | 592 | 'export' => TRUE, |
522a26c9 | 593 | 'table_name' => 'civicrm_contribution', |
594 | 'entity' => 'Contribution', | |
595 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 596 | 'localizable' => 0, |
c3fc2621 | 597 | 'html' => [ |
e501603b | 598 | 'type' => 'Text', |
c3fc2621 CW |
599 | ], |
600 | ], | |
601 | 'receipt_date' => [ | |
e501603b TO |
602 | 'name' => 'receipt_date', |
603 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 604 | 'title' => ts('Receipt Date'), |
215b423e | 605 | 'description' => ts('when (if) receipt was sent. populated automatically for online donations w/ automatic receipting'), |
c3fc2621 | 606 | 'import' => TRUE, |
e501603b TO |
607 | 'where' => 'civicrm_contribution.receipt_date', |
608 | 'headerPattern' => '/receipt(.?date)?/i', | |
609 | 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', | |
c3fc2621 | 610 | 'export' => TRUE, |
522a26c9 | 611 | 'table_name' => 'civicrm_contribution', |
612 | 'entity' => 'Contribution', | |
613 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 614 | 'localizable' => 0, |
c3fc2621 | 615 | 'html' => [ |
e501603b | 616 | 'type' => 'Select Date', |
24317d89 | 617 | 'formatType' => 'activityDateTime', |
c3fc2621 CW |
618 | ], |
619 | ], | |
620 | 'thankyou_date' => [ | |
e501603b TO |
621 | 'name' => 'thankyou_date', |
622 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 623 | 'title' => ts('Thank-you Date'), |
215b423e | 624 | 'description' => ts('when (if) was donor thanked'), |
c3fc2621 | 625 | 'import' => TRUE, |
e501603b TO |
626 | 'where' => 'civicrm_contribution.thankyou_date', |
627 | 'headerPattern' => '/thank(s|(.?you))?(.?date)?/i', | |
628 | 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', | |
c3fc2621 | 629 | 'export' => TRUE, |
522a26c9 | 630 | 'table_name' => 'civicrm_contribution', |
631 | 'entity' => 'Contribution', | |
632 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 633 | 'localizable' => 0, |
c3fc2621 | 634 | 'html' => [ |
e501603b | 635 | 'type' => 'Select Date', |
24317d89 | 636 | 'formatType' => 'activityDateTime', |
c3fc2621 CW |
637 | ], |
638 | ], | |
639 | 'contribution_source' => [ | |
e501603b TO |
640 | 'name' => 'source', |
641 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 642 | 'title' => ts('Contribution Source'), |
215b423e | 643 | 'description' => ts('Origin of this Contribution.'), |
e501603b TO |
644 | 'maxlength' => 255, |
645 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 646 | 'import' => TRUE, |
e501603b TO |
647 | 'where' => 'civicrm_contribution.source', |
648 | 'headerPattern' => '/source/i', | |
649 | 'dataPattern' => '', | |
c3fc2621 | 650 | 'export' => TRUE, |
522a26c9 | 651 | 'table_name' => 'civicrm_contribution', |
652 | 'entity' => 'Contribution', | |
653 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 654 | 'localizable' => 0, |
c3fc2621 | 655 | 'html' => [ |
e501603b | 656 | 'type' => 'Text', |
c3fc2621 CW |
657 | ], |
658 | ], | |
659 | 'amount_level' => [ | |
e501603b TO |
660 | 'name' => 'amount_level', |
661 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 CW |
662 | 'title' => ts('Amount Label'), |
663 | 'import' => TRUE, | |
e501603b TO |
664 | 'where' => 'civicrm_contribution.amount_level', |
665 | 'headerPattern' => '', | |
666 | 'dataPattern' => '', | |
c3fc2621 | 667 | 'export' => TRUE, |
522a26c9 | 668 | 'table_name' => 'civicrm_contribution', |
669 | 'entity' => 'Contribution', | |
670 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 671 | 'localizable' => 0, |
c3fc2621 | 672 | 'html' => [ |
e501603b | 673 | 'type' => 'Text', |
c3fc2621 CW |
674 | ], |
675 | ], | |
676 | 'contribution_recur_id' => [ | |
e501603b TO |
677 | 'name' => 'contribution_recur_id', |
678 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 679 | 'title' => ts('Recurring Contribution ID'), |
215b423e | 680 | 'description' => ts('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.'), |
c3fc2621 | 681 | 'export' => TRUE, |
3123273f | 682 | 'where' => 'civicrm_contribution.contribution_recur_id', |
683 | 'headerPattern' => '', | |
684 | 'dataPattern' => '', | |
522a26c9 | 685 | 'table_name' => 'civicrm_contribution', |
686 | 'entity' => 'Contribution', | |
687 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 688 | 'localizable' => 0, |
e501603b | 689 | 'FKClassName' => 'CRM_Contribute_DAO_ContributionRecur', |
c3fc2621 CW |
690 | ], |
691 | 'is_test' => [ | |
e501603b TO |
692 | 'name' => 'is_test', |
693 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 CW |
694 | 'title' => ts('Test'), |
695 | 'import' => TRUE, | |
e501603b TO |
696 | 'where' => 'civicrm_contribution.is_test', |
697 | 'headerPattern' => '', | |
698 | 'dataPattern' => '', | |
c3fc2621 | 699 | 'export' => TRUE, |
45a83e42 | 700 | 'default' => '0', |
522a26c9 | 701 | 'table_name' => 'civicrm_contribution', |
702 | 'entity' => 'Contribution', | |
703 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 704 | 'localizable' => 0, |
c3fc2621 | 705 | 'html' => [ |
e501603b | 706 | 'type' => 'CheckBox', |
c3fc2621 CW |
707 | ], |
708 | ], | |
709 | 'is_pay_later' => [ | |
e501603b TO |
710 | 'name' => 'is_pay_later', |
711 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 CW |
712 | 'title' => ts('Is Pay Later'), |
713 | 'import' => TRUE, | |
e501603b TO |
714 | 'where' => 'civicrm_contribution.is_pay_later', |
715 | 'headerPattern' => '', | |
716 | 'dataPattern' => '', | |
c3fc2621 | 717 | 'export' => TRUE, |
45a83e42 | 718 | 'default' => '0', |
522a26c9 | 719 | 'table_name' => 'civicrm_contribution', |
720 | 'entity' => 'Contribution', | |
721 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 722 | 'localizable' => 0, |
c3fc2621 | 723 | 'html' => [ |
e501603b | 724 | 'type' => 'CheckBox', |
c3fc2621 CW |
725 | ], |
726 | ], | |
727 | 'contribution_status_id' => [ | |
e501603b TO |
728 | 'name' => 'contribution_status_id', |
729 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
730 | 'title' => ts('Contribution Status ID'), |
731 | 'import' => TRUE, | |
e501603b TO |
732 | 'where' => 'civicrm_contribution.contribution_status_id', |
733 | 'headerPattern' => '/status/i', | |
734 | 'dataPattern' => '', | |
c3fc2621 | 735 | 'export' => TRUE, |
e501603b | 736 | 'default' => '1', |
522a26c9 | 737 | 'table_name' => 'civicrm_contribution', |
738 | 'entity' => 'Contribution', | |
739 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 740 | 'localizable' => 0, |
c3fc2621 | 741 | 'html' => [ |
e501603b | 742 | 'type' => 'Select', |
c3fc2621 CW |
743 | ], |
744 | 'pseudoconstant' => [ | |
e501603b TO |
745 | 'optionGroupName' => 'contribution_status', |
746 | 'optionEditPath' => 'civicrm/admin/options/contribution_status', | |
c3fc2621 CW |
747 | ] |
748 | ], | |
749 | 'contribution_address_id' => [ | |
e501603b TO |
750 | 'name' => 'address_id', |
751 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 752 | 'title' => ts('Contribution Address'), |
215b423e | 753 | 'description' => ts('Conditional foreign key to civicrm_address.id. We insert an address record for each contribution when we have associated billing name and address data.'), |
c3fc2621 | 754 | 'export' => TRUE, |
3123273f | 755 | 'where' => 'civicrm_contribution.address_id', |
756 | 'headerPattern' => '', | |
757 | 'dataPattern' => '', | |
522a26c9 | 758 | 'table_name' => 'civicrm_contribution', |
759 | 'entity' => 'Contribution', | |
760 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 761 | 'localizable' => 0, |
e501603b | 762 | 'FKClassName' => 'CRM_Core_DAO_Address', |
c3fc2621 CW |
763 | ], |
764 | 'contribution_check_number' => [ | |
e501603b TO |
765 | 'name' => 'check_number', |
766 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 767 | 'title' => ts('Check Number'), |
e501603b TO |
768 | 'maxlength' => 255, |
769 | 'size' => 6, | |
c3fc2621 | 770 | 'import' => TRUE, |
e501603b TO |
771 | 'where' => 'civicrm_contribution.check_number', |
772 | 'headerPattern' => '/check(.?number)?/i', | |
773 | 'dataPattern' => '', | |
c3fc2621 | 774 | 'export' => TRUE, |
522a26c9 | 775 | 'table_name' => 'civicrm_contribution', |
776 | 'entity' => 'Contribution', | |
777 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 778 | 'localizable' => 0, |
c3fc2621 | 779 | 'html' => [ |
e501603b | 780 | 'type' => 'Text', |
c3fc2621 CW |
781 | ], |
782 | ], | |
783 | 'contribution_campaign_id' => [ | |
e501603b TO |
784 | 'name' => 'campaign_id', |
785 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 786 | 'title' => ts('Campaign'), |
215b423e | 787 | 'description' => ts('The campaign for which this contribution has been triggered.'), |
c3fc2621 | 788 | 'import' => TRUE, |
e501603b TO |
789 | 'where' => 'civicrm_contribution.campaign_id', |
790 | 'headerPattern' => '', | |
791 | 'dataPattern' => '', | |
c3fc2621 | 792 | 'export' => TRUE, |
522a26c9 | 793 | 'table_name' => 'civicrm_contribution', |
794 | 'entity' => 'Contribution', | |
795 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 796 | 'localizable' => 0, |
e501603b | 797 | 'FKClassName' => 'CRM_Campaign_DAO_Campaign', |
c3fc2621 | 798 | 'html' => [ |
e501603b | 799 | 'type' => 'Select', |
c3fc2621 CW |
800 | ], |
801 | 'pseudoconstant' => [ | |
e501603b TO |
802 | 'table' => 'civicrm_campaign', |
803 | 'keyColumn' => 'id', | |
804 | 'labelColumn' => 'title', | |
c3fc2621 CW |
805 | ] |
806 | ], | |
807 | 'creditnote_id' => [ | |
e501603b TO |
808 | 'name' => 'creditnote_id', |
809 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 810 | 'title' => ts('Credit Note ID'), |
215b423e | 811 | 'description' => ts('unique credit note id, system generated or passed in'), |
e501603b TO |
812 | 'maxlength' => 255, |
813 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 814 | 'import' => TRUE, |
e501603b TO |
815 | 'where' => 'civicrm_contribution.creditnote_id', |
816 | 'headerPattern' => '/creditnote(.?id)?/i', | |
817 | 'dataPattern' => '', | |
c3fc2621 | 818 | 'export' => TRUE, |
522a26c9 | 819 | 'table_name' => 'civicrm_contribution', |
820 | 'entity' => 'Contribution', | |
821 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 822 | 'localizable' => 0, |
c3fc2621 | 823 | 'html' => [ |
e501603b | 824 | 'type' => 'Text', |
c3fc2621 CW |
825 | ], |
826 | ], | |
827 | 'tax_amount' => [ | |
e501603b TO |
828 | 'name' => 'tax_amount', |
829 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 830 | 'title' => ts('Tax Amount'), |
215b423e | 831 | 'description' => ts('Total tax amount of this contribution.'), |
c3fc2621 | 832 | 'precision' => [ |
e501603b TO |
833 | 20, |
834 | 2 | |
c3fc2621 CW |
835 | ], |
836 | 'import' => TRUE, | |
e501603b TO |
837 | 'where' => 'civicrm_contribution.tax_amount', |
838 | 'headerPattern' => '/tax(.?am(ou)?nt)?/i', | |
839 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
c3fc2621 | 840 | 'export' => TRUE, |
522a26c9 | 841 | 'table_name' => 'civicrm_contribution', |
842 | 'entity' => 'Contribution', | |
843 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 844 | 'localizable' => 0, |
c3fc2621 | 845 | 'html' => [ |
e501603b | 846 | 'type' => 'Text', |
c3fc2621 CW |
847 | ], |
848 | ], | |
849 | 'revenue_recognition_date' => [ | |
e501603b TO |
850 | 'name' => 'revenue_recognition_date', |
851 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 852 | 'title' => ts('Revenue Recognition Date'), |
215b423e | 853 | 'description' => ts('Stores the date when revenue should be recognized.'), |
c3fc2621 | 854 | 'import' => TRUE, |
e501603b TO |
855 | 'where' => 'civicrm_contribution.revenue_recognition_date', |
856 | 'headerPattern' => '/revenue(.?date)?/i', | |
857 | 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', | |
c3fc2621 | 858 | 'export' => TRUE, |
522a26c9 | 859 | 'table_name' => 'civicrm_contribution', |
860 | 'entity' => 'Contribution', | |
861 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 862 | 'localizable' => 0, |
c3fc2621 | 863 | 'html' => [ |
e501603b | 864 | 'type' => 'Select Date', |
24317d89 | 865 | 'formatType' => 'activityDateTime', |
c3fc2621 CW |
866 | ], |
867 | ], | |
868 | ]; | |
346aaaba | 869 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 870 | } |
346aaaba | 871 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 872 | } |
c3fc2621 | 873 | |
e501603b | 874 | /** |
bd8e0b14 | 875 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
876 | * |
877 | * @return array | |
bd8e0b14 | 878 | * Array(string $name => string $uniqueName). |
e501603b | 879 | */ |
c3fc2621 | 880 | public static function &fieldKeys() { |
bd8e0b14 TO |
881 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
882 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 883 | } |
bd8e0b14 | 884 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 885 | } |
c3fc2621 | 886 | |
e501603b TO |
887 | /** |
888 | * Returns the names of this table | |
889 | * | |
890 | * @return string | |
891 | */ | |
c3fc2621 | 892 | public static function getTableName() { |
e501603b TO |
893 | return self::$_tableName; |
894 | } | |
c3fc2621 | 895 | |
e501603b TO |
896 | /** |
897 | * Returns if this table needs to be logged | |
898 | * | |
c3fc2621 | 899 | * @return bool |
e501603b | 900 | */ |
c3fc2621 | 901 | public function getLog() { |
e501603b TO |
902 | return self::$_log; |
903 | } | |
c3fc2621 | 904 | |
e501603b TO |
905 | /** |
906 | * Returns the list of fields that can be imported | |
907 | * | |
908 | * @param bool $prefix | |
909 | * | |
910 | * @return array | |
911 | */ | |
c3fc2621 CW |
912 | public static function &import($prefix = FALSE) { |
913 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution', $prefix, []); | |
60808919 | 914 | return $r; |
e501603b | 915 | } |
c3fc2621 | 916 | |
e501603b TO |
917 | /** |
918 | * Returns the list of fields that can be exported | |
919 | * | |
920 | * @param bool $prefix | |
921 | * | |
922 | * @return array | |
923 | */ | |
c3fc2621 CW |
924 | public static function &export($prefix = FALSE) { |
925 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution', $prefix, []); | |
60808919 | 926 | return $r; |
e501603b | 927 | } |
c3fc2621 | 928 | |
e7a6b91a AS |
929 | /** |
930 | * Returns the list of indices | |
c3fc2621 CW |
931 | * |
932 | * @param bool $localize | |
933 | * | |
934 | * @return array | |
e7a6b91a AS |
935 | */ |
936 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
937 | $indices = [ |
938 | 'UI_contrib_payment_instrument_id' => [ | |
e7a6b91a | 939 | 'name' => 'UI_contrib_payment_instrument_id', |
c3fc2621 | 940 | 'field' => [ |
e7a6b91a | 941 | 0 => 'payment_instrument_id', |
c3fc2621 CW |
942 | ], |
943 | 'localizable' => FALSE, | |
e7a6b91a | 944 | 'sig' => 'civicrm_contribution::0::payment_instrument_id', |
c3fc2621 CW |
945 | ], |
946 | 'index_total_amount_receive_date' => [ | |
e7a6b91a | 947 | 'name' => 'index_total_amount_receive_date', |
c3fc2621 | 948 | 'field' => [ |
e7a6b91a AS |
949 | 0 => 'total_amount', |
950 | 1 => 'receive_date', | |
c3fc2621 CW |
951 | ], |
952 | 'localizable' => FALSE, | |
e7a6b91a | 953 | 'sig' => 'civicrm_contribution::0::total_amount::receive_date', |
c3fc2621 CW |
954 | ], |
955 | 'index_source' => [ | |
e7a6b91a | 956 | 'name' => 'index_source', |
c3fc2621 | 957 | 'field' => [ |
e7a6b91a | 958 | 0 => 'source', |
c3fc2621 CW |
959 | ], |
960 | 'localizable' => FALSE, | |
e7a6b91a | 961 | 'sig' => 'civicrm_contribution::0::source', |
c3fc2621 CW |
962 | ], |
963 | 'UI_contrib_trxn_id' => [ | |
e7a6b91a | 964 | 'name' => 'UI_contrib_trxn_id', |
c3fc2621 | 965 | 'field' => [ |
e7a6b91a | 966 | 0 => 'trxn_id', |
c3fc2621 CW |
967 | ], |
968 | 'localizable' => FALSE, | |
969 | 'unique' => TRUE, | |
e7a6b91a | 970 | 'sig' => 'civicrm_contribution::1::trxn_id', |
c3fc2621 CW |
971 | ], |
972 | 'UI_contrib_invoice_id' => [ | |
e7a6b91a | 973 | 'name' => 'UI_contrib_invoice_id', |
c3fc2621 | 974 | 'field' => [ |
e7a6b91a | 975 | 0 => 'invoice_id', |
c3fc2621 CW |
976 | ], |
977 | 'localizable' => FALSE, | |
978 | 'unique' => TRUE, | |
e7a6b91a | 979 | 'sig' => 'civicrm_contribution::1::invoice_id', |
c3fc2621 CW |
980 | ], |
981 | 'index_contribution_status' => [ | |
e7a6b91a | 982 | 'name' => 'index_contribution_status', |
c3fc2621 | 983 | 'field' => [ |
e7a6b91a | 984 | 0 => 'contribution_status_id', |
c3fc2621 CW |
985 | ], |
986 | 'localizable' => FALSE, | |
e7a6b91a | 987 | 'sig' => 'civicrm_contribution::0::contribution_status_id', |
c3fc2621 CW |
988 | ], |
989 | 'received_date' => [ | |
e7a6b91a | 990 | 'name' => 'received_date', |
c3fc2621 | 991 | 'field' => [ |
e7a6b91a | 992 | 0 => 'receive_date', |
c3fc2621 CW |
993 | ], |
994 | 'localizable' => FALSE, | |
e7a6b91a | 995 | 'sig' => 'civicrm_contribution::0::receive_date', |
c3fc2621 CW |
996 | ], |
997 | 'check_number' => [ | |
e7a6b91a | 998 | 'name' => 'check_number', |
c3fc2621 | 999 | 'field' => [ |
e7a6b91a | 1000 | 0 => 'check_number', |
c3fc2621 CW |
1001 | ], |
1002 | 'localizable' => FALSE, | |
e7a6b91a | 1003 | 'sig' => 'civicrm_contribution::0::check_number', |
c3fc2621 CW |
1004 | ], |
1005 | 'index_creditnote_id' => [ | |
e7a6b91a | 1006 | 'name' => 'index_creditnote_id', |
c3fc2621 | 1007 | 'field' => [ |
e7a6b91a | 1008 | 0 => 'creditnote_id', |
c3fc2621 CW |
1009 | ], |
1010 | 'localizable' => FALSE, | |
e7a6b91a | 1011 | 'sig' => 'civicrm_contribution::0::creditnote_id', |
c3fc2621 CW |
1012 | ], |
1013 | ]; | |
e7a6b91a AS |
1014 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
1015 | } | |
c3fc2621 | 1016 | |
e501603b | 1017 | } |