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