Add titles and icons to entities
[civicrm-core.git] / CRM / Pledge / DAO / Pledge.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Pledge/Pledge.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:7beeffe02aa5aa08578f40547b3c61bd)
10 */
11
12 /**
13 * Database access object for the Pledge entity.
14 */
15 class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_pledge';
23
24 /**
25 * Icon associated with this entity.
26 *
27 * @var string
28 */
29 public static $_icon = 'fa-paper-plane';
30
31 /**
32 * Should CiviCRM log any modifications to this table in the civicrm_log table.
33 *
34 * @var bool
35 */
36 public static $_log = TRUE;
37
38 /**
39 * Pledge ID
40 *
41 * @var int
42 */
43 public $id;
44
45 /**
46 * Foreign key to civicrm_contact.id .
47 *
48 * @var int
49 */
50 public $contact_id;
51
52 /**
53 * FK to Financial Type
54 *
55 * @var int
56 */
57 public $financial_type_id;
58
59 /**
60 * The Contribution Page which triggered this contribution
61 *
62 * @var int
63 */
64 public $contribution_page_id;
65
66 /**
67 * Total pledged amount.
68 *
69 * @var float
70 */
71 public $amount;
72
73 /**
74 * Original amount for each of the installments.
75 *
76 * @var float
77 */
78 public $original_installment_amount;
79
80 /**
81 * 3 character string, value from config setting or input via user.
82 *
83 * @var string
84 */
85 public $currency;
86
87 /**
88 * Time units for recurrence of pledge payments.
89 *
90 * @var string
91 */
92 public $frequency_unit;
93
94 /**
95 * Number of time units for recurrence of pledge payments.
96 *
97 * @var int
98 */
99 public $frequency_interval;
100
101 /**
102 * 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.
103 *
104 * @var int
105 */
106 public $frequency_day;
107
108 /**
109 * Total number of payments to be made.
110 *
111 * @var int
112 */
113 public $installments;
114
115 /**
116 * The date the first scheduled pledge occurs.
117 *
118 * @var datetime
119 */
120 public $start_date;
121
122 /**
123 * When this pledge record was created.
124 *
125 * @var datetime
126 */
127 public $create_date;
128
129 /**
130 * When a pledge acknowledgement message was sent to the contributor.
131 *
132 * @var datetime
133 */
134 public $acknowledge_date;
135
136 /**
137 * Last updated date for this pledge record.
138 *
139 * @var datetime
140 */
141 public $modified_date;
142
143 /**
144 * Date this pledge was cancelled by contributor.
145 *
146 * @var datetime
147 */
148 public $cancel_date;
149
150 /**
151 * Date this pledge finished successfully (total pledge payments equal to or greater than pledged amount).
152 *
153 * @var datetime
154 */
155 public $end_date;
156
157 /**
158 * The maximum number of payment reminders to send for any given payment.
159 *
160 * @var int
161 */
162 public $max_reminders;
163
164 /**
165 * Send initial reminder this many days prior to the payment due date.
166 *
167 * @var int
168 */
169 public $initial_reminder_day;
170
171 /**
172 * Send additional reminder this many days after last one sent, up to maximum number of reminders.
173 *
174 * @var int
175 */
176 public $additional_reminder_day;
177
178 /**
179 * Implicit foreign key to civicrm_option_values in the pledge_status option group.
180 *
181 * @var int
182 */
183 public $status_id;
184
185 /**
186 * @var bool
187 */
188 public $is_test;
189
190 /**
191 * The campaign for which this pledge has been initiated.
192 *
193 * @var int
194 */
195 public $campaign_id;
196
197 /**
198 * Class constructor.
199 */
200 public function __construct() {
201 $this->__table = 'civicrm_pledge';
202 parent::__construct();
203 }
204
205 /**
206 * Returns localized title of this entity.
207 */
208 public static function getEntityTitle() {
209 return ts('Pledges');
210 }
211
212 /**
213 * Returns foreign keys and entity references.
214 *
215 * @return array
216 * [CRM_Core_Reference_Interface]
217 */
218 public static function getReferenceColumns() {
219 if (!isset(Civi::$statics[__CLASS__]['links'])) {
220 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
221 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
222 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
223 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_page_id', 'civicrm_contribution_page', 'id');
224 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
225 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
226 }
227 return Civi::$statics[__CLASS__]['links'];
228 }
229
230 /**
231 * Returns all the column names of this table
232 *
233 * @return array
234 */
235 public static function &fields() {
236 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
237 Civi::$statics[__CLASS__]['fields'] = [
238 'pledge_id' => [
239 'name' => 'id',
240 'type' => CRM_Utils_Type::T_INT,
241 'title' => ts('Pledge ID'),
242 'description' => ts('Pledge ID'),
243 'required' => TRUE,
244 'import' => TRUE,
245 'where' => 'civicrm_pledge.id',
246 'export' => TRUE,
247 'table_name' => 'civicrm_pledge',
248 'entity' => 'Pledge',
249 'bao' => 'CRM_Pledge_BAO_Pledge',
250 'localizable' => 0,
251 ],
252 'pledge_contact_id' => [
253 'name' => 'contact_id',
254 'type' => CRM_Utils_Type::T_INT,
255 'title' => ts('Contact ID'),
256 'description' => ts('Foreign key to civicrm_contact.id .'),
257 'required' => TRUE,
258 'import' => TRUE,
259 'where' => 'civicrm_pledge.contact_id',
260 'export' => TRUE,
261 'table_name' => 'civicrm_pledge',
262 'entity' => 'Pledge',
263 'bao' => 'CRM_Pledge_BAO_Pledge',
264 'localizable' => 0,
265 'FKClassName' => 'CRM_Contact_DAO_Contact',
266 'html' => [
267 'type' => 'EntityRef',
268 ],
269 ],
270 'pledge_financial_type_id' => [
271 'name' => 'financial_type_id',
272 'type' => CRM_Utils_Type::T_INT,
273 'title' => ts('Type'),
274 'description' => ts('FK to Financial Type'),
275 'where' => 'civicrm_pledge.financial_type_id',
276 'table_name' => 'civicrm_pledge',
277 'entity' => 'Pledge',
278 'bao' => 'CRM_Pledge_BAO_Pledge',
279 'localizable' => 0,
280 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
281 'html' => [
282 'type' => 'Select',
283 ],
284 'pseudoconstant' => [
285 'table' => 'civicrm_financial_type',
286 'keyColumn' => 'id',
287 'labelColumn' => 'name',
288 ],
289 ],
290 'pledge_contribution_page_id' => [
291 'name' => 'contribution_page_id',
292 'type' => CRM_Utils_Type::T_INT,
293 'title' => ts('Pledge Contribution Page'),
294 'description' => ts('The Contribution Page which triggered this contribution'),
295 'where' => 'civicrm_pledge.contribution_page_id',
296 'table_name' => 'civicrm_pledge',
297 'entity' => 'Pledge',
298 'bao' => 'CRM_Pledge_BAO_Pledge',
299 'localizable' => 0,
300 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage',
301 ],
302 'pledge_amount' => [
303 'name' => 'amount',
304 'type' => CRM_Utils_Type::T_MONEY,
305 'title' => ts('Total Pledged'),
306 'description' => ts('Total pledged amount.'),
307 'required' => TRUE,
308 'precision' => [
309 20,
310 2,
311 ],
312 'import' => TRUE,
313 'where' => 'civicrm_pledge.amount',
314 'export' => TRUE,
315 'table_name' => 'civicrm_pledge',
316 'entity' => 'Pledge',
317 'bao' => 'CRM_Pledge_BAO_Pledge',
318 'localizable' => 0,
319 'html' => [
320 'type' => 'Text',
321 ],
322 ],
323 'pledge_original_installment_amount' => [
324 'name' => 'original_installment_amount',
325 'type' => CRM_Utils_Type::T_MONEY,
326 'title' => ts('Original Installment Amount'),
327 'description' => ts('Original amount for each of the installments.'),
328 'required' => TRUE,
329 'precision' => [
330 20,
331 2,
332 ],
333 'where' => 'civicrm_pledge.original_installment_amount',
334 'export' => TRUE,
335 'table_name' => 'civicrm_pledge',
336 'entity' => 'Pledge',
337 'bao' => 'CRM_Pledge_BAO_Pledge',
338 'localizable' => 0,
339 'html' => [
340 'type' => 'Text',
341 ],
342 ],
343 'currency' => [
344 'name' => 'currency',
345 'type' => CRM_Utils_Type::T_STRING,
346 'title' => ts('Pledge Currency'),
347 'description' => ts('3 character string, value from config setting or input via user.'),
348 'maxlength' => 3,
349 'size' => CRM_Utils_Type::FOUR,
350 'where' => 'civicrm_pledge.currency',
351 'default' => 'NULL',
352 'table_name' => 'civicrm_pledge',
353 'entity' => 'Pledge',
354 'bao' => 'CRM_Pledge_BAO_Pledge',
355 'localizable' => 0,
356 'html' => [
357 'type' => 'Select',
358 ],
359 'pseudoconstant' => [
360 'table' => 'civicrm_currency',
361 'keyColumn' => 'name',
362 'labelColumn' => 'full_name',
363 'nameColumn' => 'name',
364 'abbrColumn' => 'symbol',
365 ],
366 ],
367 'pledge_frequency_unit' => [
368 'name' => 'frequency_unit',
369 'type' => CRM_Utils_Type::T_STRING,
370 'title' => ts('Pledge Frequency Unit'),
371 'description' => ts('Time units for recurrence of pledge payments.'),
372 'maxlength' => 8,
373 'size' => CRM_Utils_Type::EIGHT,
374 'where' => 'civicrm_pledge.frequency_unit',
375 'default' => 'month',
376 'table_name' => 'civicrm_pledge',
377 'entity' => 'Pledge',
378 'bao' => 'CRM_Pledge_BAO_Pledge',
379 'localizable' => 0,
380 'html' => [
381 'type' => 'Select',
382 ],
383 'pseudoconstant' => [
384 'optionGroupName' => 'recur_frequency_units',
385 'keyColumn' => 'name',
386 'optionEditPath' => 'civicrm/admin/options/recur_frequency_units',
387 ],
388 ],
389 'pledge_frequency_interval' => [
390 'name' => 'frequency_interval',
391 'type' => CRM_Utils_Type::T_INT,
392 'title' => ts('Pledge Frequency Interval'),
393 'description' => ts('Number of time units for recurrence of pledge payments.'),
394 'required' => TRUE,
395 'where' => 'civicrm_pledge.frequency_interval',
396 'default' => '1',
397 'table_name' => 'civicrm_pledge',
398 'entity' => 'Pledge',
399 'bao' => 'CRM_Pledge_BAO_Pledge',
400 'localizable' => 0,
401 'html' => [
402 'type' => 'Text',
403 ],
404 ],
405 'frequency_day' => [
406 'name' => 'frequency_day',
407 'type' => CRM_Utils_Type::T_INT,
408 'title' => ts('Pledge day'),
409 'description' => ts('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.'),
410 'required' => TRUE,
411 'where' => 'civicrm_pledge.frequency_day',
412 'default' => '3',
413 'table_name' => 'civicrm_pledge',
414 'entity' => 'Pledge',
415 'bao' => 'CRM_Pledge_BAO_Pledge',
416 'localizable' => 0,
417 'html' => [
418 'type' => 'Select',
419 ],
420 ],
421 'installments' => [
422 'name' => 'installments',
423 'type' => CRM_Utils_Type::T_INT,
424 'title' => ts('Pledge Number of Installments'),
425 'description' => ts('Total number of payments to be made.'),
426 'where' => 'civicrm_pledge.installments',
427 'export' => TRUE,
428 'default' => '1',
429 'table_name' => 'civicrm_pledge',
430 'entity' => 'Pledge',
431 'bao' => 'CRM_Pledge_BAO_Pledge',
432 'localizable' => 0,
433 'html' => [
434 'type' => 'Text',
435 ],
436 ],
437 'pledge_start_date' => [
438 'name' => 'start_date',
439 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
440 'title' => ts('Pledge Start Date'),
441 'description' => ts('The date the first scheduled pledge occurs.'),
442 'required' => TRUE,
443 'where' => 'civicrm_pledge.start_date',
444 'export' => TRUE,
445 'table_name' => 'civicrm_pledge',
446 'entity' => 'Pledge',
447 'bao' => 'CRM_Pledge_BAO_Pledge',
448 'localizable' => 0,
449 'unique_title' => ts('Payments Start Date'),
450 'html' => [
451 'type' => 'Select Date',
452 ],
453 ],
454 'pledge_create_date' => [
455 'name' => 'create_date',
456 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
457 'title' => ts('Pledge Made'),
458 'description' => ts('When this pledge record was created.'),
459 'required' => TRUE,
460 'import' => TRUE,
461 'where' => 'civicrm_pledge.create_date',
462 'export' => TRUE,
463 'table_name' => 'civicrm_pledge',
464 'entity' => 'Pledge',
465 'bao' => 'CRM_Pledge_BAO_Pledge',
466 'localizable' => 0,
467 'html' => [
468 'type' => 'Select Date',
469 ],
470 ],
471 'acknowledge_date' => [
472 'name' => 'acknowledge_date',
473 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
474 'title' => ts('Pledge Acknowledged'),
475 'description' => ts('When a pledge acknowledgement message was sent to the contributor.'),
476 'where' => 'civicrm_pledge.acknowledge_date',
477 'table_name' => 'civicrm_pledge',
478 'entity' => 'Pledge',
479 'bao' => 'CRM_Pledge_BAO_Pledge',
480 'localizable' => 0,
481 'html' => [
482 'type' => 'Select Date',
483 ],
484 ],
485 'modified_date' => [
486 'name' => 'modified_date',
487 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
488 'title' => ts('Pledge Modified Date'),
489 'description' => ts('Last updated date for this pledge record.'),
490 'where' => 'civicrm_pledge.modified_date',
491 'table_name' => 'civicrm_pledge',
492 'entity' => 'Pledge',
493 'bao' => 'CRM_Pledge_BAO_Pledge',
494 'localizable' => 0,
495 ],
496 'cancel_date' => [
497 'name' => 'cancel_date',
498 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
499 'title' => ts('Pledge Cancelled Date'),
500 'description' => ts('Date this pledge was cancelled by contributor.'),
501 'where' => 'civicrm_pledge.cancel_date',
502 'table_name' => 'civicrm_pledge',
503 'entity' => 'Pledge',
504 'bao' => 'CRM_Pledge_BAO_Pledge',
505 'localizable' => 0,
506 'html' => [
507 'type' => 'Select Date',
508 ],
509 ],
510 'pledge_end_date' => [
511 'name' => 'end_date',
512 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
513 'title' => ts('Pledge End Date'),
514 'description' => ts('Date this pledge finished successfully (total pledge payments equal to or greater than pledged amount).'),
515 'where' => 'civicrm_pledge.end_date',
516 'export' => TRUE,
517 'table_name' => 'civicrm_pledge',
518 'entity' => 'Pledge',
519 'bao' => 'CRM_Pledge_BAO_Pledge',
520 'localizable' => 0,
521 'unique_title' => ts('Payments Ended Date'),
522 'html' => [
523 'type' => 'Select Date',
524 ],
525 ],
526 'max_reminders' => [
527 'name' => 'max_reminders',
528 'type' => CRM_Utils_Type::T_INT,
529 'title' => ts('Maximum Number of Reminders'),
530 'description' => ts('The maximum number of payment reminders to send for any given payment.'),
531 'where' => 'civicrm_pledge.max_reminders',
532 'default' => '1',
533 'table_name' => 'civicrm_pledge',
534 'entity' => 'Pledge',
535 'bao' => 'CRM_Pledge_BAO_Pledge',
536 'localizable' => 0,
537 'html' => [
538 'type' => 'Text',
539 ],
540 ],
541 'initial_reminder_day' => [
542 'name' => 'initial_reminder_day',
543 'type' => CRM_Utils_Type::T_INT,
544 'title' => ts('Initial Reminder Day'),
545 'description' => ts('Send initial reminder this many days prior to the payment due date.'),
546 'where' => 'civicrm_pledge.initial_reminder_day',
547 'default' => '5',
548 'table_name' => 'civicrm_pledge',
549 'entity' => 'Pledge',
550 'bao' => 'CRM_Pledge_BAO_Pledge',
551 'localizable' => 0,
552 'html' => [
553 'type' => 'Select',
554 ],
555 ],
556 'additional_reminder_day' => [
557 'name' => 'additional_reminder_day',
558 'type' => CRM_Utils_Type::T_INT,
559 'title' => ts('Additional Reminder Days'),
560 'description' => ts('Send additional reminder this many days after last one sent, up to maximum number of reminders.'),
561 'where' => 'civicrm_pledge.additional_reminder_day',
562 'default' => '5',
563 'table_name' => 'civicrm_pledge',
564 'entity' => 'Pledge',
565 'bao' => 'CRM_Pledge_BAO_Pledge',
566 'localizable' => 0,
567 'html' => [
568 'type' => 'Text',
569 ],
570 ],
571 'pledge_status_id' => [
572 'name' => 'status_id',
573 'type' => CRM_Utils_Type::T_INT,
574 'title' => ts('Pledge Status Id'),
575 'description' => ts('Implicit foreign key to civicrm_option_values in the pledge_status option group.'),
576 'import' => TRUE,
577 'where' => 'civicrm_pledge.status_id',
578 'export' => FALSE,
579 'table_name' => 'civicrm_pledge',
580 'entity' => 'Pledge',
581 'bao' => 'CRM_Pledge_BAO_Pledge',
582 'localizable' => 0,
583 'html' => [
584 'type' => 'Select',
585 ],
586 'pseudoconstant' => [
587 'optionGroupName' => 'pledge_status',
588 'optionEditPath' => 'civicrm/admin/options/pledge_status',
589 ],
590 ],
591 'pledge_is_test' => [
592 'name' => 'is_test',
593 'type' => CRM_Utils_Type::T_BOOLEAN,
594 'title' => ts('Test'),
595 'import' => TRUE,
596 'where' => 'civicrm_pledge.is_test',
597 'export' => TRUE,
598 'default' => '0',
599 'table_name' => 'civicrm_pledge',
600 'entity' => 'Pledge',
601 'bao' => 'CRM_Pledge_BAO_Pledge',
602 'localizable' => 0,
603 'html' => [
604 'type' => 'CheckBox',
605 ],
606 ],
607 'pledge_campaign_id' => [
608 'name' => 'campaign_id',
609 'type' => CRM_Utils_Type::T_INT,
610 'title' => ts('Campaign'),
611 'description' => ts('The campaign for which this pledge has been initiated.'),
612 'import' => TRUE,
613 'where' => 'civicrm_pledge.campaign_id',
614 'export' => TRUE,
615 'table_name' => 'civicrm_pledge',
616 'entity' => 'Pledge',
617 'bao' => 'CRM_Pledge_BAO_Pledge',
618 'localizable' => 0,
619 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
620 'html' => [
621 'type' => 'Select',
622 ],
623 'pseudoconstant' => [
624 'table' => 'civicrm_campaign',
625 'keyColumn' => 'id',
626 'labelColumn' => 'title',
627 ],
628 ],
629 ];
630 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
631 }
632 return Civi::$statics[__CLASS__]['fields'];
633 }
634
635 /**
636 * Return a mapping from field-name to the corresponding key (as used in fields()).
637 *
638 * @return array
639 * Array(string $name => string $uniqueName).
640 */
641 public static function &fieldKeys() {
642 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
643 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
644 }
645 return Civi::$statics[__CLASS__]['fieldKeys'];
646 }
647
648 /**
649 * Returns the names of this table
650 *
651 * @return string
652 */
653 public static function getTableName() {
654 return self::$_tableName;
655 }
656
657 /**
658 * Returns if this table needs to be logged
659 *
660 * @return bool
661 */
662 public function getLog() {
663 return self::$_log;
664 }
665
666 /**
667 * Returns the list of fields that can be imported
668 *
669 * @param bool $prefix
670 *
671 * @return array
672 */
673 public static function &import($prefix = FALSE) {
674 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge', $prefix, []);
675 return $r;
676 }
677
678 /**
679 * Returns the list of fields that can be exported
680 *
681 * @param bool $prefix
682 *
683 * @return array
684 */
685 public static function &export($prefix = FALSE) {
686 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge', $prefix, []);
687 return $r;
688 }
689
690 /**
691 * Returns the list of indices
692 *
693 * @param bool $localize
694 *
695 * @return array
696 */
697 public static function indices($localize = TRUE) {
698 $indices = [
699 'index_status' => [
700 'name' => 'index_status',
701 'field' => [
702 0 => 'status_id',
703 ],
704 'localizable' => FALSE,
705 'sig' => 'civicrm_pledge::0::status_id',
706 ],
707 ];
708 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
709 }
710
711 }