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