Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
6b83d5bd | 5 | * @copyright CiviCRM LLC (c) 2004-2019 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Contribute/ContributionRecur.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
c6821d8d | 9 | * (GenCodeChecksum:1eb0ecd4aadee175dadb66464c06dd25) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the ContributionRecur entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { |
c3fc2621 | 16 | |
e501603b | 17 | /** |
f41f0342 | 18 | * Static instance to hold the table name. |
e501603b TO |
19 | * |
20 | * @var string | |
21 | */ | |
22 | static $_tableName = 'civicrm_contribution_recur'; | |
c3fc2621 | 23 | |
e501603b | 24 | /** |
f41f0342 | 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 26 | * |
c3fc2621 | 27 | * @var bool |
e501603b | 28 | */ |
c3fc2621 CW |
29 | static $_log = TRUE; |
30 | ||
e501603b TO |
31 | /** |
32 | * Contribution Recur ID | |
33 | * | |
34 | * @var int unsigned | |
35 | */ | |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b | 38 | /** |
c6821d8d | 39 | * Foreign key to civicrm_contact.id. |
e501603b TO |
40 | * |
41 | * @var int unsigned | |
42 | */ | |
43 | public $contact_id; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * Amount to be contributed or charged each recurrence. | |
47 | * | |
48 | * @var float | |
49 | */ | |
50 | public $amount; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * 3 character string, value from config setting or input via user. | |
54 | * | |
55 | * @var string | |
56 | */ | |
57 | public $currency; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * Time units for recurrence of payment. | |
61 | * | |
62 | * @var string | |
63 | */ | |
64 | public $frequency_unit; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * Number of time units for recurrence of payment. | |
68 | * | |
69 | * @var int unsigned | |
70 | */ | |
71 | public $frequency_interval; | |
c3fc2621 | 72 | |
e501603b TO |
73 | /** |
74 | * Total number of payments to be made. Set this to 0 if this is an open-ended commitment i.e. no set end date. | |
75 | * | |
76 | * @var int unsigned | |
77 | */ | |
78 | public $installments; | |
c3fc2621 | 79 | |
e501603b TO |
80 | /** |
81 | * The date the first scheduled recurring contribution occurs. | |
82 | * | |
83 | * @var datetime | |
84 | */ | |
85 | public $start_date; | |
c3fc2621 | 86 | |
e501603b TO |
87 | /** |
88 | * When this recurring contribution record was created. | |
89 | * | |
90 | * @var datetime | |
91 | */ | |
92 | public $create_date; | |
c3fc2621 | 93 | |
e501603b TO |
94 | /** |
95 | * Last updated date for this record. mostly the last time a payment was received | |
96 | * | |
97 | * @var datetime | |
98 | */ | |
99 | public $modified_date; | |
c3fc2621 | 100 | |
e501603b TO |
101 | /** |
102 | * Date this recurring contribution was cancelled by contributor- if we can get access to it | |
103 | * | |
104 | * @var datetime | |
105 | */ | |
106 | public $cancel_date; | |
c3fc2621 | 107 | |
e501603b TO |
108 | /** |
109 | * Date this recurring contribution finished successfully | |
110 | * | |
111 | * @var datetime | |
112 | */ | |
113 | public $end_date; | |
c3fc2621 | 114 | |
e501603b TO |
115 | /** |
116 | * Possibly needed to store a unique identifier for this recurring payment order - if this is available from the processor?? | |
117 | * | |
118 | * @var string | |
119 | */ | |
120 | public $processor_id; | |
c3fc2621 | 121 | |
e501603b TO |
122 | /** |
123 | * Optionally used to store a link to a payment token used for this recurring contribution. | |
124 | * | |
125 | * @var int unsigned | |
126 | */ | |
127 | public $payment_token_id; | |
c3fc2621 | 128 | |
e501603b TO |
129 | /** |
130 | * unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method | |
131 | * | |
132 | * @var string | |
133 | */ | |
134 | public $trxn_id; | |
c3fc2621 | 135 | |
e501603b TO |
136 | /** |
137 | * unique invoice id, system generated or passed in | |
138 | * | |
139 | * @var string | |
140 | */ | |
141 | public $invoice_id; | |
c3fc2621 | 142 | |
e501603b | 143 | /** |
e501603b TO |
144 | * @var int unsigned |
145 | */ | |
146 | public $contribution_status_id; | |
c3fc2621 | 147 | |
e501603b | 148 | /** |
e501603b TO |
149 | * @var boolean |
150 | */ | |
151 | public $is_test; | |
c3fc2621 | 152 | |
e501603b TO |
153 | /** |
154 | * Day in the period when the payment should be charged e.g. 1st of month, 15th etc. | |
155 | * | |
156 | * @var int unsigned | |
157 | */ | |
158 | public $cycle_day; | |
c3fc2621 | 159 | |
e501603b TO |
160 | /** |
161 | * Next scheduled date | |
162 | * | |
163 | * @var datetime | |
164 | */ | |
165 | public $next_sched_contribution_date; | |
c3fc2621 | 166 | |
e501603b TO |
167 | /** |
168 | * Number of failed charge attempts since last success. Business rule could be set to deactivate on more than x failures. | |
169 | * | |
170 | * @var int unsigned | |
171 | */ | |
172 | public $failure_count; | |
c3fc2621 | 173 | |
e501603b TO |
174 | /** |
175 | * Date to retry failed attempt | |
176 | * | |
177 | * @var datetime | |
178 | */ | |
179 | public $failure_retry_date; | |
c3fc2621 | 180 | |
e501603b TO |
181 | /** |
182 | * Some systems allow contributor to set a number of installments - but then auto-renew the subscription or commitment if they do not cancel. | |
183 | * | |
184 | * @var boolean | |
185 | */ | |
186 | public $auto_renew; | |
c3fc2621 | 187 | |
e501603b TO |
188 | /** |
189 | * Foreign key to civicrm_payment_processor.id | |
190 | * | |
191 | * @var int unsigned | |
192 | */ | |
193 | public $payment_processor_id; | |
c3fc2621 | 194 | |
e501603b TO |
195 | /** |
196 | * FK to Financial Type | |
197 | * | |
198 | * @var int unsigned | |
199 | */ | |
200 | public $financial_type_id; | |
c3fc2621 | 201 | |
e501603b TO |
202 | /** |
203 | * FK to Payment Instrument | |
204 | * | |
205 | * @var int unsigned | |
206 | */ | |
207 | public $payment_instrument_id; | |
c3fc2621 | 208 | |
e501603b TO |
209 | /** |
210 | * The campaign for which this contribution has been triggered. | |
211 | * | |
212 | * @var int unsigned | |
213 | */ | |
214 | public $campaign_id; | |
c3fc2621 | 215 | |
e501603b TO |
216 | /** |
217 | * if true, receipt is automatically emailed to contact on each successful payment | |
218 | * | |
219 | * @var boolean | |
220 | */ | |
221 | public $is_email_receipt; | |
c3fc2621 | 222 | |
e501603b | 223 | /** |
f41f0342 | 224 | * Class constructor. |
e501603b | 225 | */ |
c3fc2621 | 226 | public function __construct() { |
e501603b TO |
227 | $this->__table = 'civicrm_contribution_recur'; |
228 | parent::__construct(); | |
229 | } | |
c3fc2621 | 230 | |
e501603b | 231 | /** |
f41f0342 | 232 | * Returns foreign keys and entity references. |
e501603b TO |
233 | * |
234 | * @return array | |
235 | * [CRM_Core_Reference_Interface] | |
236 | */ | |
c3fc2621 | 237 | public static function getReferenceColumns() { |
346aaaba TO |
238 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
239 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
c3fc2621 CW |
240 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); |
241 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'payment_token_id', 'civicrm_payment_token', 'id'); | |
242 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'payment_processor_id', 'civicrm_payment_processor', 'id'); | |
243 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); | |
244 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id'); | |
346aaaba | 245 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 246 | } |
346aaaba | 247 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 248 | } |
c3fc2621 | 249 | |
e501603b TO |
250 | /** |
251 | * Returns all the column names of this table | |
252 | * | |
253 | * @return array | |
254 | */ | |
c3fc2621 | 255 | public static function &fields() { |
346aaaba | 256 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
257 | Civi::$statics[__CLASS__]['fields'] = [ |
258 | 'id' => [ | |
e501603b TO |
259 | 'name' => 'id', |
260 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 261 | 'title' => ts('Recurring Contribution ID'), |
215b423e | 262 | 'description' => ts('Contribution Recur ID'), |
c3fc2621 | 263 | 'required' => TRUE, |
522a26c9 | 264 | 'table_name' => 'civicrm_contribution_recur', |
265 | 'entity' => 'ContributionRecur', | |
266 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 267 | 'localizable' => 0, |
c3fc2621 CW |
268 | ], |
269 | 'contact_id' => [ | |
e501603b TO |
270 | 'name' => 'contact_id', |
271 | 'type' => CRM_Utils_Type::T_INT, | |
c6821d8d MWMC |
272 | 'title' => ts('Contact'), |
273 | 'description' => ts('Foreign key to civicrm_contact.id.'), | |
c3fc2621 | 274 | 'required' => TRUE, |
522a26c9 | 275 | 'table_name' => 'civicrm_contribution_recur', |
276 | 'entity' => 'ContributionRecur', | |
277 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 278 | 'localizable' => 0, |
e501603b | 279 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c6821d8d MWMC |
280 | 'html' => [ |
281 | 'type' => 'EntityRef', | |
282 | ], | |
c3fc2621 CW |
283 | ], |
284 | 'amount' => [ | |
e501603b TO |
285 | 'name' => 'amount', |
286 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 287 | 'title' => ts('Amount'), |
215b423e | 288 | 'description' => ts('Amount to be contributed or charged each recurrence.'), |
c3fc2621 CW |
289 | 'required' => TRUE, |
290 | 'precision' => [ | |
e501603b TO |
291 | 20, |
292 | 2 | |
c3fc2621 | 293 | ], |
522a26c9 | 294 | 'table_name' => 'civicrm_contribution_recur', |
295 | 'entity' => 'ContributionRecur', | |
296 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 297 | 'localizable' => 0, |
c3fc2621 | 298 | 'html' => [ |
e501603b | 299 | 'type' => 'Text', |
c3fc2621 CW |
300 | ], |
301 | ], | |
302 | 'currency' => [ | |
e501603b TO |
303 | 'name' => 'currency', |
304 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 305 | 'title' => ts('Currency'), |
215b423e | 306 | 'description' => ts('3 character string, value from config setting or input via user.'), |
e501603b TO |
307 | 'maxlength' => 3, |
308 | 'size' => CRM_Utils_Type::FOUR, | |
309 | 'default' => 'NULL', | |
522a26c9 | 310 | 'table_name' => 'civicrm_contribution_recur', |
311 | 'entity' => 'ContributionRecur', | |
312 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 313 | 'localizable' => 0, |
c3fc2621 | 314 | 'html' => [ |
e501603b | 315 | 'type' => 'Select', |
c3fc2621 CW |
316 | ], |
317 | 'pseudoconstant' => [ | |
e501603b TO |
318 | 'table' => 'civicrm_currency', |
319 | 'keyColumn' => 'name', | |
320 | 'labelColumn' => 'full_name', | |
321 | 'nameColumn' => 'name', | |
c3fc2621 CW |
322 | ] |
323 | ], | |
324 | 'frequency_unit' => [ | |
e501603b TO |
325 | 'name' => 'frequency_unit', |
326 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 327 | 'title' => ts('Frequency Unit'), |
215b423e | 328 | 'description' => ts('Time units for recurrence of payment.'), |
e501603b TO |
329 | 'maxlength' => 8, |
330 | 'size' => CRM_Utils_Type::EIGHT, | |
331 | 'default' => 'month', | |
522a26c9 | 332 | 'table_name' => 'civicrm_contribution_recur', |
333 | 'entity' => 'ContributionRecur', | |
334 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 335 | 'localizable' => 0, |
c3fc2621 | 336 | 'html' => [ |
e501603b | 337 | 'type' => 'Select', |
c3fc2621 CW |
338 | ], |
339 | 'pseudoconstant' => [ | |
e501603b TO |
340 | 'optionGroupName' => 'recur_frequency_units', |
341 | 'keyColumn' => 'name', | |
342 | 'optionEditPath' => 'civicrm/admin/options/recur_frequency_units', | |
c3fc2621 CW |
343 | ] |
344 | ], | |
345 | 'frequency_interval' => [ | |
e501603b TO |
346 | 'name' => 'frequency_interval', |
347 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 348 | 'title' => ts('Interval (number of units)'), |
215b423e | 349 | 'description' => ts('Number of time units for recurrence of payment.'), |
c3fc2621 | 350 | 'required' => TRUE, |
522a26c9 | 351 | 'table_name' => 'civicrm_contribution_recur', |
352 | 'entity' => 'ContributionRecur', | |
353 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 354 | 'localizable' => 0, |
c3fc2621 | 355 | 'html' => [ |
e501603b | 356 | 'type' => 'Text', |
c3fc2621 CW |
357 | ], |
358 | ], | |
359 | 'installments' => [ | |
e501603b TO |
360 | 'name' => 'installments', |
361 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 362 | 'title' => ts('Number of Installments'), |
215b423e | 363 | 'description' => ts('Total number of payments to be made. Set this to 0 if this is an open-ended commitment i.e. no set end date.'), |
522a26c9 | 364 | 'table_name' => 'civicrm_contribution_recur', |
365 | 'entity' => 'ContributionRecur', | |
366 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 367 | 'localizable' => 0, |
c3fc2621 | 368 | 'html' => [ |
e501603b | 369 | 'type' => 'Text', |
c3fc2621 CW |
370 | ], |
371 | ], | |
372 | 'start_date' => [ | |
e501603b TO |
373 | 'name' => 'start_date', |
374 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c6821d8d | 375 | 'title' => ts('Start Date'), |
215b423e | 376 | 'description' => ts('The date the first scheduled recurring contribution occurs.'), |
c3fc2621 | 377 | 'required' => TRUE, |
522a26c9 | 378 | 'table_name' => 'civicrm_contribution_recur', |
379 | 'entity' => 'ContributionRecur', | |
380 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 381 | 'localizable' => 0, |
c3fc2621 | 382 | 'html' => [ |
e501603b | 383 | 'type' => 'Select Date', |
c6821d8d | 384 | 'formatType' => 'activityDateTime', |
c3fc2621 CW |
385 | ], |
386 | ], | |
387 | 'create_date' => [ | |
e501603b TO |
388 | 'name' => 'create_date', |
389 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c6821d8d | 390 | 'title' => ts('Created Date'), |
215b423e | 391 | 'description' => ts('When this recurring contribution record was created.'), |
c3fc2621 | 392 | 'required' => TRUE, |
522a26c9 | 393 | 'table_name' => 'civicrm_contribution_recur', |
394 | 'entity' => 'ContributionRecur', | |
395 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 396 | 'localizable' => 0, |
c3fc2621 | 397 | 'html' => [ |
e501603b | 398 | 'type' => 'Select Date', |
c6821d8d | 399 | 'formatType' => 'activityDateTime', |
c3fc2621 CW |
400 | ], |
401 | ], | |
402 | 'modified_date' => [ | |
e501603b TO |
403 | 'name' => 'modified_date', |
404 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c6821d8d | 405 | 'title' => ts('Modified Date'), |
215b423e | 406 | 'description' => ts('Last updated date for this record. mostly the last time a payment was received'), |
522a26c9 | 407 | 'table_name' => 'civicrm_contribution_recur', |
408 | 'entity' => 'ContributionRecur', | |
409 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 410 | 'localizable' => 0, |
c3fc2621 | 411 | 'html' => [ |
e501603b | 412 | 'type' => 'Select Date', |
c6821d8d | 413 | 'formatType' => 'activityDateTime', |
c3fc2621 CW |
414 | ], |
415 | ], | |
416 | 'cancel_date' => [ | |
e501603b TO |
417 | 'name' => 'cancel_date', |
418 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c6821d8d | 419 | 'title' => ts('Cancel Date'), |
215b423e | 420 | 'description' => ts('Date this recurring contribution was cancelled by contributor- if we can get access to it'), |
522a26c9 | 421 | 'table_name' => 'civicrm_contribution_recur', |
422 | 'entity' => 'ContributionRecur', | |
423 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 424 | 'localizable' => 0, |
c3fc2621 | 425 | 'html' => [ |
e501603b | 426 | 'type' => 'Select Date', |
9139737b | 427 | 'formatType' => 'activityDate', |
c3fc2621 CW |
428 | ], |
429 | ], | |
430 | 'end_date' => [ | |
e501603b TO |
431 | 'name' => 'end_date', |
432 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 433 | 'title' => ts('Recurring Contribution End Date'), |
215b423e | 434 | 'description' => ts('Date this recurring contribution finished successfully'), |
522a26c9 | 435 | 'table_name' => 'civicrm_contribution_recur', |
436 | 'entity' => 'ContributionRecur', | |
437 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 438 | 'localizable' => 0, |
c3fc2621 | 439 | 'html' => [ |
e501603b | 440 | 'type' => 'Select Date', |
9139737b | 441 | 'formatType' => 'activityDate', |
c3fc2621 CW |
442 | ], |
443 | ], | |
444 | 'processor_id' => [ | |
e501603b TO |
445 | 'name' => 'processor_id', |
446 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 447 | 'title' => ts('Processor ID'), |
215b423e | 448 | 'description' => ts('Possibly needed to store a unique identifier for this recurring payment order - if this is available from the processor??'), |
e501603b TO |
449 | 'maxlength' => 255, |
450 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 451 | 'table_name' => 'civicrm_contribution_recur', |
452 | 'entity' => 'ContributionRecur', | |
453 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 454 | 'localizable' => 0, |
c6821d8d MWMC |
455 | 'html' => [ |
456 | 'type' => 'Text', | |
457 | ], | |
c3fc2621 CW |
458 | ], |
459 | 'payment_token_id' => [ | |
e501603b TO |
460 | 'name' => 'payment_token_id', |
461 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 462 | 'title' => ts('Payment Token ID'), |
215b423e | 463 | 'description' => ts('Optionally used to store a link to a payment token used for this recurring contribution.'), |
522a26c9 | 464 | 'table_name' => 'civicrm_contribution_recur', |
465 | 'entity' => 'ContributionRecur', | |
466 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 467 | 'localizable' => 0, |
e501603b | 468 | 'FKClassName' => 'CRM_Financial_DAO_PaymentToken', |
c3fc2621 CW |
469 | ], |
470 | 'trxn_id' => [ | |
e501603b TO |
471 | 'name' => 'trxn_id', |
472 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 473 | 'title' => ts('Transaction ID'), |
215b423e | 474 | 'description' => ts('unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method'), |
e501603b TO |
475 | 'maxlength' => 255, |
476 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 477 | 'table_name' => 'civicrm_contribution_recur', |
478 | 'entity' => 'ContributionRecur', | |
479 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 480 | 'localizable' => 0, |
c6821d8d MWMC |
481 | 'html' => [ |
482 | 'type' => 'Text', | |
483 | ], | |
c3fc2621 CW |
484 | ], |
485 | 'invoice_id' => [ | |
e501603b TO |
486 | 'name' => 'invoice_id', |
487 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 488 | 'title' => ts('Invoice ID'), |
215b423e | 489 | 'description' => ts('unique invoice id, system generated or passed in'), |
e501603b TO |
490 | 'maxlength' => 255, |
491 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 492 | 'table_name' => 'civicrm_contribution_recur', |
493 | 'entity' => 'ContributionRecur', | |
494 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 495 | 'localizable' => 0, |
c6821d8d MWMC |
496 | 'html' => [ |
497 | 'type' => 'Text', | |
498 | ], | |
c3fc2621 CW |
499 | ], |
500 | 'contribution_status_id' => [ | |
e501603b TO |
501 | 'name' => 'contribution_status_id', |
502 | 'type' => CRM_Utils_Type::T_INT, | |
c6821d8d | 503 | 'title' => ts('Status'), |
c3fc2621 | 504 | 'import' => TRUE, |
e501603b TO |
505 | 'where' => 'civicrm_contribution_recur.contribution_status_id', |
506 | 'headerPattern' => '', | |
507 | 'dataPattern' => '', | |
c3fc2621 | 508 | 'export' => TRUE, |
e501603b | 509 | 'default' => '1', |
522a26c9 | 510 | 'table_name' => 'civicrm_contribution_recur', |
511 | 'entity' => 'ContributionRecur', | |
512 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 513 | 'localizable' => 0, |
c6821d8d MWMC |
514 | 'html' => [ |
515 | 'type' => 'Select', | |
516 | ], | |
c3fc2621 | 517 | 'pseudoconstant' => [ |
e501603b TO |
518 | 'optionGroupName' => 'contribution_status', |
519 | 'optionEditPath' => 'civicrm/admin/options/contribution_status', | |
c3fc2621 CW |
520 | ] |
521 | ], | |
522 | 'is_test' => [ | |
e501603b TO |
523 | 'name' => 'is_test', |
524 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 CW |
525 | 'title' => ts('Test'), |
526 | 'import' => TRUE, | |
e501603b TO |
527 | 'where' => 'civicrm_contribution_recur.is_test', |
528 | 'headerPattern' => '', | |
529 | 'dataPattern' => '', | |
c3fc2621 | 530 | 'export' => TRUE, |
45a83e42 | 531 | 'default' => '0', |
522a26c9 | 532 | 'table_name' => 'civicrm_contribution_recur', |
533 | 'entity' => 'ContributionRecur', | |
534 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 535 | 'localizable' => 0, |
c3fc2621 | 536 | 'html' => [ |
437fafcf | 537 | 'type' => 'CheckBox', |
c3fc2621 CW |
538 | ], |
539 | ], | |
540 | 'cycle_day' => [ | |
e501603b TO |
541 | 'name' => 'cycle_day', |
542 | 'type' => CRM_Utils_Type::T_INT, | |
c6821d8d | 543 | 'title' => ts('Cycle Day'), |
215b423e | 544 | 'description' => ts('Day in the period when the payment should be charged e.g. 1st of month, 15th etc.'), |
c3fc2621 | 545 | 'required' => TRUE, |
e501603b | 546 | 'default' => '1', |
522a26c9 | 547 | 'table_name' => 'civicrm_contribution_recur', |
548 | 'entity' => 'ContributionRecur', | |
549 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 550 | 'localizable' => 0, |
c3fc2621 | 551 | 'html' => [ |
437fafcf | 552 | 'type' => 'Text', |
c3fc2621 CW |
553 | ], |
554 | ], | |
555 | 'next_sched_contribution_date' => [ | |
e501603b TO |
556 | 'name' => 'next_sched_contribution_date', |
557 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 558 | 'title' => ts('Next Scheduled Contribution Date'), |
215b423e | 559 | 'description' => ts('Next scheduled date'), |
522a26c9 | 560 | 'table_name' => 'civicrm_contribution_recur', |
561 | 'entity' => 'ContributionRecur', | |
562 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 563 | 'localizable' => 0, |
c3fc2621 | 564 | 'html' => [ |
e501603b | 565 | 'type' => 'Select Date', |
9139737b | 566 | 'formatType' => 'activityDate', |
c3fc2621 CW |
567 | ], |
568 | ], | |
569 | 'failure_count' => [ | |
e501603b TO |
570 | 'name' => 'failure_count', |
571 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 572 | 'title' => ts('Number of Failures'), |
215b423e | 573 | 'description' => ts('Number of failed charge attempts since last success. Business rule could be set to deactivate on more than x failures.'), |
45a83e42 | 574 | 'default' => '0', |
522a26c9 | 575 | 'table_name' => 'civicrm_contribution_recur', |
576 | 'entity' => 'ContributionRecur', | |
577 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 578 | 'localizable' => 0, |
c3fc2621 | 579 | 'html' => [ |
437fafcf | 580 | 'type' => 'Text', |
c3fc2621 CW |
581 | ], |
582 | ], | |
583 | 'failure_retry_date' => [ | |
e501603b TO |
584 | 'name' => 'failure_retry_date', |
585 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 586 | 'title' => ts('Retry Failed Attempt Date'), |
215b423e | 587 | 'description' => ts('Date to retry failed attempt'), |
522a26c9 | 588 | 'table_name' => 'civicrm_contribution_recur', |
589 | 'entity' => 'ContributionRecur', | |
590 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 591 | 'localizable' => 0, |
c3fc2621 | 592 | 'html' => [ |
e501603b | 593 | 'type' => 'Select Date', |
9139737b | 594 | 'formatType' => 'activityDate', |
c3fc2621 CW |
595 | ], |
596 | ], | |
597 | 'auto_renew' => [ | |
e501603b TO |
598 | 'name' => 'auto_renew', |
599 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 600 | 'title' => ts('Auto Renew'), |
215b423e | 601 | 'description' => ts('Some systems allow contributor to set a number of installments - but then auto-renew the subscription or commitment if they do not cancel.'), |
c3fc2621 | 602 | 'required' => TRUE, |
45a83e42 | 603 | 'default' => '0', |
522a26c9 | 604 | 'table_name' => 'civicrm_contribution_recur', |
605 | 'entity' => 'ContributionRecur', | |
606 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 607 | 'localizable' => 0, |
c3fc2621 | 608 | 'html' => [ |
437fafcf | 609 | 'type' => 'CheckBox', |
c3fc2621 CW |
610 | ], |
611 | ], | |
612 | 'payment_processor_id' => [ | |
e501603b TO |
613 | 'name' => 'payment_processor_id', |
614 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 615 | 'title' => ts('Payment Processor'), |
215b423e | 616 | 'description' => ts('Foreign key to civicrm_payment_processor.id'), |
522a26c9 | 617 | 'table_name' => 'civicrm_contribution_recur', |
618 | 'entity' => 'ContributionRecur', | |
619 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 620 | 'localizable' => 0, |
e501603b | 621 | 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor', |
c6821d8d MWMC |
622 | 'html' => [ |
623 | 'type' => 'Select', | |
624 | ], | |
c3fc2621 CW |
625 | ], |
626 | 'financial_type_id' => [ | |
e501603b TO |
627 | 'name' => 'financial_type_id', |
628 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 629 | 'title' => ts('Financial Type'), |
215b423e | 630 | 'description' => ts('FK to Financial Type'), |
c3fc2621 | 631 | 'export' => FALSE, |
e501603b TO |
632 | 'where' => 'civicrm_contribution_recur.financial_type_id', |
633 | 'headerPattern' => '', | |
634 | 'dataPattern' => '', | |
522a26c9 | 635 | 'table_name' => 'civicrm_contribution_recur', |
636 | 'entity' => 'ContributionRecur', | |
637 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 638 | 'localizable' => 0, |
e501603b | 639 | 'FKClassName' => 'CRM_Financial_DAO_FinancialType', |
c6821d8d MWMC |
640 | 'html' => [ |
641 | 'type' => 'Select', | |
642 | ], | |
c3fc2621 | 643 | 'pseudoconstant' => [ |
e501603b TO |
644 | 'table' => 'civicrm_financial_type', |
645 | 'keyColumn' => 'id', | |
646 | 'labelColumn' => 'name', | |
c3fc2621 CW |
647 | ] |
648 | ], | |
649 | 'payment_instrument_id' => [ | |
e501603b TO |
650 | 'name' => 'payment_instrument_id', |
651 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 652 | 'title' => ts('Payment Method'), |
215b423e | 653 | 'description' => ts('FK to Payment Instrument'), |
522a26c9 | 654 | 'table_name' => 'civicrm_contribution_recur', |
655 | 'entity' => 'ContributionRecur', | |
656 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 657 | 'localizable' => 0, |
c3fc2621 | 658 | 'html' => [ |
e501603b | 659 | 'type' => 'Select', |
c3fc2621 CW |
660 | ], |
661 | 'pseudoconstant' => [ | |
e501603b TO |
662 | 'optionGroupName' => 'payment_instrument', |
663 | 'optionEditPath' => 'civicrm/admin/options/payment_instrument', | |
c3fc2621 CW |
664 | ] |
665 | ], | |
666 | 'contribution_campaign_id' => [ | |
e501603b TO |
667 | 'name' => 'campaign_id', |
668 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 669 | 'title' => ts('Campaign'), |
215b423e | 670 | 'description' => ts('The campaign for which this contribution has been triggered.'), |
c3fc2621 | 671 | 'import' => TRUE, |
e501603b TO |
672 | 'where' => 'civicrm_contribution_recur.campaign_id', |
673 | 'headerPattern' => '', | |
674 | 'dataPattern' => '', | |
c3fc2621 | 675 | 'export' => TRUE, |
522a26c9 | 676 | 'table_name' => 'civicrm_contribution_recur', |
677 | 'entity' => 'ContributionRecur', | |
678 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 679 | 'localizable' => 0, |
e501603b | 680 | 'FKClassName' => 'CRM_Campaign_DAO_Campaign', |
c6821d8d MWMC |
681 | 'html' => [ |
682 | 'type' => 'Select', | |
683 | ], | |
c3fc2621 | 684 | 'pseudoconstant' => [ |
e501603b TO |
685 | 'table' => 'civicrm_campaign', |
686 | 'keyColumn' => 'id', | |
687 | 'labelColumn' => 'title', | |
c3fc2621 CW |
688 | ] |
689 | ], | |
690 | 'is_email_receipt' => [ | |
e501603b TO |
691 | 'name' => 'is_email_receipt', |
692 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 693 | 'title' => ts('Send email Receipt?'), |
215b423e | 694 | 'description' => ts('if true, receipt is automatically emailed to contact on each successful payment'), |
e501603b | 695 | 'default' => '1', |
522a26c9 | 696 | 'table_name' => 'civicrm_contribution_recur', |
697 | 'entity' => 'ContributionRecur', | |
698 | 'bao' => 'CRM_Contribute_BAO_ContributionRecur', | |
6a7e5e5d | 699 | 'localizable' => 0, |
c3fc2621 | 700 | 'html' => [ |
437fafcf | 701 | 'type' => 'CheckBox', |
c3fc2621 CW |
702 | ], |
703 | ], | |
704 | ]; | |
346aaaba | 705 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 706 | } |
346aaaba | 707 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 708 | } |
c3fc2621 | 709 | |
e501603b | 710 | /** |
bd8e0b14 | 711 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
712 | * |
713 | * @return array | |
bd8e0b14 | 714 | * Array(string $name => string $uniqueName). |
e501603b | 715 | */ |
c3fc2621 | 716 | public static function &fieldKeys() { |
bd8e0b14 TO |
717 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
718 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 719 | } |
bd8e0b14 | 720 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 721 | } |
c3fc2621 | 722 | |
e501603b TO |
723 | /** |
724 | * Returns the names of this table | |
725 | * | |
726 | * @return string | |
727 | */ | |
c3fc2621 | 728 | public static function getTableName() { |
e501603b TO |
729 | return self::$_tableName; |
730 | } | |
c3fc2621 | 731 | |
e501603b TO |
732 | /** |
733 | * Returns if this table needs to be logged | |
734 | * | |
c3fc2621 | 735 | * @return bool |
e501603b | 736 | */ |
c3fc2621 | 737 | public function getLog() { |
e501603b TO |
738 | return self::$_log; |
739 | } | |
c3fc2621 | 740 | |
e501603b TO |
741 | /** |
742 | * Returns the list of fields that can be imported | |
743 | * | |
744 | * @param bool $prefix | |
745 | * | |
746 | * @return array | |
747 | */ | |
c3fc2621 CW |
748 | public static function &import($prefix = FALSE) { |
749 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_recur', $prefix, []); | |
60808919 | 750 | return $r; |
e501603b | 751 | } |
c3fc2621 | 752 | |
e501603b TO |
753 | /** |
754 | * Returns the list of fields that can be exported | |
755 | * | |
756 | * @param bool $prefix | |
757 | * | |
758 | * @return array | |
759 | */ | |
c3fc2621 CW |
760 | public static function &export($prefix = FALSE) { |
761 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_recur', $prefix, []); | |
60808919 | 762 | return $r; |
e501603b | 763 | } |
c3fc2621 | 764 | |
e7a6b91a AS |
765 | /** |
766 | * Returns the list of indices | |
c3fc2621 CW |
767 | * |
768 | * @param bool $localize | |
769 | * | |
770 | * @return array | |
e7a6b91a AS |
771 | */ |
772 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
773 | $indices = [ |
774 | 'UI_contrib_trxn_id' => [ | |
e7a6b91a | 775 | 'name' => 'UI_contrib_trxn_id', |
c3fc2621 | 776 | 'field' => [ |
e7a6b91a | 777 | 0 => 'trxn_id', |
c3fc2621 CW |
778 | ], |
779 | 'localizable' => FALSE, | |
780 | 'unique' => TRUE, | |
e7a6b91a | 781 | 'sig' => 'civicrm_contribution_recur::1::trxn_id', |
c3fc2621 CW |
782 | ], |
783 | 'UI_contrib_invoice_id' => [ | |
e7a6b91a | 784 | 'name' => 'UI_contrib_invoice_id', |
c3fc2621 | 785 | 'field' => [ |
e7a6b91a | 786 | 0 => 'invoice_id', |
c3fc2621 CW |
787 | ], |
788 | 'localizable' => FALSE, | |
789 | 'unique' => TRUE, | |
e7a6b91a | 790 | 'sig' => 'civicrm_contribution_recur::1::invoice_id', |
c3fc2621 CW |
791 | ], |
792 | 'index_contribution_status' => [ | |
e7a6b91a | 793 | 'name' => 'index_contribution_status', |
c3fc2621 | 794 | 'field' => [ |
e7a6b91a | 795 | 0 => 'contribution_status_id', |
c3fc2621 CW |
796 | ], |
797 | 'localizable' => FALSE, | |
e7a6b91a | 798 | 'sig' => 'civicrm_contribution_recur::0::contribution_status_id', |
c3fc2621 CW |
799 | ], |
800 | 'UI_contribution_recur_payment_instrument_id' => [ | |
e7a6b91a | 801 | 'name' => 'UI_contribution_recur_payment_instrument_id', |
c3fc2621 | 802 | 'field' => [ |
e7a6b91a | 803 | 0 => 'payment_instrument_id', |
c3fc2621 CW |
804 | ], |
805 | 'localizable' => FALSE, | |
e7a6b91a | 806 | 'sig' => 'civicrm_contribution_recur::0::payment_instrument_id', |
c3fc2621 CW |
807 | ], |
808 | ]; | |
e7a6b91a AS |
809 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
810 | } | |
c3fc2621 | 811 | |
e501603b | 812 | } |