Fix comments on DAO files
[civicrm-core.git] / CRM / Pledge / DAO / Pledge.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
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-2017
30 *
31 * Generated from xml/schema/CRM/Pledge/Pledge.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:6aa082b07bbcb93e0a7c5e9048643c91)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Pledge_DAO_Pledge constructor.
39 */
40 class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_pledge';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
49 *
50 * @var boolean
51 */
52 static $_log = true;
53 /**
54 * Pledge 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 * FK to Financial Type
67 *
68 * @var int unsigned
69 */
70 public $financial_type_id;
71 /**
72 * The Contribution Page which triggered this contribution
73 *
74 * @var int unsigned
75 */
76 public $contribution_page_id;
77 /**
78 * Total pledged amount.
79 *
80 * @var float
81 */
82 public $amount;
83 /**
84 * Original amount for each of the installments.
85 *
86 * @var float
87 */
88 public $original_installment_amount;
89 /**
90 * 3 character string, value from config setting or input via user.
91 *
92 * @var string
93 */
94 public $currency;
95 /**
96 * Time units for recurrence of pledge payments.
97 *
98 * @var string
99 */
100 public $frequency_unit;
101 /**
102 * Number of time units for recurrence of pledge payments.
103 *
104 * @var int unsigned
105 */
106 public $frequency_interval;
107 /**
108 * 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.
109 *
110 * @var int unsigned
111 */
112 public $frequency_day;
113 /**
114 * Total number of payments to be made.
115 *
116 * @var int unsigned
117 */
118 public $installments;
119 /**
120 * The date the first scheduled pledge occurs.
121 *
122 * @var datetime
123 */
124 public $start_date;
125 /**
126 * When this pledge record was created.
127 *
128 * @var datetime
129 */
130 public $create_date;
131 /**
132 * When a pledge acknowledgement message was sent to the contributor.
133 *
134 * @var datetime
135 */
136 public $acknowledge_date;
137 /**
138 * Last updated date for this pledge record.
139 *
140 * @var datetime
141 */
142 public $modified_date;
143 /**
144 * Date this pledge was cancelled by contributor.
145 *
146 * @var datetime
147 */
148 public $cancel_date;
149 /**
150 * Date this pledge finished successfully (total pledge payments equal to or greater than pledged amount).
151 *
152 * @var datetime
153 */
154 public $end_date;
155 /**
156 * The maximum number of payment reminders to send for any given payment.
157 *
158 * @var int unsigned
159 */
160 public $max_reminders;
161 /**
162 * Send initial reminder this many days prior to the payment due date.
163 *
164 * @var int unsigned
165 */
166 public $initial_reminder_day;
167 /**
168 * Send additional reminder this many days after last one sent, up to maximum number of reminders.
169 *
170 * @var int unsigned
171 */
172 public $additional_reminder_day;
173 /**
174 * Implicit foreign key to civicrm_option_values in the contribution_status option group.
175 *
176 * @var int unsigned
177 */
178 public $status_id;
179 /**
180 *
181 * @var boolean
182 */
183 public $is_test;
184 /**
185 * The campaign for which this pledge has been initiated.
186 *
187 * @var int unsigned
188 */
189 public $campaign_id;
190 /**
191 * Class constructor.
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() {
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']);
211 }
212 return Civi::$statics[__CLASS__]['links'];
213 }
214 /**
215 * Returns all the column names of this table
216 *
217 * @return array
218 */
219 static function &fields() {
220 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
221 Civi::$statics[__CLASS__]['fields'] = array(
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 );
509 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
510 }
511 return Civi::$statics[__CLASS__]['fields'];
512 }
513 /**
514 * Return a mapping from field-name to the corresponding key (as used in fields()).
515 *
516 * @return array
517 * Array(string $name => string $uniqueName).
518 */
519 static function &fieldKeys() {
520 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
521 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
522 }
523 return Civi::$statics[__CLASS__]['fieldKeys'];
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) {
549 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge', $prefix, array());
550 return $r;
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) {
560 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge', $prefix, array());
561 return $r;
562 }
563 }