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 | |
2562d09a | 9 | * (GenCodeChecksum:59912e3825f18a5769be0e5be1ca01ff) |
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 | ||
2562d09a CW |
276 | /** |
277 | * Returns user-friendly description of this entity. | |
278 | * | |
279 | * @return string | |
280 | */ | |
281 | public static function getEntityDescription() { | |
282 | return ts('Financial records consisting of transactions, line-items, etc.'); | |
283 | } | |
284 | ||
e501603b | 285 | /** |
f41f0342 | 286 | * Returns foreign keys and entity references. |
e501603b TO |
287 | * |
288 | * @return array | |
289 | * [CRM_Core_Reference_Interface] | |
290 | */ | |
c3fc2621 | 291 | public static function getReferenceColumns() { |
346aaaba | 292 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 293 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
294 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); |
295 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); | |
296 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_page_id', 'civicrm_contribution_page', 'id'); | |
297 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_recur_id', 'civicrm_contribution_recur', 'id'); | |
298 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'address_id', 'civicrm_address', 'id'); | |
299 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id'); | |
346aaaba | 300 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 301 | } |
346aaaba | 302 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 303 | } |
c3fc2621 | 304 | |
e501603b TO |
305 | /** |
306 | * Returns all the column names of this table | |
307 | * | |
308 | * @return array | |
309 | */ | |
c3fc2621 | 310 | public static function &fields() { |
346aaaba | 311 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
312 | Civi::$statics[__CLASS__]['fields'] = [ |
313 | 'contribution_id' => [ | |
e501603b TO |
314 | 'name' => 'id', |
315 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 316 | 'title' => ts('Contribution ID'), |
215b423e | 317 | 'description' => ts('Contribution ID'), |
c3fc2621 CW |
318 | 'required' => TRUE, |
319 | 'import' => TRUE, | |
e501603b | 320 | 'where' => 'civicrm_contribution.id', |
c3fc2621 | 321 | 'export' => TRUE, |
522a26c9 | 322 | 'table_name' => 'civicrm_contribution', |
323 | 'entity' => 'Contribution', | |
324 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 325 | 'localizable' => 0, |
8cc7686b | 326 | 'html' => [ |
2cbbebe8 | 327 | 'type' => 'Number', |
8cc7686b | 328 | ], |
1fe423d6 | 329 | 'readonly' => TRUE, |
a9d0587b | 330 | 'add' => '1.3', |
c3fc2621 CW |
331 | ], |
332 | 'contribution_contact_id' => [ | |
e501603b TO |
333 | 'name' => 'contact_id', |
334 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 335 | 'title' => ts('Contact ID'), |
215b423e | 336 | 'description' => ts('FK to Contact ID'), |
c3fc2621 CW |
337 | 'required' => TRUE, |
338 | 'import' => TRUE, | |
e501603b TO |
339 | 'where' => 'civicrm_contribution.contact_id', |
340 | 'headerPattern' => '/contact(.?id)?/i', | |
341 | 'dataPattern' => '/^\d+$/', | |
c3fc2621 | 342 | 'export' => TRUE, |
522a26c9 | 343 | 'table_name' => 'civicrm_contribution', |
344 | 'entity' => 'Contribution', | |
345 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 346 | 'localizable' => 0, |
e501603b | 347 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c3fc2621 | 348 | 'html' => [ |
e501603b | 349 | 'type' => 'EntityRef', |
2cbbebe8 | 350 | 'label' => ts("Contact"), |
c3fc2621 | 351 | ], |
a9d0587b | 352 | 'add' => '1.3', |
c3fc2621 CW |
353 | ], |
354 | 'financial_type_id' => [ | |
e501603b TO |
355 | 'name' => 'financial_type_id', |
356 | 'type' => CRM_Utils_Type::T_INT, | |
a1d226d6 | 357 | 'title' => ts('Financial Type ID'), |
215b423e | 358 | 'description' => ts('FK to Financial Type for (total_amount - non_deductible_amount).'), |
e501603b | 359 | 'where' => 'civicrm_contribution.financial_type_id', |
a36434b9 | 360 | 'export' => TRUE, |
522a26c9 | 361 | 'table_name' => 'civicrm_contribution', |
362 | 'entity' => 'Contribution', | |
363 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 364 | 'localizable' => 0, |
e501603b | 365 | 'FKClassName' => 'CRM_Financial_DAO_FinancialType', |
c3fc2621 | 366 | 'html' => [ |
e501603b | 367 | 'type' => 'Select', |
a1d226d6 | 368 | 'label' => ts("Financial Type"), |
c3fc2621 CW |
369 | ], |
370 | 'pseudoconstant' => [ | |
e501603b TO |
371 | 'table' => 'civicrm_financial_type', |
372 | 'keyColumn' => 'id', | |
373 | 'labelColumn' => 'name', | |
e6ca0a57 | 374 | ], |
a9d0587b | 375 | 'add' => '4.3', |
c3fc2621 CW |
376 | ], |
377 | 'contribution_page_id' => [ | |
e501603b TO |
378 | 'name' => 'contribution_page_id', |
379 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 380 | 'title' => ts('Contribution Page ID'), |
215b423e | 381 | 'description' => ts('The Contribution Page which triggered this contribution'), |
c3fc2621 | 382 | 'import' => TRUE, |
e501603b | 383 | 'where' => 'civicrm_contribution.contribution_page_id', |
c3fc2621 | 384 | 'export' => TRUE, |
522a26c9 | 385 | 'table_name' => 'civicrm_contribution', |
386 | 'entity' => 'Contribution', | |
387 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 388 | 'localizable' => 0, |
e501603b | 389 | 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage', |
c3fc2621 | 390 | 'html' => [ |
e501603b | 391 | 'type' => 'Select', |
cff5e6b9 | 392 | 'label' => ts("Contribution Page"), |
c3fc2621 CW |
393 | ], |
394 | 'pseudoconstant' => [ | |
e501603b TO |
395 | 'table' => 'civicrm_contribution_page', |
396 | 'keyColumn' => 'id', | |
397 | 'labelColumn' => 'title', | |
e6ca0a57 | 398 | ], |
a9d0587b | 399 | 'add' => '1.5', |
c3fc2621 CW |
400 | ], |
401 | 'payment_instrument_id' => [ | |
e501603b TO |
402 | 'name' => 'payment_instrument_id', |
403 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 404 | 'title' => ts('Payment Method ID'), |
215b423e | 405 | 'description' => ts('FK to Payment Instrument'), |
9d5c7f14 | 406 | 'where' => 'civicrm_contribution.payment_instrument_id', |
407 | 'headerPattern' => '/^payment|(p(ayment\s)?instrument)$/i', | |
a36434b9 | 408 | 'export' => TRUE, |
522a26c9 | 409 | 'table_name' => 'civicrm_contribution', |
410 | 'entity' => 'Contribution', | |
411 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 412 | 'localizable' => 0, |
c3fc2621 | 413 | 'html' => [ |
e501603b | 414 | 'type' => 'Select', |
c3fc2621 CW |
415 | ], |
416 | 'pseudoconstant' => [ | |
e501603b TO |
417 | 'optionGroupName' => 'payment_instrument', |
418 | 'optionEditPath' => 'civicrm/admin/options/payment_instrument', | |
e6ca0a57 | 419 | ], |
a9d0587b | 420 | 'add' => '1.3', |
c3fc2621 CW |
421 | ], |
422 | 'receive_date' => [ | |
e501603b TO |
423 | 'name' => 'receive_date', |
424 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 425 | 'title' => ts('Date Received'), |
215b423e | 426 | 'description' => ts('Date contribution was received - not necessarily the creation date of the record'), |
c3fc2621 | 427 | 'import' => TRUE, |
e501603b TO |
428 | 'where' => 'civicrm_contribution.receive_date', |
429 | 'headerPattern' => '/receive(.?date)?/i', | |
430 | 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', | |
c3fc2621 | 431 | 'export' => TRUE, |
522a26c9 | 432 | 'table_name' => 'civicrm_contribution', |
433 | 'entity' => 'Contribution', | |
434 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 435 | 'localizable' => 0, |
c3fc2621 | 436 | 'html' => [ |
e501603b | 437 | 'type' => 'Select Date', |
24317d89 | 438 | 'formatType' => 'activityDateTime', |
c3fc2621 | 439 | ], |
a9d0587b | 440 | 'add' => '1.3', |
c3fc2621 CW |
441 | ], |
442 | 'non_deductible_amount' => [ | |
e501603b TO |
443 | 'name' => 'non_deductible_amount', |
444 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 445 | 'title' => ts('Non-deductible Amount'), |
215b423e | 446 | 'description' => ts('Portion of total amount which is NOT tax deductible. Equal to total_amount for non-deductible financial types.'), |
c3fc2621 | 447 | 'precision' => [ |
e501603b | 448 | 20, |
fb607354 | 449 | 2, |
c3fc2621 CW |
450 | ], |
451 | 'import' => TRUE, | |
e501603b TO |
452 | 'where' => 'civicrm_contribution.non_deductible_amount', |
453 | 'headerPattern' => '/non?.?deduct/i', | |
454 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
c3fc2621 | 455 | 'export' => TRUE, |
45a83e42 | 456 | 'default' => '0', |
522a26c9 | 457 | 'table_name' => 'civicrm_contribution', |
458 | 'entity' => 'Contribution', | |
459 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 460 | 'localizable' => 0, |
c3fc2621 | 461 | 'html' => [ |
e501603b | 462 | 'type' => 'Text', |
c3fc2621 | 463 | ], |
a9d0587b | 464 | 'add' => '1.3', |
c3fc2621 CW |
465 | ], |
466 | 'total_amount' => [ | |
e501603b TO |
467 | 'name' => 'total_amount', |
468 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 469 | 'title' => ts('Total Amount'), |
215b423e | 470 | 'description' => ts('Total amount of this contribution. Use market value for non-monetary gifts.'), |
c3fc2621 CW |
471 | 'required' => TRUE, |
472 | 'precision' => [ | |
e501603b | 473 | 20, |
fb607354 | 474 | 2, |
c3fc2621 CW |
475 | ], |
476 | 'import' => TRUE, | |
e501603b TO |
477 | 'where' => 'civicrm_contribution.total_amount', |
478 | 'headerPattern' => '/^total|(.?^am(ou)?nt)/i', | |
479 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
c3fc2621 | 480 | 'export' => TRUE, |
522a26c9 | 481 | 'table_name' => 'civicrm_contribution', |
482 | 'entity' => 'Contribution', | |
483 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 484 | 'localizable' => 0, |
c3fc2621 | 485 | 'html' => [ |
e501603b | 486 | 'type' => 'Text', |
c23563e3 | 487 | 'label' => ts("Total Amount"), |
c3fc2621 | 488 | ], |
a9d0587b | 489 | 'add' => '1.3', |
c3fc2621 CW |
490 | ], |
491 | 'fee_amount' => [ | |
e501603b TO |
492 | 'name' => 'fee_amount', |
493 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 494 | 'title' => ts('Fee Amount'), |
215b423e | 495 | 'description' => ts('actual processor fee if known - may be 0.'), |
c3fc2621 | 496 | 'precision' => [ |
e501603b | 497 | 20, |
fb607354 | 498 | 2, |
c3fc2621 CW |
499 | ], |
500 | 'import' => TRUE, | |
e501603b TO |
501 | 'where' => 'civicrm_contribution.fee_amount', |
502 | 'headerPattern' => '/fee(.?am(ou)?nt)?/i', | |
503 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
c3fc2621 | 504 | 'export' => TRUE, |
522a26c9 | 505 | 'table_name' => 'civicrm_contribution', |
506 | 'entity' => 'Contribution', | |
507 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 508 | 'localizable' => 0, |
c3fc2621 | 509 | 'html' => [ |
e501603b | 510 | 'type' => 'Text', |
c23563e3 | 511 | 'label' => ts("Fee Amount"), |
c3fc2621 | 512 | ], |
a9d0587b | 513 | 'add' => '1.3', |
c3fc2621 CW |
514 | ], |
515 | 'net_amount' => [ | |
e501603b TO |
516 | 'name' => 'net_amount', |
517 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 518 | 'title' => ts('Net Amount'), |
215b423e | 519 | '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 | 520 | 'precision' => [ |
e501603b | 521 | 20, |
fb607354 | 522 | 2, |
c3fc2621 CW |
523 | ], |
524 | 'import' => TRUE, | |
e501603b TO |
525 | 'where' => 'civicrm_contribution.net_amount', |
526 | 'headerPattern' => '/net(.?am(ou)?nt)?/i', | |
527 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
c3fc2621 | 528 | 'export' => TRUE, |
522a26c9 | 529 | 'table_name' => 'civicrm_contribution', |
530 | 'entity' => 'Contribution', | |
531 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 532 | 'localizable' => 0, |
c3fc2621 | 533 | 'html' => [ |
e501603b | 534 | 'type' => 'Text', |
c23563e3 | 535 | 'label' => ts("Net Amount"), |
c3fc2621 | 536 | ], |
a9d0587b | 537 | 'add' => '1.3', |
c3fc2621 CW |
538 | ], |
539 | 'trxn_id' => [ | |
e501603b TO |
540 | 'name' => 'trxn_id', |
541 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 542 | 'title' => ts('Transaction ID'), |
215b423e | 543 | 'description' => ts('unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method'), |
e501603b TO |
544 | 'maxlength' => 255, |
545 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 546 | 'import' => TRUE, |
e501603b TO |
547 | 'where' => 'civicrm_contribution.trxn_id', |
548 | 'headerPattern' => '/tr(ansactio|x)n(.?id)?/i', | |
c3fc2621 | 549 | 'export' => TRUE, |
522a26c9 | 550 | 'table_name' => 'civicrm_contribution', |
551 | 'entity' => 'Contribution', | |
552 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 553 | 'localizable' => 0, |
c3fc2621 | 554 | 'html' => [ |
e501603b | 555 | 'type' => 'Text', |
c3fc2621 | 556 | ], |
58b0bf5a | 557 | 'readonly' => TRUE, |
a9d0587b | 558 | 'add' => '1.3', |
c3fc2621 CW |
559 | ], |
560 | 'invoice_id' => [ | |
e501603b TO |
561 | 'name' => 'invoice_id', |
562 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 563 | 'title' => ts('Invoice Reference'), |
215b423e | 564 | 'description' => ts('unique invoice id, system generated or passed in'), |
e501603b TO |
565 | 'maxlength' => 255, |
566 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 567 | 'import' => TRUE, |
e501603b TO |
568 | 'where' => 'civicrm_contribution.invoice_id', |
569 | 'headerPattern' => '/invoice(.?id)?/i', | |
c3fc2621 | 570 | 'export' => TRUE, |
522a26c9 | 571 | 'table_name' => 'civicrm_contribution', |
572 | 'entity' => 'Contribution', | |
573 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 574 | 'localizable' => 0, |
c3fc2621 | 575 | 'html' => [ |
e501603b | 576 | 'type' => 'Text', |
c3fc2621 | 577 | ], |
58b0bf5a | 578 | 'readonly' => TRUE, |
a9d0587b | 579 | 'add' => '1.3', |
c3fc2621 CW |
580 | ], |
581 | 'invoice_number' => [ | |
9cad3ff4 CW |
582 | 'name' => 'invoice_number', |
583 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 584 | 'title' => ts('Invoice Number'), |
215b423e | 585 | 'description' => ts('Human readable invoice number'), |
9cad3ff4 CW |
586 | 'maxlength' => 255, |
587 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 588 | 'import' => TRUE, |
9cad3ff4 CW |
589 | 'where' => 'civicrm_contribution.invoice_number', |
590 | 'headerPattern' => '/invoice(.?number)?/i', | |
c3fc2621 | 591 | 'export' => TRUE, |
9cad3ff4 CW |
592 | 'table_name' => 'civicrm_contribution', |
593 | 'entity' => 'Contribution', | |
594 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
595 | 'localizable' => 0, | |
c3fc2621 | 596 | 'html' => [ |
9cad3ff4 | 597 | 'type' => 'Text', |
c3fc2621 | 598 | ], |
a9d0587b | 599 | 'add' => '4.7', |
c3fc2621 CW |
600 | ], |
601 | 'currency' => [ | |
e501603b TO |
602 | 'name' => 'currency', |
603 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 604 | 'title' => ts('Currency'), |
215b423e | 605 | 'description' => ts('3 character string, value from config setting or input via user.'), |
e501603b TO |
606 | 'maxlength' => 3, |
607 | 'size' => CRM_Utils_Type::FOUR, | |
c3fc2621 | 608 | 'import' => TRUE, |
e501603b TO |
609 | 'where' => 'civicrm_contribution.currency', |
610 | 'headerPattern' => '/cur(rency)?/i', | |
611 | 'dataPattern' => '/^[A-Z]{3}$/i', | |
c3fc2621 | 612 | 'export' => TRUE, |
e501603b | 613 | 'default' => 'NULL', |
522a26c9 | 614 | 'table_name' => 'civicrm_contribution', |
615 | 'entity' => 'Contribution', | |
616 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 617 | 'localizable' => 0, |
c3fc2621 | 618 | 'html' => [ |
e501603b | 619 | 'type' => 'Select', |
c23563e3 | 620 | 'label' => ts("Currency"), |
c3fc2621 CW |
621 | ], |
622 | 'pseudoconstant' => [ | |
e501603b TO |
623 | 'table' => 'civicrm_currency', |
624 | 'keyColumn' => 'name', | |
625 | 'labelColumn' => 'full_name', | |
626 | 'nameColumn' => 'name', | |
a8fdb24e | 627 | 'abbrColumn' => 'symbol', |
e6ca0a57 | 628 | ], |
a9d0587b | 629 | 'add' => '1.3', |
c3fc2621 | 630 | ], |
6e7cc0f5 | 631 | 'contribution_cancel_date' => [ |
e501603b TO |
632 | 'name' => 'cancel_date', |
633 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
6e7cc0f5 | 634 | 'title' => ts('Cancelled / Refunded Date'), |
215b423e | 635 | 'description' => ts('when was gift cancelled'), |
c3fc2621 | 636 | 'import' => TRUE, |
e501603b TO |
637 | 'where' => 'civicrm_contribution.cancel_date', |
638 | 'headerPattern' => '/cancel(.?date)?/i', | |
639 | 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', | |
c3fc2621 | 640 | 'export' => TRUE, |
522a26c9 | 641 | 'table_name' => 'civicrm_contribution', |
642 | 'entity' => 'Contribution', | |
643 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 644 | 'localizable' => 0, |
c3fc2621 | 645 | 'html' => [ |
e501603b | 646 | 'type' => 'Select Date', |
24317d89 | 647 | 'formatType' => 'activityDateTime', |
c3fc2621 | 648 | ], |
a9d0587b | 649 | 'add' => '1.3', |
c3fc2621 CW |
650 | ], |
651 | 'cancel_reason' => [ | |
e501603b TO |
652 | 'name' => 'cancel_reason', |
653 | 'type' => CRM_Utils_Type::T_TEXT, | |
927898c5 | 654 | 'title' => ts('Cancellation / Refund Reason'), |
c3fc2621 | 655 | 'import' => TRUE, |
e501603b TO |
656 | 'where' => 'civicrm_contribution.cancel_reason', |
657 | 'headerPattern' => '/(cancel.?)?reason/i', | |
c3fc2621 | 658 | 'export' => TRUE, |
522a26c9 | 659 | 'table_name' => 'civicrm_contribution', |
660 | 'entity' => 'Contribution', | |
661 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 662 | 'localizable' => 0, |
c3fc2621 | 663 | 'html' => [ |
e501603b | 664 | 'type' => 'Text', |
c3fc2621 | 665 | ], |
a9d0587b | 666 | 'add' => '1.3', |
c3fc2621 CW |
667 | ], |
668 | 'receipt_date' => [ | |
e501603b TO |
669 | 'name' => 'receipt_date', |
670 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 671 | 'title' => ts('Receipt Date'), |
215b423e | 672 | 'description' => ts('when (if) receipt was sent. populated automatically for online donations w/ automatic receipting'), |
c3fc2621 | 673 | 'import' => TRUE, |
e501603b TO |
674 | 'where' => 'civicrm_contribution.receipt_date', |
675 | 'headerPattern' => '/receipt(.?date)?/i', | |
676 | 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', | |
c3fc2621 | 677 | 'export' => TRUE, |
522a26c9 | 678 | 'table_name' => 'civicrm_contribution', |
679 | 'entity' => 'Contribution', | |
680 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 681 | 'localizable' => 0, |
c3fc2621 | 682 | 'html' => [ |
e501603b | 683 | 'type' => 'Select Date', |
24317d89 | 684 | 'formatType' => 'activityDateTime', |
c23563e3 | 685 | 'label' => ts("Receipt Date"), |
c3fc2621 | 686 | ], |
a9d0587b | 687 | 'add' => '1.3', |
c3fc2621 CW |
688 | ], |
689 | 'thankyou_date' => [ | |
e501603b TO |
690 | 'name' => 'thankyou_date', |
691 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 692 | 'title' => ts('Thank-you Date'), |
215b423e | 693 | 'description' => ts('when (if) was donor thanked'), |
c3fc2621 | 694 | 'import' => TRUE, |
e501603b TO |
695 | 'where' => 'civicrm_contribution.thankyou_date', |
696 | 'headerPattern' => '/thank(s|(.?you))?(.?date)?/i', | |
697 | 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', | |
c3fc2621 | 698 | 'export' => TRUE, |
522a26c9 | 699 | 'table_name' => 'civicrm_contribution', |
700 | 'entity' => 'Contribution', | |
701 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 702 | 'localizable' => 0, |
c3fc2621 | 703 | 'html' => [ |
e501603b | 704 | 'type' => 'Select Date', |
24317d89 | 705 | 'formatType' => 'activityDateTime', |
c3fc2621 | 706 | ], |
a9d0587b | 707 | 'add' => '1.3', |
c3fc2621 CW |
708 | ], |
709 | 'contribution_source' => [ | |
e501603b TO |
710 | 'name' => 'source', |
711 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 712 | 'title' => ts('Contribution Source'), |
215b423e | 713 | 'description' => ts('Origin of this Contribution.'), |
e501603b TO |
714 | 'maxlength' => 255, |
715 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 716 | 'import' => TRUE, |
e501603b TO |
717 | 'where' => 'civicrm_contribution.source', |
718 | 'headerPattern' => '/source/i', | |
c3fc2621 | 719 | 'export' => TRUE, |
522a26c9 | 720 | 'table_name' => 'civicrm_contribution', |
721 | 'entity' => 'Contribution', | |
722 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 723 | 'localizable' => 0, |
c3fc2621 | 724 | 'html' => [ |
e501603b | 725 | 'type' => 'Text', |
c3fc2621 | 726 | ], |
a9d0587b | 727 | 'add' => '1.3', |
c3fc2621 CW |
728 | ], |
729 | 'amount_level' => [ | |
e501603b TO |
730 | 'name' => 'amount_level', |
731 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 CW |
732 | 'title' => ts('Amount Label'), |
733 | 'import' => TRUE, | |
e501603b | 734 | 'where' => 'civicrm_contribution.amount_level', |
c3fc2621 | 735 | 'export' => TRUE, |
522a26c9 | 736 | 'table_name' => 'civicrm_contribution', |
737 | 'entity' => 'Contribution', | |
738 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 739 | 'localizable' => 0, |
c3fc2621 | 740 | 'html' => [ |
e501603b | 741 | 'type' => 'Text', |
c3fc2621 | 742 | ], |
a9d0587b | 743 | 'add' => '1.7', |
c3fc2621 CW |
744 | ], |
745 | 'contribution_recur_id' => [ | |
e501603b TO |
746 | 'name' => 'contribution_recur_id', |
747 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 748 | 'title' => ts('Recurring Contribution ID'), |
215b423e | 749 | '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 | 750 | 'where' => 'civicrm_contribution.contribution_recur_id', |
a36434b9 | 751 | 'export' => TRUE, |
522a26c9 | 752 | 'table_name' => 'civicrm_contribution', |
753 | 'entity' => 'Contribution', | |
754 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 755 | 'localizable' => 0, |
e501603b | 756 | 'FKClassName' => 'CRM_Contribute_DAO_ContributionRecur', |
2cbbebe8 A |
757 | 'html' => [ |
758 | 'label' => ts("Recurring Contribution"), | |
759 | ], | |
58b0bf5a | 760 | 'readonly' => TRUE, |
a9d0587b | 761 | 'add' => '1.4', |
c3fc2621 CW |
762 | ], |
763 | 'is_test' => [ | |
e501603b TO |
764 | 'name' => 'is_test', |
765 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 CW |
766 | 'title' => ts('Test'), |
767 | 'import' => TRUE, | |
e501603b | 768 | 'where' => 'civicrm_contribution.is_test', |
c3fc2621 | 769 | 'export' => TRUE, |
45a83e42 | 770 | 'default' => '0', |
522a26c9 | 771 | 'table_name' => 'civicrm_contribution', |
772 | 'entity' => 'Contribution', | |
773 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 774 | 'localizable' => 0, |
c3fc2621 | 775 | 'html' => [ |
e501603b | 776 | 'type' => 'CheckBox', |
c3fc2621 | 777 | ], |
a9d0587b | 778 | 'add' => NULL, |
c3fc2621 CW |
779 | ], |
780 | 'is_pay_later' => [ | |
e501603b TO |
781 | 'name' => 'is_pay_later', |
782 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 CW |
783 | 'title' => ts('Is Pay Later'), |
784 | 'import' => TRUE, | |
e501603b | 785 | 'where' => 'civicrm_contribution.is_pay_later', |
c3fc2621 | 786 | 'export' => TRUE, |
45a83e42 | 787 | 'default' => '0', |
522a26c9 | 788 | 'table_name' => 'civicrm_contribution', |
789 | 'entity' => 'Contribution', | |
790 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 791 | 'localizable' => 0, |
c3fc2621 | 792 | 'html' => [ |
e501603b | 793 | 'type' => 'CheckBox', |
c3fc2621 | 794 | ], |
a9d0587b | 795 | 'add' => '2.1', |
c3fc2621 CW |
796 | ], |
797 | 'contribution_status_id' => [ | |
e501603b TO |
798 | 'name' => 'contribution_status_id', |
799 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
800 | 'title' => ts('Contribution Status ID'), |
801 | 'import' => TRUE, | |
e501603b TO |
802 | 'where' => 'civicrm_contribution.contribution_status_id', |
803 | 'headerPattern' => '/status/i', | |
c3fc2621 | 804 | 'export' => TRUE, |
e501603b | 805 | 'default' => '1', |
522a26c9 | 806 | 'table_name' => 'civicrm_contribution', |
807 | 'entity' => 'Contribution', | |
808 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 809 | 'localizable' => 0, |
c3fc2621 | 810 | 'html' => [ |
e501603b | 811 | 'type' => 'Select', |
ad5b7f44 | 812 | 'label' => ts("Contribution Status"), |
c3fc2621 CW |
813 | ], |
814 | 'pseudoconstant' => [ | |
e501603b TO |
815 | 'optionGroupName' => 'contribution_status', |
816 | 'optionEditPath' => 'civicrm/admin/options/contribution_status', | |
e6ca0a57 | 817 | ], |
a9d0587b | 818 | 'add' => '1.6', |
c3fc2621 CW |
819 | ], |
820 | 'contribution_address_id' => [ | |
e501603b TO |
821 | 'name' => 'address_id', |
822 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 823 | 'title' => ts('Address ID'), |
215b423e | 824 | '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 | 825 | 'where' => 'civicrm_contribution.address_id', |
a36434b9 | 826 | 'export' => TRUE, |
522a26c9 | 827 | 'table_name' => 'civicrm_contribution', |
828 | 'entity' => 'Contribution', | |
829 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 830 | 'localizable' => 0, |
e501603b | 831 | 'FKClassName' => 'CRM_Core_DAO_Address', |
2cbbebe8 A |
832 | 'html' => [ |
833 | 'label' => ts("Address"), | |
834 | ], | |
a9d0587b | 835 | 'add' => '2.2', |
c3fc2621 CW |
836 | ], |
837 | 'contribution_check_number' => [ | |
e501603b TO |
838 | 'name' => 'check_number', |
839 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 840 | 'title' => ts('Check Number'), |
e501603b TO |
841 | 'maxlength' => 255, |
842 | 'size' => 6, | |
c3fc2621 | 843 | 'import' => TRUE, |
e501603b TO |
844 | 'where' => 'civicrm_contribution.check_number', |
845 | 'headerPattern' => '/check(.?number)?/i', | |
c3fc2621 | 846 | 'export' => TRUE, |
522a26c9 | 847 | 'table_name' => 'civicrm_contribution', |
848 | 'entity' => 'Contribution', | |
849 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 850 | 'localizable' => 0, |
c3fc2621 | 851 | 'html' => [ |
e501603b | 852 | 'type' => 'Text', |
c3fc2621 | 853 | ], |
a9d0587b | 854 | 'add' => '2.2', |
c3fc2621 CW |
855 | ], |
856 | 'contribution_campaign_id' => [ | |
e501603b TO |
857 | 'name' => 'campaign_id', |
858 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 859 | 'title' => ts('Campaign ID'), |
215b423e | 860 | 'description' => ts('The campaign for which this contribution has been triggered.'), |
c3fc2621 | 861 | 'import' => TRUE, |
e501603b | 862 | 'where' => 'civicrm_contribution.campaign_id', |
c3fc2621 | 863 | 'export' => TRUE, |
522a26c9 | 864 | 'table_name' => 'civicrm_contribution', |
865 | 'entity' => 'Contribution', | |
866 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 867 | 'localizable' => 0, |
e501603b | 868 | 'FKClassName' => 'CRM_Campaign_DAO_Campaign', |
88c31c05 | 869 | 'component' => 'CiviCampaign', |
c3fc2621 | 870 | 'html' => [ |
8813f972 | 871 | 'type' => 'EntityRef', |
2cbbebe8 | 872 | 'label' => ts("Campaign"), |
c3fc2621 | 873 | ], |
a9d0587b | 874 | 'add' => '3.4', |
c3fc2621 CW |
875 | ], |
876 | 'creditnote_id' => [ | |
e501603b TO |
877 | 'name' => 'creditnote_id', |
878 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 879 | 'title' => ts('Credit Note ID'), |
215b423e | 880 | 'description' => ts('unique credit note id, system generated or passed in'), |
e501603b TO |
881 | 'maxlength' => 255, |
882 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 883 | 'import' => TRUE, |
e501603b TO |
884 | 'where' => 'civicrm_contribution.creditnote_id', |
885 | 'headerPattern' => '/creditnote(.?id)?/i', | |
c3fc2621 | 886 | 'export' => TRUE, |
522a26c9 | 887 | 'table_name' => 'civicrm_contribution', |
888 | 'entity' => 'Contribution', | |
889 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 890 | 'localizable' => 0, |
c3fc2621 | 891 | 'html' => [ |
e501603b | 892 | 'type' => 'Text', |
c3fc2621 | 893 | ], |
a9d0587b | 894 | 'add' => '4.6', |
c3fc2621 CW |
895 | ], |
896 | 'tax_amount' => [ | |
e501603b TO |
897 | 'name' => 'tax_amount', |
898 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 899 | 'title' => ts('Tax Amount'), |
215b423e | 900 | 'description' => ts('Total tax amount of this contribution.'), |
c3fc2621 | 901 | 'precision' => [ |
e501603b | 902 | 20, |
fb607354 | 903 | 2, |
c3fc2621 CW |
904 | ], |
905 | 'import' => TRUE, | |
e501603b TO |
906 | 'where' => 'civicrm_contribution.tax_amount', |
907 | 'headerPattern' => '/tax(.?am(ou)?nt)?/i', | |
908 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
c3fc2621 | 909 | 'export' => TRUE, |
522a26c9 | 910 | 'table_name' => 'civicrm_contribution', |
911 | 'entity' => 'Contribution', | |
912 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 913 | 'localizable' => 0, |
c3fc2621 | 914 | 'html' => [ |
e501603b | 915 | 'type' => 'Text', |
c3fc2621 | 916 | ], |
a9d0587b | 917 | 'add' => '4.6', |
c3fc2621 CW |
918 | ], |
919 | 'revenue_recognition_date' => [ | |
e501603b TO |
920 | 'name' => 'revenue_recognition_date', |
921 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 922 | 'title' => ts('Revenue Recognition Date'), |
215b423e | 923 | 'description' => ts('Stores the date when revenue should be recognized.'), |
c3fc2621 | 924 | 'import' => TRUE, |
e501603b TO |
925 | 'where' => 'civicrm_contribution.revenue_recognition_date', |
926 | 'headerPattern' => '/revenue(.?date)?/i', | |
927 | 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', | |
c3fc2621 | 928 | 'export' => TRUE, |
522a26c9 | 929 | 'table_name' => 'civicrm_contribution', |
930 | 'entity' => 'Contribution', | |
931 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
6a7e5e5d | 932 | 'localizable' => 0, |
c3fc2621 | 933 | 'html' => [ |
e501603b | 934 | 'type' => 'Select Date', |
24317d89 | 935 | 'formatType' => 'activityDateTime', |
c23563e3 | 936 | 'label' => ts("Revenue Recognition Date"), |
c3fc2621 | 937 | ], |
a9d0587b | 938 | 'add' => '4.7', |
c3fc2621 | 939 | ], |
dc396835 AS |
940 | 'is_template' => [ |
941 | 'name' => 'is_template', | |
942 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
943 | 'title' => ts('Is a Template Contribution'), | |
944 | 'description' => ts('Shows this is a template for recurring contributions.'), | |
945 | 'import' => TRUE, | |
946 | 'where' => 'civicrm_contribution.is_template', | |
947 | 'export' => TRUE, | |
948 | 'default' => '0', | |
949 | 'table_name' => 'civicrm_contribution', | |
950 | 'entity' => 'Contribution', | |
951 | 'bao' => 'CRM_Contribute_BAO_Contribution', | |
952 | 'localizable' => 0, | |
953 | 'html' => [ | |
954 | 'type' => 'CheckBox', | |
955 | ], | |
58b0bf5a | 956 | 'readonly' => TRUE, |
a9d0587b | 957 | 'add' => '5.20', |
dc396835 | 958 | ], |
c3fc2621 | 959 | ]; |
346aaaba | 960 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 961 | } |
346aaaba | 962 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 963 | } |
c3fc2621 | 964 | |
e501603b | 965 | /** |
bd8e0b14 | 966 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
967 | * |
968 | * @return array | |
bd8e0b14 | 969 | * Array(string $name => string $uniqueName). |
e501603b | 970 | */ |
c3fc2621 | 971 | public static function &fieldKeys() { |
bd8e0b14 TO |
972 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
973 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 974 | } |
bd8e0b14 | 975 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 976 | } |
c3fc2621 | 977 | |
e501603b TO |
978 | /** |
979 | * Returns the names of this table | |
980 | * | |
981 | * @return string | |
982 | */ | |
c3fc2621 | 983 | public static function getTableName() { |
e501603b TO |
984 | return self::$_tableName; |
985 | } | |
c3fc2621 | 986 | |
e501603b TO |
987 | /** |
988 | * Returns if this table needs to be logged | |
989 | * | |
c3fc2621 | 990 | * @return bool |
e501603b | 991 | */ |
c3fc2621 | 992 | public function getLog() { |
e501603b TO |
993 | return self::$_log; |
994 | } | |
c3fc2621 | 995 | |
e501603b TO |
996 | /** |
997 | * Returns the list of fields that can be imported | |
998 | * | |
999 | * @param bool $prefix | |
1000 | * | |
1001 | * @return array | |
1002 | */ | |
c3fc2621 CW |
1003 | public static function &import($prefix = FALSE) { |
1004 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution', $prefix, []); | |
60808919 | 1005 | return $r; |
e501603b | 1006 | } |
c3fc2621 | 1007 | |
e501603b TO |
1008 | /** |
1009 | * Returns the list of fields that can be exported | |
1010 | * | |
1011 | * @param bool $prefix | |
1012 | * | |
1013 | * @return array | |
1014 | */ | |
c3fc2621 CW |
1015 | public static function &export($prefix = FALSE) { |
1016 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution', $prefix, []); | |
60808919 | 1017 | return $r; |
e501603b | 1018 | } |
c3fc2621 | 1019 | |
e7a6b91a AS |
1020 | /** |
1021 | * Returns the list of indices | |
c3fc2621 CW |
1022 | * |
1023 | * @param bool $localize | |
1024 | * | |
1025 | * @return array | |
e7a6b91a AS |
1026 | */ |
1027 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
1028 | $indices = [ |
1029 | 'UI_contrib_payment_instrument_id' => [ | |
e7a6b91a | 1030 | 'name' => 'UI_contrib_payment_instrument_id', |
c3fc2621 | 1031 | 'field' => [ |
e7a6b91a | 1032 | 0 => 'payment_instrument_id', |
c3fc2621 CW |
1033 | ], |
1034 | 'localizable' => FALSE, | |
e7a6b91a | 1035 | 'sig' => 'civicrm_contribution::0::payment_instrument_id', |
c3fc2621 CW |
1036 | ], |
1037 | 'index_total_amount_receive_date' => [ | |
e7a6b91a | 1038 | 'name' => 'index_total_amount_receive_date', |
c3fc2621 | 1039 | 'field' => [ |
e7a6b91a AS |
1040 | 0 => 'total_amount', |
1041 | 1 => 'receive_date', | |
c3fc2621 CW |
1042 | ], |
1043 | 'localizable' => FALSE, | |
e7a6b91a | 1044 | 'sig' => 'civicrm_contribution::0::total_amount::receive_date', |
c3fc2621 CW |
1045 | ], |
1046 | 'index_source' => [ | |
e7a6b91a | 1047 | 'name' => 'index_source', |
c3fc2621 | 1048 | 'field' => [ |
e7a6b91a | 1049 | 0 => 'source', |
c3fc2621 CW |
1050 | ], |
1051 | 'localizable' => FALSE, | |
e7a6b91a | 1052 | 'sig' => 'civicrm_contribution::0::source', |
c3fc2621 CW |
1053 | ], |
1054 | 'UI_contrib_trxn_id' => [ | |
e7a6b91a | 1055 | 'name' => 'UI_contrib_trxn_id', |
c3fc2621 | 1056 | 'field' => [ |
e7a6b91a | 1057 | 0 => 'trxn_id', |
c3fc2621 CW |
1058 | ], |
1059 | 'localizable' => FALSE, | |
1060 | 'unique' => TRUE, | |
e7a6b91a | 1061 | 'sig' => 'civicrm_contribution::1::trxn_id', |
c3fc2621 CW |
1062 | ], |
1063 | 'UI_contrib_invoice_id' => [ | |
e7a6b91a | 1064 | 'name' => 'UI_contrib_invoice_id', |
c3fc2621 | 1065 | 'field' => [ |
e7a6b91a | 1066 | 0 => 'invoice_id', |
c3fc2621 CW |
1067 | ], |
1068 | 'localizable' => FALSE, | |
1069 | 'unique' => TRUE, | |
e7a6b91a | 1070 | 'sig' => 'civicrm_contribution::1::invoice_id', |
c3fc2621 CW |
1071 | ], |
1072 | 'index_contribution_status' => [ | |
e7a6b91a | 1073 | 'name' => 'index_contribution_status', |
c3fc2621 | 1074 | 'field' => [ |
e7a6b91a | 1075 | 0 => 'contribution_status_id', |
c3fc2621 CW |
1076 | ], |
1077 | 'localizable' => FALSE, | |
e7a6b91a | 1078 | 'sig' => 'civicrm_contribution::0::contribution_status_id', |
c3fc2621 CW |
1079 | ], |
1080 | 'received_date' => [ | |
e7a6b91a | 1081 | 'name' => 'received_date', |
c3fc2621 | 1082 | 'field' => [ |
e7a6b91a | 1083 | 0 => 'receive_date', |
c3fc2621 CW |
1084 | ], |
1085 | 'localizable' => FALSE, | |
e7a6b91a | 1086 | 'sig' => 'civicrm_contribution::0::receive_date', |
c3fc2621 CW |
1087 | ], |
1088 | 'check_number' => [ | |
e7a6b91a | 1089 | 'name' => 'check_number', |
c3fc2621 | 1090 | 'field' => [ |
e7a6b91a | 1091 | 0 => 'check_number', |
c3fc2621 CW |
1092 | ], |
1093 | 'localizable' => FALSE, | |
e7a6b91a | 1094 | 'sig' => 'civicrm_contribution::0::check_number', |
c3fc2621 CW |
1095 | ], |
1096 | 'index_creditnote_id' => [ | |
e7a6b91a | 1097 | 'name' => 'index_creditnote_id', |
c3fc2621 | 1098 | 'field' => [ |
e7a6b91a | 1099 | 0 => 'creditnote_id', |
c3fc2621 CW |
1100 | ], |
1101 | 'localizable' => FALSE, | |
e7a6b91a | 1102 | 'sig' => 'civicrm_contribution::0::creditnote_id', |
c3fc2621 CW |
1103 | ], |
1104 | ]; | |
e7a6b91a AS |
1105 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
1106 | } | |
c3fc2621 | 1107 | |
e501603b | 1108 | } |