Merge pull request #20115 from larssandergreen/fix-internal-anchor-URLs-in-mailings
[civicrm-core.git] / CRM / Event / DAO / Participant.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Event/Participant.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:fcaf9990a79e1ea3bd799a6ff75db893)
10 */
11
12 /**
13 * Database access object for the Participant entity.
14 */
15 class CRM_Event_DAO_Participant extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.7';
18 const COMPONENT = 'CiviEvent';
19
20 /**
21 * Static instance to hold the table name.
22 *
23 * @var string
24 */
25 public static $_tableName = 'civicrm_participant';
26
27 /**
28 * Icon associated with this entity.
29 *
30 * @var string
31 */
32 public static $_icon = 'fa-ticket';
33
34 /**
35 * Should CiviCRM log any modifications to this table in the civicrm_log table.
36 *
37 * @var bool
38 */
39 public static $_log = TRUE;
40
41 /**
42 * Participant ID
43 *
44 * @var int
45 */
46 public $id;
47
48 /**
49 * FK to Contact ID
50 *
51 * @var int
52 */
53 public $contact_id;
54
55 /**
56 * FK to Event ID
57 *
58 * @var int
59 */
60 public $event_id;
61
62 /**
63 * Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered.
64 *
65 * @var int
66 */
67 public $status_id;
68
69 /**
70 * Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.
71 *
72 * @var string
73 */
74 public $role_id;
75
76 /**
77 * When did contact register for event?
78 *
79 * @var datetime
80 */
81 public $register_date;
82
83 /**
84 * Source of this event registration.
85 *
86 * @var string
87 */
88 public $source;
89
90 /**
91 * Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
92 * we store the label value and not the key
93 *
94 * @var text
95 */
96 public $fee_level;
97
98 /**
99 * @var bool
100 */
101 public $is_test;
102
103 /**
104 * @var bool
105 */
106 public $is_pay_later;
107
108 /**
109 * actual processor fee if known - may be 0.
110 *
111 * @var float
112 */
113 public $fee_amount;
114
115 /**
116 * FK to Participant ID
117 *
118 * @var int
119 */
120 public $registered_by_id;
121
122 /**
123 * FK to Discount ID
124 *
125 * @var int
126 */
127 public $discount_id;
128
129 /**
130 * 3 character string, value derived from config setting.
131 *
132 * @var string
133 */
134 public $fee_currency;
135
136 /**
137 * The campaign for which this participant has been registered.
138 *
139 * @var int
140 */
141 public $campaign_id;
142
143 /**
144 * Discount Amount
145 *
146 * @var int
147 */
148 public $discount_amount;
149
150 /**
151 * FK to civicrm_event_carts
152 *
153 * @var int
154 */
155 public $cart_id;
156
157 /**
158 * On Waiting List
159 *
160 * @var int
161 */
162 public $must_wait;
163
164 /**
165 * FK to Contact ID
166 *
167 * @var int
168 */
169 public $transferred_to_contact_id;
170
171 /**
172 * Class constructor.
173 */
174 public function __construct() {
175 $this->__table = 'civicrm_participant';
176 parent::__construct();
177 }
178
179 /**
180 * Returns localized title of this entity.
181 *
182 * @param bool $plural
183 * Whether to return the plural version of the title.
184 */
185 public static function getEntityTitle($plural = FALSE) {
186 return $plural ? ts('Participants') : ts('Participant');
187 }
188
189 /**
190 * Returns user-friendly description of this entity.
191 *
192 * @return string
193 */
194 public static function getEntityDescription() {
195 return ts('Records of contacts\' attendance and roles in events.');
196 }
197
198 /**
199 * Returns foreign keys and entity references.
200 *
201 * @return array
202 * [CRM_Core_Reference_Interface]
203 */
204 public static function getReferenceColumns() {
205 if (!isset(Civi::$statics[__CLASS__]['links'])) {
206 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
207 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
208 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_id', 'civicrm_event', 'id');
209 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'status_id', 'civicrm_participant_status_type', 'id');
210 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'registered_by_id', 'civicrm_participant', 'id');
211 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'discount_id', 'civicrm_discount', 'id');
212 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
213 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'cart_id', 'civicrm_event_carts', 'id');
214 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'transferred_to_contact_id', 'civicrm_contact', 'id');
215 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
216 }
217 return Civi::$statics[__CLASS__]['links'];
218 }
219
220 /**
221 * Returns all the column names of this table
222 *
223 * @return array
224 */
225 public static function &fields() {
226 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
227 Civi::$statics[__CLASS__]['fields'] = [
228 'participant_id' => [
229 'name' => 'id',
230 'type' => CRM_Utils_Type::T_INT,
231 'title' => ts('Participant ID'),
232 'description' => ts('Participant ID'),
233 'required' => TRUE,
234 'import' => TRUE,
235 'where' => 'civicrm_participant.id',
236 'headerPattern' => '/(^(participant(.)?)?id$)/i',
237 'export' => TRUE,
238 'table_name' => 'civicrm_participant',
239 'entity' => 'Participant',
240 'bao' => 'CRM_Event_BAO_Participant',
241 'localizable' => 0,
242 'html' => [
243 'type' => 'Number',
244 ],
245 'readonly' => TRUE,
246 'add' => '1.7',
247 ],
248 'participant_contact_id' => [
249 'name' => 'contact_id',
250 'type' => CRM_Utils_Type::T_INT,
251 'title' => ts('Contact ID'),
252 'description' => ts('FK to Contact ID'),
253 'required' => TRUE,
254 'import' => TRUE,
255 'where' => 'civicrm_participant.contact_id',
256 'headerPattern' => '/contact(.?id)?/i',
257 'export' => TRUE,
258 'table_name' => 'civicrm_participant',
259 'entity' => 'Participant',
260 'bao' => 'CRM_Event_BAO_Participant',
261 'localizable' => 0,
262 'FKClassName' => 'CRM_Contact_DAO_Contact',
263 'html' => [
264 'label' => ts("Contact"),
265 ],
266 'add' => '1.7',
267 ],
268 'event_id' => [
269 'name' => 'event_id',
270 'type' => CRM_Utils_Type::T_INT,
271 'title' => ts('Event ID'),
272 'description' => ts('FK to Event ID'),
273 'required' => TRUE,
274 'import' => TRUE,
275 'where' => 'civicrm_participant.event_id',
276 'headerPattern' => '/event id$/i',
277 'export' => TRUE,
278 'table_name' => 'civicrm_participant',
279 'entity' => 'Participant',
280 'bao' => 'CRM_Event_BAO_Participant',
281 'localizable' => 0,
282 'FKClassName' => 'CRM_Event_DAO_Event',
283 'html' => [
284 'label' => ts("Event"),
285 ],
286 'add' => '1.7',
287 ],
288 'participant_status_id' => [
289 'name' => 'status_id',
290 'type' => CRM_Utils_Type::T_INT,
291 'title' => ts('Status ID'),
292 'description' => ts('Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered.'),
293 'required' => TRUE,
294 'import' => TRUE,
295 'where' => 'civicrm_participant.status_id',
296 'headerPattern' => '/(participant.)?(status)$/i',
297 'export' => TRUE,
298 'default' => '1',
299 'table_name' => 'civicrm_participant',
300 'entity' => 'Participant',
301 'bao' => 'CRM_Event_BAO_Participant',
302 'localizable' => 0,
303 'FKClassName' => 'CRM_Event_DAO_ParticipantStatusType',
304 'html' => [
305 'type' => 'Select',
306 'label' => ts("Status"),
307 ],
308 'pseudoconstant' => [
309 'table' => 'civicrm_participant_status_type',
310 'keyColumn' => 'id',
311 'labelColumn' => 'label',
312 ],
313 'add' => '1.7',
314 ],
315 'participant_role_id' => [
316 'name' => 'role_id',
317 'type' => CRM_Utils_Type::T_STRING,
318 'title' => ts('Participant Role'),
319 'description' => ts('Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.'),
320 'maxlength' => 128,
321 'size' => CRM_Utils_Type::HUGE,
322 'import' => TRUE,
323 'where' => 'civicrm_participant.role_id',
324 'headerPattern' => '/(participant.)?(role)$/i',
325 'export' => TRUE,
326 'default' => 'NULL',
327 'table_name' => 'civicrm_participant',
328 'entity' => 'Participant',
329 'bao' => 'CRM_Event_BAO_Participant',
330 'localizable' => 0,
331 'serialize' => self::SERIALIZE_SEPARATOR_TRIMMED,
332 'html' => [
333 'type' => 'Select',
334 ],
335 'pseudoconstant' => [
336 'optionGroupName' => 'participant_role',
337 'optionEditPath' => 'civicrm/admin/options/participant_role',
338 ],
339 'add' => '1.7',
340 ],
341 'participant_register_date' => [
342 'name' => 'register_date',
343 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
344 'title' => ts('Register date'),
345 'description' => ts('When did contact register for event?'),
346 'import' => TRUE,
347 'where' => 'civicrm_participant.register_date',
348 'headerPattern' => '/^(r(egister\s)?date)$/i',
349 'export' => TRUE,
350 'table_name' => 'civicrm_participant',
351 'entity' => 'Participant',
352 'bao' => 'CRM_Event_BAO_Participant',
353 'localizable' => 0,
354 'html' => [
355 'type' => 'Select Date',
356 'formatType' => 'activityDateTime',
357 ],
358 'add' => '1.7',
359 ],
360 'participant_source' => [
361 'name' => 'source',
362 'type' => CRM_Utils_Type::T_STRING,
363 'title' => ts('Participant Source'),
364 'description' => ts('Source of this event registration.'),
365 'maxlength' => 128,
366 'size' => CRM_Utils_Type::HUGE,
367 'import' => TRUE,
368 'where' => 'civicrm_participant.source',
369 'headerPattern' => '/(participant.)?(source)$/i',
370 'export' => TRUE,
371 'table_name' => 'civicrm_participant',
372 'entity' => 'Participant',
373 'bao' => 'CRM_Event_BAO_Participant',
374 'localizable' => 0,
375 'html' => [
376 'type' => 'Text',
377 ],
378 'add' => '1.7',
379 ],
380 'participant_fee_level' => [
381 'name' => 'fee_level',
382 'type' => CRM_Utils_Type::T_TEXT,
383 'title' => ts('Fee level'),
384 'description' => ts('Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
385 we store the label value and not the key'),
386 'import' => TRUE,
387 'where' => 'civicrm_participant.fee_level',
388 'headerPattern' => '/^(f(ee\s)?level)$/i',
389 'export' => TRUE,
390 'table_name' => 'civicrm_participant',
391 'entity' => 'Participant',
392 'bao' => 'CRM_Event_BAO_Participant',
393 'localizable' => 0,
394 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND,
395 'add' => '1.7',
396 ],
397 'participant_is_test' => [
398 'name' => 'is_test',
399 'type' => CRM_Utils_Type::T_BOOLEAN,
400 'title' => ts('Test'),
401 'import' => TRUE,
402 'where' => 'civicrm_participant.is_test',
403 'export' => TRUE,
404 'default' => '0',
405 'table_name' => 'civicrm_participant',
406 'entity' => 'Participant',
407 'bao' => 'CRM_Event_BAO_Participant',
408 'localizable' => 0,
409 'add' => '1.7',
410 ],
411 'participant_is_pay_later' => [
412 'name' => 'is_pay_later',
413 'type' => CRM_Utils_Type::T_BOOLEAN,
414 'title' => ts('Is Pay Later'),
415 'import' => TRUE,
416 'where' => 'civicrm_participant.is_pay_later',
417 'headerPattern' => '/(is.)?(pay(.)?later)$/i',
418 'export' => TRUE,
419 'default' => '0',
420 'table_name' => 'civicrm_participant',
421 'entity' => 'Participant',
422 'bao' => 'CRM_Event_BAO_Participant',
423 'localizable' => 0,
424 'add' => '2.1',
425 ],
426 'participant_fee_amount' => [
427 'name' => 'fee_amount',
428 'type' => CRM_Utils_Type::T_MONEY,
429 'title' => ts('Fee Amount'),
430 'description' => ts('actual processor fee if known - may be 0.'),
431 'precision' => [
432 20,
433 2,
434 ],
435 'import' => TRUE,
436 'where' => 'civicrm_participant.fee_amount',
437 'headerPattern' => '/fee(.?am(ou)?nt)?/i',
438 'dataPattern' => '/^\d+(\.\d{2})?$/',
439 'export' => TRUE,
440 'table_name' => 'civicrm_participant',
441 'entity' => 'Participant',
442 'bao' => 'CRM_Event_BAO_Participant',
443 'localizable' => 0,
444 'add' => '2.1',
445 ],
446 'participant_registered_by_id' => [
447 'name' => 'registered_by_id',
448 'type' => CRM_Utils_Type::T_INT,
449 'title' => ts('Registered By Participant ID'),
450 'description' => ts('FK to Participant ID'),
451 'import' => TRUE,
452 'where' => 'civicrm_participant.registered_by_id',
453 'export' => TRUE,
454 'default' => 'NULL',
455 'table_name' => 'civicrm_participant',
456 'entity' => 'Participant',
457 'bao' => 'CRM_Event_BAO_Participant',
458 'localizable' => 0,
459 'FKClassName' => 'CRM_Event_DAO_Participant',
460 'html' => [
461 'label' => ts("Registered By"),
462 ],
463 'add' => '2.1',
464 ],
465 'participant_discount_id' => [
466 'name' => 'discount_id',
467 'type' => CRM_Utils_Type::T_INT,
468 'title' => ts('Discount ID'),
469 'description' => ts('FK to Discount ID'),
470 'where' => 'civicrm_participant.discount_id',
471 'default' => 'NULL',
472 'table_name' => 'civicrm_participant',
473 'entity' => 'Participant',
474 'bao' => 'CRM_Event_BAO_Participant',
475 'localizable' => 0,
476 'FKClassName' => 'CRM_Core_DAO_Discount',
477 'html' => [
478 'label' => ts("Discount"),
479 ],
480 'add' => '2.1',
481 ],
482 'participant_fee_currency' => [
483 'name' => 'fee_currency',
484 'type' => CRM_Utils_Type::T_STRING,
485 'title' => ts('Fee Currency'),
486 'description' => ts('3 character string, value derived from config setting.'),
487 'maxlength' => 3,
488 'size' => CRM_Utils_Type::FOUR,
489 'import' => TRUE,
490 'where' => 'civicrm_participant.fee_currency',
491 'headerPattern' => '/(fee)?.?cur(rency)?/i',
492 'dataPattern' => '/^[A-Z]{3}$/i',
493 'export' => TRUE,
494 'default' => 'NULL',
495 'table_name' => 'civicrm_participant',
496 'entity' => 'Participant',
497 'bao' => 'CRM_Event_BAO_Participant',
498 'localizable' => 0,
499 'html' => [
500 'type' => 'Select',
501 ],
502 'pseudoconstant' => [
503 'table' => 'civicrm_currency',
504 'keyColumn' => 'name',
505 'labelColumn' => 'full_name',
506 'nameColumn' => 'name',
507 'abbrColumn' => 'symbol',
508 ],
509 'add' => '3.0',
510 ],
511 'participant_campaign_id' => [
512 'name' => 'campaign_id',
513 'type' => CRM_Utils_Type::T_INT,
514 'title' => ts('Campaign ID'),
515 'description' => ts('The campaign for which this participant has been registered.'),
516 'import' => TRUE,
517 'where' => 'civicrm_participant.campaign_id',
518 'export' => TRUE,
519 'table_name' => 'civicrm_participant',
520 'entity' => 'Participant',
521 'bao' => 'CRM_Event_BAO_Participant',
522 'localizable' => 0,
523 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
524 'component' => 'CiviCampaign',
525 'html' => [
526 'type' => 'EntityRef',
527 'label' => ts("Campaign"),
528 ],
529 'pseudoconstant' => [
530 'table' => 'civicrm_campaign',
531 'keyColumn' => 'id',
532 'labelColumn' => 'title',
533 'prefetch' => 'FALSE',
534 ],
535 'add' => '3.4',
536 ],
537 'discount_amount' => [
538 'name' => 'discount_amount',
539 'type' => CRM_Utils_Type::T_INT,
540 'title' => ts('Discount Amount'),
541 'description' => ts('Discount Amount'),
542 'where' => 'civicrm_participant.discount_amount',
543 'table_name' => 'civicrm_participant',
544 'entity' => 'Participant',
545 'bao' => 'CRM_Event_BAO_Participant',
546 'localizable' => 0,
547 'add' => '4.1',
548 ],
549 'cart_id' => [
550 'name' => 'cart_id',
551 'type' => CRM_Utils_Type::T_INT,
552 'title' => ts('Event Cart ID'),
553 'description' => ts('FK to civicrm_event_carts'),
554 'where' => 'civicrm_participant.cart_id',
555 'table_name' => 'civicrm_participant',
556 'entity' => 'Participant',
557 'bao' => 'CRM_Event_BAO_Participant',
558 'localizable' => 0,
559 'FKClassName' => 'CRM_Event_Cart_DAO_Cart',
560 'html' => [
561 'label' => ts("Event Cart"),
562 ],
563 'add' => '4.1',
564 ],
565 'must_wait' => [
566 'name' => 'must_wait',
567 'type' => CRM_Utils_Type::T_INT,
568 'title' => ts('Must Wait on List'),
569 'description' => ts('On Waiting List'),
570 'where' => 'civicrm_participant.must_wait',
571 'table_name' => 'civicrm_participant',
572 'entity' => 'Participant',
573 'bao' => 'CRM_Event_BAO_Participant',
574 'localizable' => 0,
575 'add' => '4.1',
576 ],
577 'transferred_to_contact_id' => [
578 'name' => 'transferred_to_contact_id',
579 'type' => CRM_Utils_Type::T_INT,
580 'title' => ts('Transferred to Contact ID'),
581 'description' => ts('FK to Contact ID'),
582 'import' => TRUE,
583 'where' => 'civicrm_participant.transferred_to_contact_id',
584 'headerPattern' => '/transfer(.?id)?/i',
585 'export' => TRUE,
586 'default' => 'NULL',
587 'table_name' => 'civicrm_participant',
588 'entity' => 'Participant',
589 'bao' => 'CRM_Event_BAO_Participant',
590 'localizable' => 0,
591 'FKClassName' => 'CRM_Contact_DAO_Contact',
592 'html' => [
593 'label' => ts("Transferred to"),
594 ],
595 'add' => '4.7',
596 ],
597 ];
598 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
599 }
600 return Civi::$statics[__CLASS__]['fields'];
601 }
602
603 /**
604 * Return a mapping from field-name to the corresponding key (as used in fields()).
605 *
606 * @return array
607 * Array(string $name => string $uniqueName).
608 */
609 public static function &fieldKeys() {
610 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
611 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
612 }
613 return Civi::$statics[__CLASS__]['fieldKeys'];
614 }
615
616 /**
617 * Returns the names of this table
618 *
619 * @return string
620 */
621 public static function getTableName() {
622 return self::$_tableName;
623 }
624
625 /**
626 * Returns if this table needs to be logged
627 *
628 * @return bool
629 */
630 public function getLog() {
631 return self::$_log;
632 }
633
634 /**
635 * Returns the list of fields that can be imported
636 *
637 * @param bool $prefix
638 *
639 * @return array
640 */
641 public static function &import($prefix = FALSE) {
642 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'participant', $prefix, []);
643 return $r;
644 }
645
646 /**
647 * Returns the list of fields that can be exported
648 *
649 * @param bool $prefix
650 *
651 * @return array
652 */
653 public static function &export($prefix = FALSE) {
654 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'participant', $prefix, []);
655 return $r;
656 }
657
658 /**
659 * Returns the list of indices
660 *
661 * @param bool $localize
662 *
663 * @return array
664 */
665 public static function indices($localize = TRUE) {
666 $indices = [
667 'index_status_id' => [
668 'name' => 'index_status_id',
669 'field' => [
670 0 => 'status_id',
671 ],
672 'localizable' => FALSE,
673 'sig' => 'civicrm_participant::0::status_id',
674 ],
675 'index_role_id' => [
676 'name' => 'index_role_id',
677 'field' => [
678 0 => 'role_id',
679 ],
680 'localizable' => FALSE,
681 'sig' => 'civicrm_participant::0::role_id',
682 ],
683 ];
684 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
685 }
686
687 }