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