Commit | Line | Data |
---|---|---|
e501603b TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
6 | | Copyright CiviCRM LLC (c) 2004-2016 | | |
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 | |
29 | * @copyright CiviCRM LLC (c) 2004-2016 | |
30 | * | |
31 | * Generated from xml/schema/CRM/Pledge/Pledge.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
437fafcf | 33 | * (GenCodeChecksum:6aa082b07bbcb93e0a7c5e9048643c91) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
37 | class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO { | |
38 | /** | |
39 | * static instance to hold the table name | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | static $_tableName = 'civicrm_pledge'; | |
e501603b TO |
44 | /** |
45 | * static value to see if we should log any modifications to | |
46 | * this table in the civicrm_log table | |
47 | * | |
48 | * @var boolean | |
49 | */ | |
50 | static $_log = true; | |
51 | /** | |
52 | * Pledge ID | |
53 | * | |
54 | * @var int unsigned | |
55 | */ | |
56 | public $id; | |
57 | /** | |
58 | * Foreign key to civicrm_contact.id . | |
59 | * | |
60 | * @var int unsigned | |
61 | */ | |
62 | public $contact_id; | |
63 | /** | |
64 | * FK to Financial Type | |
65 | * | |
66 | * @var int unsigned | |
67 | */ | |
68 | public $financial_type_id; | |
69 | /** | |
70 | * The Contribution Page which triggered this contribution | |
71 | * | |
72 | * @var int unsigned | |
73 | */ | |
74 | public $contribution_page_id; | |
75 | /** | |
76 | * Total pledged amount. | |
77 | * | |
78 | * @var float | |
79 | */ | |
80 | public $amount; | |
81 | /** | |
82 | * Original amount for each of the installments. | |
83 | * | |
84 | * @var float | |
85 | */ | |
86 | public $original_installment_amount; | |
87 | /** | |
88 | * 3 character string, value from config setting or input via user. | |
89 | * | |
90 | * @var string | |
91 | */ | |
92 | public $currency; | |
93 | /** | |
94 | * Time units for recurrence of pledge payments. | |
95 | * | |
96 | * @var string | |
97 | */ | |
98 | public $frequency_unit; | |
99 | /** | |
100 | * Number of time units for recurrence of pledge payments. | |
101 | * | |
102 | * @var int unsigned | |
103 | */ | |
104 | public $frequency_interval; | |
105 | /** | |
106 | * Day in the period when the pledge payment is due e.g. 1st of month, 15th etc. Use this to set the scheduled dates for pledge payments. | |
107 | * | |
108 | * @var int unsigned | |
109 | */ | |
110 | public $frequency_day; | |
111 | /** | |
112 | * Total number of payments to be made. | |
113 | * | |
114 | * @var int unsigned | |
115 | */ | |
116 | public $installments; | |
117 | /** | |
118 | * The date the first scheduled pledge occurs. | |
119 | * | |
120 | * @var datetime | |
121 | */ | |
122 | public $start_date; | |
123 | /** | |
124 | * When this pledge record was created. | |
125 | * | |
126 | * @var datetime | |
127 | */ | |
128 | public $create_date; | |
129 | /** | |
130 | * When a pledge acknowledgement message was sent to the contributor. | |
131 | * | |
132 | * @var datetime | |
133 | */ | |
134 | public $acknowledge_date; | |
135 | /** | |
136 | * Last updated date for this pledge record. | |
137 | * | |
138 | * @var datetime | |
139 | */ | |
140 | public $modified_date; | |
141 | /** | |
142 | * Date this pledge was cancelled by contributor. | |
143 | * | |
144 | * @var datetime | |
145 | */ | |
146 | public $cancel_date; | |
147 | /** | |
148 | * Date this pledge finished successfully (total pledge payments equal to or greater than pledged amount). | |
149 | * | |
150 | * @var datetime | |
151 | */ | |
152 | public $end_date; | |
153 | /** | |
154 | * The maximum number of payment reminders to send for any given payment. | |
155 | * | |
156 | * @var int unsigned | |
157 | */ | |
158 | public $max_reminders; | |
159 | /** | |
160 | * Send initial reminder this many days prior to the payment due date. | |
161 | * | |
162 | * @var int unsigned | |
163 | */ | |
164 | public $initial_reminder_day; | |
165 | /** | |
166 | * Send additional reminder this many days after last one sent, up to maximum number of reminders. | |
167 | * | |
168 | * @var int unsigned | |
169 | */ | |
170 | public $additional_reminder_day; | |
171 | /** | |
172 | * Implicit foreign key to civicrm_option_values in the contribution_status option group. | |
173 | * | |
174 | * @var int unsigned | |
175 | */ | |
176 | public $status_id; | |
177 | /** | |
178 | * | |
179 | * @var boolean | |
180 | */ | |
181 | public $is_test; | |
182 | /** | |
183 | * The campaign for which this pledge has been initiated. | |
184 | * | |
185 | * @var int unsigned | |
186 | */ | |
187 | public $campaign_id; | |
188 | /** | |
189 | * class constructor | |
190 | * | |
191 | * @return civicrm_pledge | |
192 | */ | |
193 | function __construct() { | |
194 | $this->__table = 'civicrm_pledge'; | |
195 | parent::__construct(); | |
196 | } | |
197 | /** | |
198 | * Returns foreign keys and entity references | |
199 | * | |
200 | * @return array | |
201 | * [CRM_Core_Reference_Interface] | |
202 | */ | |
203 | static function getReferenceColumns() { | |
346aaaba TO |
204 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
205 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
206 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); | |
207 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); | |
208 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_page_id', 'civicrm_contribution_page', 'id'); | |
209 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); | |
210 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); | |
e501603b | 211 | } |
346aaaba | 212 | return Civi::$statics[__CLASS__]['links']; |
e501603b TO |
213 | } |
214 | /** | |
215 | * Returns all the column names of this table | |
216 | * | |
217 | * @return array | |
218 | */ | |
219 | static function &fields() { | |
346aaaba TO |
220 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
221 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
222 | 'pledge_id' => array( |
223 | 'name' => 'id', | |
224 | 'type' => CRM_Utils_Type::T_INT, | |
225 | 'title' => ts('Pledge ID') , | |
226 | 'description' => 'Pledge ID', | |
227 | 'required' => true, | |
228 | 'import' => true, | |
229 | 'where' => 'civicrm_pledge.id', | |
230 | 'headerPattern' => '', | |
231 | 'dataPattern' => '', | |
232 | 'export' => true, | |
233 | ) , | |
234 | 'pledge_contact_id' => array( | |
235 | 'name' => 'contact_id', | |
236 | 'type' => CRM_Utils_Type::T_INT, | |
237 | 'title' => ts('Contact ID') , | |
238 | 'description' => 'Foreign key to civicrm_contact.id .', | |
239 | 'required' => true, | |
240 | 'import' => true, | |
241 | 'where' => 'civicrm_pledge.contact_id', | |
242 | 'headerPattern' => '', | |
243 | 'dataPattern' => '', | |
244 | 'export' => true, | |
245 | 'FKClassName' => 'CRM_Contact_DAO_Contact', | |
246 | 'html' => array( | |
247 | 'type' => 'EntityRef', | |
248 | ) , | |
249 | ) , | |
250 | 'pledge_financial_type_id' => array( | |
251 | 'name' => 'financial_type_id', | |
252 | 'type' => CRM_Utils_Type::T_INT, | |
253 | 'title' => ts('Type') , | |
254 | 'description' => 'FK to Financial Type', | |
255 | 'FKClassName' => 'CRM_Financial_DAO_FinancialType', | |
256 | 'html' => array( | |
257 | 'type' => 'Select', | |
258 | ) , | |
259 | 'pseudoconstant' => array( | |
260 | 'table' => 'civicrm_financial_type', | |
261 | 'keyColumn' => 'id', | |
262 | 'labelColumn' => 'name', | |
263 | ) | |
264 | ) , | |
265 | 'pledge_contribution_page_id' => array( | |
266 | 'name' => 'contribution_page_id', | |
267 | 'type' => CRM_Utils_Type::T_INT, | |
268 | 'title' => ts('Pledge Contribution Page') , | |
269 | 'description' => 'The Contribution Page which triggered this contribution', | |
270 | 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage', | |
271 | ) , | |
272 | 'pledge_amount' => array( | |
273 | 'name' => 'amount', | |
274 | 'type' => CRM_Utils_Type::T_MONEY, | |
275 | 'title' => ts('Total Pledged') , | |
276 | 'description' => 'Total pledged amount.', | |
277 | 'required' => true, | |
278 | 'precision' => array( | |
279 | 20, | |
280 | 2 | |
281 | ) , | |
282 | 'import' => true, | |
283 | 'where' => 'civicrm_pledge.amount', | |
284 | 'headerPattern' => '', | |
285 | 'dataPattern' => '', | |
286 | 'export' => true, | |
287 | 'html' => array( | |
288 | 'type' => 'Text', | |
289 | ) , | |
290 | ) , | |
291 | 'pledge_original_installment_amount' => array( | |
292 | 'name' => 'original_installment_amount', | |
293 | 'type' => CRM_Utils_Type::T_MONEY, | |
294 | 'title' => ts('Original Installment Amount') , | |
295 | 'description' => 'Original amount for each of the installments.', | |
296 | 'required' => true, | |
297 | 'precision' => array( | |
298 | 20, | |
299 | 2 | |
300 | ) , | |
301 | 'html' => array( | |
302 | 'type' => 'Text', | |
303 | ) , | |
304 | ) , | |
305 | 'currency' => array( | |
306 | 'name' => 'currency', | |
307 | 'type' => CRM_Utils_Type::T_STRING, | |
308 | 'title' => ts('Pledge Currency') , | |
309 | 'description' => '3 character string, value from config setting or input via user.', | |
310 | 'maxlength' => 3, | |
311 | 'size' => CRM_Utils_Type::FOUR, | |
312 | 'default' => 'NULL', | |
313 | 'html' => array( | |
314 | 'type' => 'Select', | |
315 | ) , | |
316 | 'pseudoconstant' => array( | |
317 | 'table' => 'civicrm_currency', | |
318 | 'keyColumn' => 'name', | |
319 | 'labelColumn' => 'full_name', | |
320 | 'nameColumn' => 'name', | |
321 | ) | |
322 | ) , | |
323 | 'pledge_frequency_unit' => array( | |
324 | 'name' => 'frequency_unit', | |
325 | 'type' => CRM_Utils_Type::T_STRING, | |
326 | 'title' => ts('Pledge Frequency Unit') , | |
327 | 'description' => 'Time units for recurrence of pledge payments.', | |
328 | 'maxlength' => 8, | |
329 | 'size' => CRM_Utils_Type::EIGHT, | |
330 | 'default' => 'month', | |
331 | 'html' => array( | |
332 | 'type' => 'Select', | |
333 | ) , | |
334 | 'pseudoconstant' => array( | |
335 | 'optionGroupName' => 'recur_frequency_units', | |
336 | 'keyColumn' => 'name', | |
337 | 'optionEditPath' => 'civicrm/admin/options/recur_frequency_units', | |
338 | ) | |
339 | ) , | |
340 | 'pledge_frequency_interval' => array( | |
341 | 'name' => 'frequency_interval', | |
342 | 'type' => CRM_Utils_Type::T_INT, | |
343 | 'title' => ts('Pledge Frequency Interval') , | |
344 | 'description' => 'Number of time units for recurrence of pledge payments.', | |
345 | 'required' => true, | |
346 | 'default' => '1', | |
347 | 'html' => array( | |
348 | 'type' => 'Text', | |
349 | ) , | |
350 | ) , | |
351 | 'frequency_day' => array( | |
352 | 'name' => 'frequency_day', | |
353 | 'type' => CRM_Utils_Type::T_INT, | |
354 | 'title' => ts('Pledge day') , | |
355 | 'description' => 'Day in the period when the pledge payment is due e.g. 1st of month, 15th etc. Use this to set the scheduled dates for pledge payments.', | |
356 | 'required' => true, | |
357 | 'default' => '3', | |
358 | 'html' => array( | |
359 | 'type' => 'Select', | |
360 | ) , | |
361 | ) , | |
362 | 'installments' => array( | |
363 | 'name' => 'installments', | |
364 | 'type' => CRM_Utils_Type::T_INT, | |
365 | 'title' => ts('Pledge Number of Installments') , | |
366 | 'description' => 'Total number of payments to be made.', | |
367 | 'default' => '1', | |
368 | 'html' => array( | |
369 | 'type' => 'Text', | |
370 | ) , | |
371 | ) , | |
372 | 'start_date' => array( | |
373 | 'name' => 'start_date', | |
374 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
375 | 'title' => ts('Pledge Start Date') , | |
376 | 'description' => 'The date the first scheduled pledge occurs.', | |
377 | 'required' => true, | |
378 | 'html' => array( | |
379 | 'type' => 'Select Date', | |
380 | ) , | |
381 | ) , | |
382 | 'pledge_create_date' => array( | |
383 | 'name' => 'create_date', | |
384 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
385 | 'title' => ts('Pledge Made') , | |
386 | 'description' => 'When this pledge record was created.', | |
387 | 'required' => true, | |
388 | 'import' => true, | |
389 | 'where' => 'civicrm_pledge.create_date', | |
390 | 'headerPattern' => '', | |
391 | 'dataPattern' => '', | |
392 | 'export' => true, | |
393 | 'html' => array( | |
394 | 'type' => 'Select Date', | |
395 | ) , | |
396 | ) , | |
397 | 'acknowledge_date' => array( | |
398 | 'name' => 'acknowledge_date', | |
399 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
400 | 'title' => ts('Pledge Acknowledged') , | |
401 | 'description' => 'When a pledge acknowledgement message was sent to the contributor.', | |
402 | 'html' => array( | |
403 | 'type' => 'Select Date', | |
404 | ) , | |
405 | ) , | |
406 | 'modified_date' => array( | |
407 | 'name' => 'modified_date', | |
408 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
409 | 'title' => ts('Pledge Modified Date') , | |
410 | 'description' => 'Last updated date for this pledge record.', | |
411 | ) , | |
412 | 'cancel_date' => array( | |
413 | 'name' => 'cancel_date', | |
414 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
415 | 'title' => ts('Pledge Cancelled Date') , | |
416 | 'description' => 'Date this pledge was cancelled by contributor.', | |
417 | 'html' => array( | |
418 | 'type' => 'Select Date', | |
419 | ) , | |
420 | ) , | |
421 | 'end_date' => array( | |
422 | 'name' => 'end_date', | |
423 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
424 | 'title' => ts('Pledge End Date') , | |
425 | 'description' => 'Date this pledge finished successfully (total pledge payments equal to or greater than pledged amount).', | |
426 | 'html' => array( | |
427 | 'type' => 'Select Date', | |
428 | ) , | |
429 | ) , | |
430 | 'max_reminders' => array( | |
431 | 'name' => 'max_reminders', | |
432 | 'type' => CRM_Utils_Type::T_INT, | |
433 | 'title' => ts('Maximum Number of Reminders') , | |
434 | 'description' => 'The maximum number of payment reminders to send for any given payment.', | |
435 | 'default' => '1', | |
436 | 'html' => array( | |
437 | 'type' => 'Text', | |
438 | ) , | |
439 | ) , | |
440 | 'initial_reminder_day' => array( | |
441 | 'name' => 'initial_reminder_day', | |
442 | 'type' => CRM_Utils_Type::T_INT, | |
443 | 'title' => ts('Initial Reminder Day') , | |
444 | 'description' => 'Send initial reminder this many days prior to the payment due date.', | |
445 | 'default' => '5', | |
446 | 'html' => array( | |
447 | 'type' => 'Select', | |
448 | ) , | |
449 | ) , | |
450 | 'additional_reminder_day' => array( | |
451 | 'name' => 'additional_reminder_day', | |
452 | 'type' => CRM_Utils_Type::T_INT, | |
453 | 'title' => ts('Additional Reminder Days') , | |
454 | 'description' => 'Send additional reminder this many days after last one sent, up to maximum number of reminders.', | |
455 | 'default' => '5', | |
456 | 'html' => array( | |
457 | 'type' => 'Text', | |
458 | ) , | |
459 | ) , | |
460 | 'pledge_status_id' => array( | |
461 | 'name' => 'status_id', | |
462 | 'type' => CRM_Utils_Type::T_INT, | |
463 | 'title' => ts('Pledge Status Id') , | |
464 | 'description' => 'Implicit foreign key to civicrm_option_values in the contribution_status option group.', | |
465 | 'import' => true, | |
466 | 'where' => 'civicrm_pledge.status_id', | |
467 | 'headerPattern' => '', | |
468 | 'dataPattern' => '', | |
469 | 'export' => false, | |
470 | 'pseudoconstant' => array( | |
471 | 'optionGroupName' => 'contribution_status', | |
472 | 'optionEditPath' => 'civicrm/admin/options/contribution_status', | |
473 | ) | |
474 | ) , | |
475 | 'pledge_is_test' => array( | |
476 | 'name' => 'is_test', | |
477 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
478 | 'title' => ts('Test') , | |
479 | 'import' => true, | |
480 | 'where' => 'civicrm_pledge.is_test', | |
481 | 'headerPattern' => '', | |
482 | 'dataPattern' => '', | |
483 | 'export' => true, | |
484 | 'html' => array( | |
485 | 'type' => 'CheckBox', | |
486 | ) , | |
487 | ) , | |
488 | 'pledge_campaign_id' => array( | |
489 | 'name' => 'campaign_id', | |
490 | 'type' => CRM_Utils_Type::T_INT, | |
491 | 'title' => ts('Campaign') , | |
492 | 'description' => 'The campaign for which this pledge has been initiated.', | |
493 | 'import' => true, | |
494 | 'where' => 'civicrm_pledge.campaign_id', | |
495 | 'headerPattern' => '', | |
496 | 'dataPattern' => '', | |
497 | 'export' => true, | |
498 | 'FKClassName' => 'CRM_Campaign_DAO_Campaign', | |
499 | 'html' => array( | |
500 | 'type' => 'Select', | |
501 | ) , | |
502 | 'pseudoconstant' => array( | |
503 | 'table' => 'civicrm_campaign', | |
504 | 'keyColumn' => 'id', | |
505 | 'labelColumn' => 'title', | |
506 | ) | |
507 | ) , | |
508 | ); | |
346aaaba | 509 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 510 | } |
346aaaba | 511 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
512 | } |
513 | /** | |
bd8e0b14 | 514 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
515 | * |
516 | * @return array | |
bd8e0b14 | 517 | * Array(string $name => string $uniqueName). |
e501603b TO |
518 | */ |
519 | static function &fieldKeys() { | |
bd8e0b14 TO |
520 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
521 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 522 | } |
bd8e0b14 | 523 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
524 | } |
525 | /** | |
526 | * Returns the names of this table | |
527 | * | |
528 | * @return string | |
529 | */ | |
530 | static function getTableName() { | |
531 | return self::$_tableName; | |
532 | } | |
533 | /** | |
534 | * Returns if this table needs to be logged | |
535 | * | |
536 | * @return boolean | |
537 | */ | |
538 | function getLog() { | |
539 | return self::$_log; | |
540 | } | |
541 | /** | |
542 | * Returns the list of fields that can be imported | |
543 | * | |
544 | * @param bool $prefix | |
545 | * | |
546 | * @return array | |
547 | */ | |
548 | static function &import($prefix = false) { | |
60808919 TO |
549 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge', $prefix, array()); |
550 | return $r; | |
e501603b TO |
551 | } |
552 | /** | |
553 | * Returns the list of fields that can be exported | |
554 | * | |
555 | * @param bool $prefix | |
556 | * | |
557 | * @return array | |
558 | */ | |
559 | static function &export($prefix = false) { | |
60808919 TO |
560 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge', $prefix, array()); |
561 | return $r; | |
e501603b TO |
562 | } |
563 | } |