Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
ca5cec67 | 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Contribute/Contribution.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
dc396835 | 9 | * (GenCodeChecksum:a9f83aa612e82ee87ace74e75fe23466) |
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 | */ | |
fa45b5b9 | 22 | public 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 | */ |
fa45b5b9 | 29 | public static $_log = TRUE; |
c3fc2621 | 30 | |
e501603b TO |
31 | /** |
32 | * Contribution ID | |
33 | * | |
e6ca0a57 | 34 | * @var int |
e501603b TO |
35 | */ |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * FK to Contact ID | |
40 | * | |
e6ca0a57 | 41 | * @var int |
e501603b TO |
42 | */ |
43 | public $contact_id; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * FK to Financial Type for (total_amount - non_deductible_amount). | |
47 | * | |
e6ca0a57 | 48 | * @var int |
e501603b TO |
49 | */ |
50 | public $financial_type_id; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * The Contribution Page which triggered this contribution | |
54 | * | |
e6ca0a57 | 55 | * @var int |
e501603b TO |
56 | */ |
57 | public $contribution_page_id; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * FK to Payment Instrument | |
61 | * | |
e6ca0a57 | 62 | * @var int |
e501603b TO |
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 | * | |
e6ca0a57 | 170 | * @var int |
e501603b TO |
171 | */ |
172 | public $contribution_recur_id; | |
c3fc2621 | 173 | |
e501603b | 174 | /** |
e6ca0a57 | 175 | * @var bool |
e501603b TO |
176 | */ |
177 | public $is_test; | |
c3fc2621 | 178 | |
e501603b | 179 | /** |
e6ca0a57 | 180 | * @var bool |
e501603b TO |
181 | */ |
182 | public $is_pay_later; | |
c3fc2621 | 183 | |
e501603b | 184 | /** |
e6ca0a57 | 185 | * @var int |
e501603b TO |
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 | * | |
e6ca0a57 | 192 | * @var int |
e501603b TO |
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 | * | |
e6ca0a57 | 204 | * @var int |
e501603b TO |
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 | |
dc396835 AS |
229 | /** |
230 | * Shows this is a template for recurring contributions. | |
231 | * | |
232 | * @var bool | |
233 | */ | |
234 | public $is_template; | |
235 | ||
e501603b | 236 | /** |
f41f0342 | 237 | * Class constructor. |
e501603b | 238 | */ |
c3fc2621 | 239 | public function __construct() { |
e501603b TO |
240 | $this->__table = 'civicrm_contribution'; |
241 | parent::__construct(); | |
242 | } | |
c3fc2621 | 243 | |
e501603b | 244 | /** |
f41f0342 | 245 | * Returns foreign keys and entity references. |
e501603b TO |
246 | * |
247 | * @return array | |
248 | * [CRM_Core_Reference_Interface] | |
249 | */ | |
c3fc2621 | 250 | public static function getReferenceColumns() { |
346aaaba | 251 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 252 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
253 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); |
254 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); | |
255 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_page_id', 'civicrm_contribution_page', 'id'); | |
256 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_recur_id', 'civicrm_contribution_recur', 'id'); | |
257 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'address_id', 'civicrm_address', 'id'); | |
258 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id'); | |
346aaaba | 259 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 260 | } |
346aaaba | 261 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 262 | } |
c3fc2621 | 263 | |
e501603b TO |
264 | /** |
265 | * Returns all the column names of this table | |
266 | * | |
267 | * @return array | |
268 | */ | |
c3fc2621 | 269 | public static function &fields() { |
346aaaba | 270 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
271 | Civi::$statics[__CLASS__]['fields'] = [ |
272 | 'contribution_id' => [ | |
e501603b TO |
273 | 'name' => 'id', |
274 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 275 | 'title' => ts('Contribution ID'), |
215b423e | 276 | 'description' => ts('Contribution ID'), |
c3fc2621 CW |
277 | 'required' => TRUE, |
278 | 'import' => TRUE, | |
e501603b | 279 | 'where' => 'civicrm_contribution.id', |
c3fc2621 | 280 | 'export' => TRUE, |
522a26c9 | 281 | 'table_name' => 'civicrm_contribution', |
282 | 'entity' => 'Contribution', | |
283 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 284 | 'localizable' => 0, |
c3fc2621 CW |
285 | ], |
286 | 'contribution_contact_id' => [ | |
e501603b TO |
287 | 'name' => 'contact_id', |
288 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 289 | 'title' => ts('Contact ID'), |
215b423e | 290 | 'description' => ts('FK to Contact ID'), |
c3fc2621 CW |
291 | 'required' => TRUE, |
292 | 'import' => TRUE, | |
e501603b TO |
293 | 'where' => 'civicrm_contribution.contact_id', |
294 | 'headerPattern' => '/contact(.?id)?/i', | |
295 | 'dataPattern' => '/^\d+$/', | |
c3fc2621 | 296 | 'export' => TRUE, |
522a26c9 | 297 | 'table_name' => 'civicrm_contribution', |
298 | 'entity' => 'Contribution', | |
299 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 300 | 'localizable' => 0, |
e501603b | 301 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c3fc2621 | 302 | 'html' => [ |
e501603b | 303 | 'type' => 'EntityRef', |
c3fc2621 CW |
304 | ], |
305 | ], | |
306 | 'financial_type_id' => [ | |
e501603b TO |
307 | 'name' => 'financial_type_id', |
308 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 309 | 'title' => ts('Financial Type'), |
215b423e | 310 | 'description' => ts('FK to Financial Type for (total_amount - non_deductible_amount).'), |
e501603b | 311 | 'where' => 'civicrm_contribution.financial_type_id', |
a36434b9 | 312 | 'export' => TRUE, |
522a26c9 | 313 | 'table_name' => 'civicrm_contribution', |
314 | 'entity' => 'Contribution', | |
315 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 316 | 'localizable' => 0, |
e501603b | 317 | 'FKClassName' => 'CRM_Financial_DAO_FinancialType', |
c3fc2621 | 318 | 'html' => [ |
e501603b | 319 | 'type' => 'Select', |
c3fc2621 CW |
320 | ], |
321 | 'pseudoconstant' => [ | |
e501603b TO |
322 | 'table' => 'civicrm_financial_type', |
323 | 'keyColumn' => 'id', | |
324 | 'labelColumn' => 'name', | |
e6ca0a57 | 325 | ], |
c3fc2621 CW |
326 | ], |
327 | 'contribution_page_id' => [ | |
e501603b TO |
328 | 'name' => 'contribution_page_id', |
329 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 330 | 'title' => ts('Contribution Page ID'), |
215b423e | 331 | 'description' => ts('The Contribution Page which triggered this contribution'), |
c3fc2621 | 332 | 'import' => TRUE, |
e501603b | 333 | 'where' => 'civicrm_contribution.contribution_page_id', |
c3fc2621 | 334 | 'export' => TRUE, |
522a26c9 | 335 | 'table_name' => 'civicrm_contribution', |
336 | 'entity' => 'Contribution', | |
337 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 338 | 'localizable' => 0, |
e501603b | 339 | 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage', |
c3fc2621 | 340 | 'html' => [ |
e501603b | 341 | 'type' => 'Select', |
c3fc2621 CW |
342 | ], |
343 | 'pseudoconstant' => [ | |
e501603b TO |
344 | 'table' => 'civicrm_contribution_page', |
345 | 'keyColumn' => 'id', | |
346 | 'labelColumn' => 'title', | |
e6ca0a57 | 347 | ], |
c3fc2621 CW |
348 | ], |
349 | 'payment_instrument_id' => [ | |
e501603b TO |
350 | 'name' => 'payment_instrument_id', |
351 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 352 | 'title' => ts('Payment Method ID'), |
215b423e | 353 | 'description' => ts('FK to Payment Instrument'), |
9d5c7f14 | 354 | 'where' => 'civicrm_contribution.payment_instrument_id', |
355 | 'headerPattern' => '/^payment|(p(ayment\s)?instrument)$/i', | |
a36434b9 | 356 | 'export' => TRUE, |
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', | |
e6ca0a57 | 367 | ], |
c3fc2621 CW |
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 | 394 | 20, |
fb607354 | 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 | 418 | 20, |
fb607354 | 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 | 440 | 20, |
fb607354 | 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 | 462 | 20, |
fb607354 | 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', | |
c3fc2621 | 488 | 'export' => TRUE, |
522a26c9 | 489 | 'table_name' => 'civicrm_contribution', |
490 | 'entity' => 'Contribution', | |
491 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 492 | 'localizable' => 0, |
c3fc2621 | 493 | 'html' => [ |
e501603b | 494 | 'type' => 'Text', |
c3fc2621 CW |
495 | ], |
496 | ], | |
497 | 'invoice_id' => [ | |
e501603b TO |
498 | 'name' => 'invoice_id', |
499 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 500 | 'title' => ts('Invoice Reference'), |
215b423e | 501 | 'description' => ts('unique invoice id, system generated or passed in'), |
e501603b TO |
502 | 'maxlength' => 255, |
503 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 504 | 'import' => TRUE, |
e501603b TO |
505 | 'where' => 'civicrm_contribution.invoice_id', |
506 | 'headerPattern' => '/invoice(.?id)?/i', | |
c3fc2621 | 507 | 'export' => TRUE, |
522a26c9 | 508 | 'table_name' => 'civicrm_contribution', |
509 | 'entity' => 'Contribution', | |
510 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 511 | 'localizable' => 0, |
c3fc2621 | 512 | 'html' => [ |
e501603b | 513 | 'type' => 'Text', |
c3fc2621 CW |
514 | ], |
515 | ], | |
516 | 'invoice_number' => [ | |
9cad3ff4 CW |
517 | 'name' => 'invoice_number', |
518 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 519 | 'title' => ts('Invoice Number'), |
215b423e | 520 | 'description' => ts('Human readable invoice number'), |
9cad3ff4 CW |
521 | 'maxlength' => 255, |
522 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 523 | 'import' => TRUE, |
9cad3ff4 CW |
524 | 'where' => 'civicrm_contribution.invoice_number', |
525 | 'headerPattern' => '/invoice(.?number)?/i', | |
c3fc2621 | 526 | 'export' => TRUE, |
9cad3ff4 CW |
527 | 'table_name' => 'civicrm_contribution', |
528 | 'entity' => 'Contribution', | |
529 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
530 | 'localizable' => 0, | |
c3fc2621 | 531 | 'html' => [ |
9cad3ff4 | 532 | 'type' => 'Text', |
c3fc2621 CW |
533 | ], |
534 | ], | |
535 | 'currency' => [ | |
e501603b TO |
536 | 'name' => 'currency', |
537 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 538 | 'title' => ts('Currency'), |
215b423e | 539 | 'description' => ts('3 character string, value from config setting or input via user.'), |
e501603b TO |
540 | 'maxlength' => 3, |
541 | 'size' => CRM_Utils_Type::FOUR, | |
c3fc2621 | 542 | 'import' => TRUE, |
e501603b TO |
543 | 'where' => 'civicrm_contribution.currency', |
544 | 'headerPattern' => '/cur(rency)?/i', | |
545 | 'dataPattern' => '/^[A-Z]{3}$/i', | |
c3fc2621 | 546 | 'export' => TRUE, |
e501603b | 547 | 'default' => 'NULL', |
522a26c9 | 548 | 'table_name' => 'civicrm_contribution', |
549 | 'entity' => 'Contribution', | |
550 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 551 | 'localizable' => 0, |
c3fc2621 | 552 | 'html' => [ |
e501603b | 553 | 'type' => 'Select', |
c3fc2621 CW |
554 | ], |
555 | 'pseudoconstant' => [ | |
e501603b TO |
556 | 'table' => 'civicrm_currency', |
557 | 'keyColumn' => 'name', | |
558 | 'labelColumn' => 'full_name', | |
559 | 'nameColumn' => 'name', | |
a8fdb24e | 560 | 'abbrColumn' => 'symbol', |
e6ca0a57 | 561 | ], |
c3fc2621 | 562 | ], |
6e7cc0f5 | 563 | 'contribution_cancel_date' => [ |
e501603b TO |
564 | 'name' => 'cancel_date', |
565 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
6e7cc0f5 | 566 | 'title' => ts('Cancelled / Refunded Date'), |
215b423e | 567 | 'description' => ts('when was gift cancelled'), |
c3fc2621 | 568 | 'import' => TRUE, |
e501603b TO |
569 | 'where' => 'civicrm_contribution.cancel_date', |
570 | 'headerPattern' => '/cancel(.?date)?/i', | |
571 | 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', | |
c3fc2621 | 572 | 'export' => TRUE, |
522a26c9 | 573 | 'table_name' => 'civicrm_contribution', |
574 | 'entity' => 'Contribution', | |
575 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 576 | 'localizable' => 0, |
c3fc2621 | 577 | 'html' => [ |
e501603b | 578 | 'type' => 'Select Date', |
24317d89 | 579 | 'formatType' => 'activityDateTime', |
c3fc2621 CW |
580 | ], |
581 | ], | |
582 | 'cancel_reason' => [ | |
e501603b TO |
583 | 'name' => 'cancel_reason', |
584 | 'type' => CRM_Utils_Type::T_TEXT, | |
927898c5 | 585 | 'title' => ts('Cancellation / Refund Reason'), |
c3fc2621 | 586 | 'import' => TRUE, |
e501603b TO |
587 | 'where' => 'civicrm_contribution.cancel_reason', |
588 | 'headerPattern' => '/(cancel.?)?reason/i', | |
c3fc2621 | 589 | 'export' => TRUE, |
522a26c9 | 590 | 'table_name' => 'civicrm_contribution', |
591 | 'entity' => 'Contribution', | |
592 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 593 | 'localizable' => 0, |
c3fc2621 | 594 | 'html' => [ |
e501603b | 595 | 'type' => 'Text', |
c3fc2621 CW |
596 | ], |
597 | ], | |
598 | 'receipt_date' => [ | |
e501603b TO |
599 | 'name' => 'receipt_date', |
600 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 601 | 'title' => ts('Receipt Date'), |
215b423e | 602 | 'description' => ts('when (if) receipt was sent. populated automatically for online donations w/ automatic receipting'), |
c3fc2621 | 603 | 'import' => TRUE, |
e501603b TO |
604 | 'where' => 'civicrm_contribution.receipt_date', |
605 | 'headerPattern' => '/receipt(.?date)?/i', | |
606 | 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', | |
c3fc2621 | 607 | 'export' => TRUE, |
522a26c9 | 608 | 'table_name' => 'civicrm_contribution', |
609 | 'entity' => 'Contribution', | |
610 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 611 | 'localizable' => 0, |
c3fc2621 | 612 | 'html' => [ |
e501603b | 613 | 'type' => 'Select Date', |
24317d89 | 614 | 'formatType' => 'activityDateTime', |
c3fc2621 CW |
615 | ], |
616 | ], | |
617 | 'thankyou_date' => [ | |
e501603b TO |
618 | 'name' => 'thankyou_date', |
619 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 620 | 'title' => ts('Thank-you Date'), |
215b423e | 621 | 'description' => ts('when (if) was donor thanked'), |
c3fc2621 | 622 | 'import' => TRUE, |
e501603b TO |
623 | 'where' => 'civicrm_contribution.thankyou_date', |
624 | 'headerPattern' => '/thank(s|(.?you))?(.?date)?/i', | |
625 | 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', | |
c3fc2621 | 626 | 'export' => TRUE, |
522a26c9 | 627 | 'table_name' => 'civicrm_contribution', |
628 | 'entity' => 'Contribution', | |
629 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 630 | 'localizable' => 0, |
c3fc2621 | 631 | 'html' => [ |
e501603b | 632 | 'type' => 'Select Date', |
24317d89 | 633 | 'formatType' => 'activityDateTime', |
c3fc2621 CW |
634 | ], |
635 | ], | |
636 | 'contribution_source' => [ | |
e501603b TO |
637 | 'name' => 'source', |
638 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 639 | 'title' => ts('Contribution Source'), |
215b423e | 640 | 'description' => ts('Origin of this Contribution.'), |
e501603b TO |
641 | 'maxlength' => 255, |
642 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 643 | 'import' => TRUE, |
e501603b TO |
644 | 'where' => 'civicrm_contribution.source', |
645 | 'headerPattern' => '/source/i', | |
c3fc2621 | 646 | 'export' => TRUE, |
522a26c9 | 647 | 'table_name' => 'civicrm_contribution', |
648 | 'entity' => 'Contribution', | |
649 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 650 | 'localizable' => 0, |
c3fc2621 | 651 | 'html' => [ |
e501603b | 652 | 'type' => 'Text', |
c3fc2621 CW |
653 | ], |
654 | ], | |
655 | 'amount_level' => [ | |
e501603b TO |
656 | 'name' => 'amount_level', |
657 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 CW |
658 | 'title' => ts('Amount Label'), |
659 | 'import' => TRUE, | |
e501603b | 660 | 'where' => 'civicrm_contribution.amount_level', |
c3fc2621 | 661 | 'export' => TRUE, |
522a26c9 | 662 | 'table_name' => 'civicrm_contribution', |
663 | 'entity' => 'Contribution', | |
664 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 665 | 'localizable' => 0, |
c3fc2621 | 666 | 'html' => [ |
e501603b | 667 | 'type' => 'Text', |
c3fc2621 CW |
668 | ], |
669 | ], | |
670 | 'contribution_recur_id' => [ | |
e501603b TO |
671 | 'name' => 'contribution_recur_id', |
672 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 673 | 'title' => ts('Recurring Contribution ID'), |
215b423e | 674 | '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.'), |
3123273f | 675 | 'where' => 'civicrm_contribution.contribution_recur_id', |
a36434b9 | 676 | 'export' => TRUE, |
522a26c9 | 677 | 'table_name' => 'civicrm_contribution', |
678 | 'entity' => 'Contribution', | |
679 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 680 | 'localizable' => 0, |
e501603b | 681 | 'FKClassName' => 'CRM_Contribute_DAO_ContributionRecur', |
c3fc2621 CW |
682 | ], |
683 | 'is_test' => [ | |
e501603b TO |
684 | 'name' => 'is_test', |
685 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 CW |
686 | 'title' => ts('Test'), |
687 | 'import' => TRUE, | |
e501603b | 688 | 'where' => 'civicrm_contribution.is_test', |
c3fc2621 | 689 | 'export' => TRUE, |
45a83e42 | 690 | 'default' => '0', |
522a26c9 | 691 | 'table_name' => 'civicrm_contribution', |
692 | 'entity' => 'Contribution', | |
693 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 694 | 'localizable' => 0, |
c3fc2621 | 695 | 'html' => [ |
e501603b | 696 | 'type' => 'CheckBox', |
c3fc2621 CW |
697 | ], |
698 | ], | |
699 | 'is_pay_later' => [ | |
e501603b TO |
700 | 'name' => 'is_pay_later', |
701 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 CW |
702 | 'title' => ts('Is Pay Later'), |
703 | 'import' => TRUE, | |
e501603b | 704 | 'where' => 'civicrm_contribution.is_pay_later', |
c3fc2621 | 705 | 'export' => TRUE, |
45a83e42 | 706 | 'default' => '0', |
522a26c9 | 707 | 'table_name' => 'civicrm_contribution', |
708 | 'entity' => 'Contribution', | |
709 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 710 | 'localizable' => 0, |
c3fc2621 | 711 | 'html' => [ |
e501603b | 712 | 'type' => 'CheckBox', |
c3fc2621 CW |
713 | ], |
714 | ], | |
715 | 'contribution_status_id' => [ | |
e501603b TO |
716 | 'name' => 'contribution_status_id', |
717 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
718 | 'title' => ts('Contribution Status ID'), |
719 | 'import' => TRUE, | |
e501603b TO |
720 | 'where' => 'civicrm_contribution.contribution_status_id', |
721 | 'headerPattern' => '/status/i', | |
c3fc2621 | 722 | 'export' => TRUE, |
e501603b | 723 | 'default' => '1', |
522a26c9 | 724 | 'table_name' => 'civicrm_contribution', |
725 | 'entity' => 'Contribution', | |
726 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 727 | 'localizable' => 0, |
c3fc2621 | 728 | 'html' => [ |
e501603b | 729 | 'type' => 'Select', |
c3fc2621 CW |
730 | ], |
731 | 'pseudoconstant' => [ | |
e501603b TO |
732 | 'optionGroupName' => 'contribution_status', |
733 | 'optionEditPath' => 'civicrm/admin/options/contribution_status', | |
e6ca0a57 | 734 | ], |
c3fc2621 CW |
735 | ], |
736 | 'contribution_address_id' => [ | |
e501603b TO |
737 | 'name' => 'address_id', |
738 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 739 | 'title' => ts('Contribution Address'), |
215b423e | 740 | '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.'), |
3123273f | 741 | 'where' => 'civicrm_contribution.address_id', |
a36434b9 | 742 | 'export' => TRUE, |
522a26c9 | 743 | 'table_name' => 'civicrm_contribution', |
744 | 'entity' => 'Contribution', | |
745 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 746 | 'localizable' => 0, |
e501603b | 747 | 'FKClassName' => 'CRM_Core_DAO_Address', |
c3fc2621 CW |
748 | ], |
749 | 'contribution_check_number' => [ | |
e501603b TO |
750 | 'name' => 'check_number', |
751 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 752 | 'title' => ts('Check Number'), |
e501603b TO |
753 | 'maxlength' => 255, |
754 | 'size' => 6, | |
c3fc2621 | 755 | 'import' => TRUE, |
e501603b TO |
756 | 'where' => 'civicrm_contribution.check_number', |
757 | 'headerPattern' => '/check(.?number)?/i', | |
c3fc2621 | 758 | 'export' => TRUE, |
522a26c9 | 759 | 'table_name' => 'civicrm_contribution', |
760 | 'entity' => 'Contribution', | |
761 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 762 | 'localizable' => 0, |
c3fc2621 | 763 | 'html' => [ |
e501603b | 764 | 'type' => 'Text', |
c3fc2621 CW |
765 | ], |
766 | ], | |
767 | 'contribution_campaign_id' => [ | |
e501603b TO |
768 | 'name' => 'campaign_id', |
769 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 770 | 'title' => ts('Campaign'), |
215b423e | 771 | 'description' => ts('The campaign for which this contribution has been triggered.'), |
c3fc2621 | 772 | 'import' => TRUE, |
e501603b | 773 | 'where' => 'civicrm_contribution.campaign_id', |
c3fc2621 | 774 | 'export' => TRUE, |
522a26c9 | 775 | 'table_name' => 'civicrm_contribution', |
776 | 'entity' => 'Contribution', | |
777 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 778 | 'localizable' => 0, |
e501603b | 779 | 'FKClassName' => 'CRM_Campaign_DAO_Campaign', |
c3fc2621 | 780 | 'html' => [ |
e501603b | 781 | 'type' => 'Select', |
c3fc2621 CW |
782 | ], |
783 | 'pseudoconstant' => [ | |
e501603b TO |
784 | 'table' => 'civicrm_campaign', |
785 | 'keyColumn' => 'id', | |
786 | 'labelColumn' => 'title', | |
e6ca0a57 | 787 | ], |
c3fc2621 CW |
788 | ], |
789 | 'creditnote_id' => [ | |
e501603b TO |
790 | 'name' => 'creditnote_id', |
791 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 792 | 'title' => ts('Credit Note ID'), |
215b423e | 793 | 'description' => ts('unique credit note id, system generated or passed in'), |
e501603b TO |
794 | 'maxlength' => 255, |
795 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 796 | 'import' => TRUE, |
e501603b TO |
797 | 'where' => 'civicrm_contribution.creditnote_id', |
798 | 'headerPattern' => '/creditnote(.?id)?/i', | |
c3fc2621 | 799 | 'export' => TRUE, |
522a26c9 | 800 | 'table_name' => 'civicrm_contribution', |
801 | 'entity' => 'Contribution', | |
802 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 803 | 'localizable' => 0, |
c3fc2621 | 804 | 'html' => [ |
e501603b | 805 | 'type' => 'Text', |
c3fc2621 CW |
806 | ], |
807 | ], | |
808 | 'tax_amount' => [ | |
e501603b TO |
809 | 'name' => 'tax_amount', |
810 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 811 | 'title' => ts('Tax Amount'), |
215b423e | 812 | 'description' => ts('Total tax amount of this contribution.'), |
c3fc2621 | 813 | 'precision' => [ |
e501603b | 814 | 20, |
fb607354 | 815 | 2, |
c3fc2621 CW |
816 | ], |
817 | 'import' => TRUE, | |
e501603b TO |
818 | 'where' => 'civicrm_contribution.tax_amount', |
819 | 'headerPattern' => '/tax(.?am(ou)?nt)?/i', | |
820 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
c3fc2621 | 821 | 'export' => TRUE, |
522a26c9 | 822 | 'table_name' => 'civicrm_contribution', |
823 | 'entity' => 'Contribution', | |
824 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 825 | 'localizable' => 0, |
c3fc2621 | 826 | 'html' => [ |
e501603b | 827 | 'type' => 'Text', |
c3fc2621 CW |
828 | ], |
829 | ], | |
830 | 'revenue_recognition_date' => [ | |
e501603b TO |
831 | 'name' => 'revenue_recognition_date', |
832 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 833 | 'title' => ts('Revenue Recognition Date'), |
215b423e | 834 | 'description' => ts('Stores the date when revenue should be recognized.'), |
c3fc2621 | 835 | 'import' => TRUE, |
e501603b TO |
836 | 'where' => 'civicrm_contribution.revenue_recognition_date', |
837 | 'headerPattern' => '/revenue(.?date)?/i', | |
838 | 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', | |
c3fc2621 | 839 | 'export' => TRUE, |
522a26c9 | 840 | 'table_name' => 'civicrm_contribution', |
841 | 'entity' => 'Contribution', | |
842 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 843 | 'localizable' => 0, |
c3fc2621 | 844 | 'html' => [ |
e501603b | 845 | 'type' => 'Select Date', |
24317d89 | 846 | 'formatType' => 'activityDateTime', |
c3fc2621 CW |
847 | ], |
848 | ], | |
dc396835 AS |
849 | 'is_template' => [ |
850 | 'name' => 'is_template', | |
851 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
852 | 'title' => ts('Is a Template Contribution'), | |
853 | 'description' => ts('Shows this is a template for recurring contributions.'), | |
854 | 'import' => TRUE, | |
855 | 'where' => 'civicrm_contribution.is_template', | |
856 | 'export' => TRUE, | |
857 | 'default' => '0', | |
858 | 'table_name' => 'civicrm_contribution', | |
859 | 'entity' => 'Contribution', | |
860 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
861 | 'localizable' => 0, | |
862 | 'html' => [ | |
863 | 'type' => 'CheckBox', | |
864 | ], | |
865 | ], | |
c3fc2621 | 866 | ]; |
346aaaba | 867 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 868 | } |
346aaaba | 869 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 870 | } |
c3fc2621 | 871 | |
e501603b | 872 | /** |
bd8e0b14 | 873 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
874 | * |
875 | * @return array | |
bd8e0b14 | 876 | * Array(string $name => string $uniqueName). |
e501603b | 877 | */ |
c3fc2621 | 878 | public static function &fieldKeys() { |
bd8e0b14 TO |
879 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
880 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 881 | } |
bd8e0b14 | 882 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 883 | } |
c3fc2621 | 884 | |
e501603b TO |
885 | /** |
886 | * Returns the names of this table | |
887 | * | |
888 | * @return string | |
889 | */ | |
c3fc2621 | 890 | public static function getTableName() { |
e501603b TO |
891 | return self::$_tableName; |
892 | } | |
c3fc2621 | 893 | |
e501603b TO |
894 | /** |
895 | * Returns if this table needs to be logged | |
896 | * | |
c3fc2621 | 897 | * @return bool |
e501603b | 898 | */ |
c3fc2621 | 899 | public function getLog() { |
e501603b TO |
900 | return self::$_log; |
901 | } | |
c3fc2621 | 902 | |
e501603b TO |
903 | /** |
904 | * Returns the list of fields that can be imported | |
905 | * | |
906 | * @param bool $prefix | |
907 | * | |
908 | * @return array | |
909 | */ | |
c3fc2621 CW |
910 | public static function &import($prefix = FALSE) { |
911 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution', $prefix, []); | |
60808919 | 912 | return $r; |
e501603b | 913 | } |
c3fc2621 | 914 | |
e501603b TO |
915 | /** |
916 | * Returns the list of fields that can be exported | |
917 | * | |
918 | * @param bool $prefix | |
919 | * | |
920 | * @return array | |
921 | */ | |
c3fc2621 CW |
922 | public static function &export($prefix = FALSE) { |
923 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution', $prefix, []); | |
60808919 | 924 | return $r; |
e501603b | 925 | } |
c3fc2621 | 926 | |
e7a6b91a AS |
927 | /** |
928 | * Returns the list of indices | |
c3fc2621 CW |
929 | * |
930 | * @param bool $localize | |
931 | * | |
932 | * @return array | |
e7a6b91a AS |
933 | */ |
934 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
935 | $indices = [ |
936 | 'UI_contrib_payment_instrument_id' => [ | |
e7a6b91a | 937 | 'name' => 'UI_contrib_payment_instrument_id', |
c3fc2621 | 938 | 'field' => [ |
e7a6b91a | 939 | 0 => 'payment_instrument_id', |
c3fc2621 CW |
940 | ], |
941 | 'localizable' => FALSE, | |
e7a6b91a | 942 | 'sig' => 'civicrm_contribution::0::payment_instrument_id', |
c3fc2621 CW |
943 | ], |
944 | 'index_total_amount_receive_date' => [ | |
e7a6b91a | 945 | 'name' => 'index_total_amount_receive_date', |
c3fc2621 | 946 | 'field' => [ |
e7a6b91a AS |
947 | 0 => 'total_amount', |
948 | 1 => 'receive_date', | |
c3fc2621 CW |
949 | ], |
950 | 'localizable' => FALSE, | |
e7a6b91a | 951 | 'sig' => 'civicrm_contribution::0::total_amount::receive_date', |
c3fc2621 CW |
952 | ], |
953 | 'index_source' => [ | |
e7a6b91a | 954 | 'name' => 'index_source', |
c3fc2621 | 955 | 'field' => [ |
e7a6b91a | 956 | 0 => 'source', |
c3fc2621 CW |
957 | ], |
958 | 'localizable' => FALSE, | |
e7a6b91a | 959 | 'sig' => 'civicrm_contribution::0::source', |
c3fc2621 CW |
960 | ], |
961 | 'UI_contrib_trxn_id' => [ | |
e7a6b91a | 962 | 'name' => 'UI_contrib_trxn_id', |
c3fc2621 | 963 | 'field' => [ |
e7a6b91a | 964 | 0 => 'trxn_id', |
c3fc2621 CW |
965 | ], |
966 | 'localizable' => FALSE, | |
967 | 'unique' => TRUE, | |
e7a6b91a | 968 | 'sig' => 'civicrm_contribution::1::trxn_id', |
c3fc2621 CW |
969 | ], |
970 | 'UI_contrib_invoice_id' => [ | |
e7a6b91a | 971 | 'name' => 'UI_contrib_invoice_id', |
c3fc2621 | 972 | 'field' => [ |
e7a6b91a | 973 | 0 => 'invoice_id', |
c3fc2621 CW |
974 | ], |
975 | 'localizable' => FALSE, | |
976 | 'unique' => TRUE, | |
e7a6b91a | 977 | 'sig' => 'civicrm_contribution::1::invoice_id', |
c3fc2621 CW |
978 | ], |
979 | 'index_contribution_status' => [ | |
e7a6b91a | 980 | 'name' => 'index_contribution_status', |
c3fc2621 | 981 | 'field' => [ |
e7a6b91a | 982 | 0 => 'contribution_status_id', |
c3fc2621 CW |
983 | ], |
984 | 'localizable' => FALSE, | |
e7a6b91a | 985 | 'sig' => 'civicrm_contribution::0::contribution_status_id', |
c3fc2621 CW |
986 | ], |
987 | 'received_date' => [ | |
e7a6b91a | 988 | 'name' => 'received_date', |
c3fc2621 | 989 | 'field' => [ |
e7a6b91a | 990 | 0 => 'receive_date', |
c3fc2621 CW |
991 | ], |
992 | 'localizable' => FALSE, | |
e7a6b91a | 993 | 'sig' => 'civicrm_contribution::0::receive_date', |
c3fc2621 CW |
994 | ], |
995 | 'check_number' => [ | |
e7a6b91a | 996 | 'name' => 'check_number', |
c3fc2621 | 997 | 'field' => [ |
e7a6b91a | 998 | 0 => 'check_number', |
c3fc2621 CW |
999 | ], |
1000 | 'localizable' => FALSE, | |
e7a6b91a | 1001 | 'sig' => 'civicrm_contribution::0::check_number', |
c3fc2621 CW |
1002 | ], |
1003 | 'index_creditnote_id' => [ | |
e7a6b91a | 1004 | 'name' => 'index_creditnote_id', |
c3fc2621 | 1005 | 'field' => [ |
e7a6b91a | 1006 | 0 => 'creditnote_id', |
c3fc2621 CW |
1007 | ], |
1008 | 'localizable' => FALSE, | |
e7a6b91a | 1009 | 'sig' => 'civicrm_contribution::0::creditnote_id', |
c3fc2621 CW |
1010 | ], |
1011 | ]; | |
e7a6b91a AS |
1012 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
1013 | } | |
c3fc2621 | 1014 | |
e501603b | 1015 | } |