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