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/Event/Participant.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
33 | * (GenCodeChecksum:de2c443480109499a83d620de7f4ac04) | |
34 | */ | |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
37 | class CRM_Event_DAO_Participant extends CRM_Core_DAO { | |
38 | /** | |
39 | * static instance to hold the table name | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | static $_tableName = 'civicrm_participant'; | |
44 | /** | |
45 | * static instance to hold the field values | |
46 | * | |
47 | * @var array | |
48 | */ | |
49 | static $_fields = null; | |
50 | /** | |
51 | * static instance to hold the keys used in $_fields for each field. | |
52 | * | |
53 | * @var array | |
54 | */ | |
55 | static $_fieldKeys = null; | |
56 | /** | |
57 | * static instance to hold the FK relationships | |
58 | * | |
59 | * @var string | |
60 | */ | |
61 | static $_links = null; | |
62 | /** | |
63 | * static instance to hold the values that can | |
64 | * be imported | |
65 | * | |
66 | * @var array | |
67 | */ | |
68 | static $_import = null; | |
69 | /** | |
70 | * static instance to hold the values that can | |
71 | * be exported | |
72 | * | |
73 | * @var array | |
74 | */ | |
75 | static $_export = null; | |
76 | /** | |
77 | * static value to see if we should log any modifications to | |
78 | * this table in the civicrm_log table | |
79 | * | |
80 | * @var boolean | |
81 | */ | |
82 | static $_log = true; | |
83 | /** | |
84 | * Participant Id | |
85 | * | |
86 | * @var int unsigned | |
87 | */ | |
88 | public $id; | |
89 | /** | |
90 | * FK to Contact ID | |
91 | * | |
92 | * @var int unsigned | |
93 | */ | |
94 | public $contact_id; | |
95 | /** | |
96 | * FK to Event ID | |
97 | * | |
98 | * @var int unsigned | |
99 | */ | |
100 | public $event_id; | |
101 | /** | |
102 | * Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered. | |
103 | * | |
104 | * @var int unsigned | |
105 | */ | |
106 | public $status_id; | |
107 | /** | |
108 | * Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role. | |
109 | * | |
110 | * @var string | |
111 | */ | |
112 | public $role_id; | |
113 | /** | |
114 | * When did contact register for event? | |
115 | * | |
116 | * @var datetime | |
117 | */ | |
118 | public $register_date; | |
119 | /** | |
120 | * Source of this event registration. | |
121 | * | |
122 | * @var string | |
123 | */ | |
124 | public $source; | |
125 | /** | |
126 | * Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that | |
127 | we store the label value and not the key | |
128 | * | |
129 | * @var text | |
130 | */ | |
131 | public $fee_level; | |
132 | /** | |
133 | * | |
134 | * @var boolean | |
135 | */ | |
136 | public $is_test; | |
137 | /** | |
138 | * | |
139 | * @var boolean | |
140 | */ | |
141 | public $is_pay_later; | |
142 | /** | |
143 | * actual processor fee if known - may be 0. | |
144 | * | |
145 | * @var float | |
146 | */ | |
147 | public $fee_amount; | |
148 | /** | |
149 | * FK to Participant ID | |
150 | * | |
151 | * @var int unsigned | |
152 | */ | |
153 | public $registered_by_id; | |
154 | /** | |
155 | * FK to Discount ID | |
156 | * | |
157 | * @var int unsigned | |
158 | */ | |
159 | public $discount_id; | |
160 | /** | |
161 | * 3 character string, value derived from config setting. | |
162 | * | |
163 | * @var string | |
164 | */ | |
165 | public $fee_currency; | |
166 | /** | |
167 | * The campaign for which this participant has been registered. | |
168 | * | |
169 | * @var int unsigned | |
170 | */ | |
171 | public $campaign_id; | |
172 | /** | |
173 | * Discount Amount | |
174 | * | |
175 | * @var int unsigned | |
176 | */ | |
177 | public $discount_amount; | |
178 | /** | |
179 | * FK to civicrm_event_carts | |
180 | * | |
181 | * @var int unsigned | |
182 | */ | |
183 | public $cart_id; | |
184 | /** | |
185 | * On Waiting List | |
186 | * | |
187 | * @var int | |
188 | */ | |
189 | public $must_wait; | |
190 | /** | |
191 | * FK to Contact ID | |
192 | * | |
193 | * @var int unsigned | |
194 | */ | |
195 | public $transferred_to_contact_id; | |
196 | /** | |
197 | * class constructor | |
198 | * | |
199 | * @return civicrm_participant | |
200 | */ | |
201 | function __construct() { | |
202 | $this->__table = 'civicrm_participant'; | |
203 | parent::__construct(); | |
204 | } | |
205 | /** | |
206 | * Returns foreign keys and entity references | |
207 | * | |
208 | * @return array | |
209 | * [CRM_Core_Reference_Interface] | |
210 | */ | |
211 | static function getReferenceColumns() { | |
212 | if (!self::$_links) { | |
213 | self::$_links = static ::createReferenceColumns(__CLASS__); | |
214 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); | |
215 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_id', 'civicrm_event', 'id'); | |
216 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'status_id', 'civicrm_participant_status_type', 'id'); | |
217 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'registered_by_id', 'civicrm_participant', 'id'); | |
218 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'discount_id', 'civicrm_discount', 'id'); | |
219 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); | |
220 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'cart_id', 'civicrm_event_carts', 'id'); | |
221 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'transferred_to_contact_id', 'civicrm_contact', 'id'); | |
222 | } | |
223 | return self::$_links; | |
224 | } | |
225 | /** | |
226 | * Returns all the column names of this table | |
227 | * | |
228 | * @return array | |
229 | */ | |
230 | static function &fields() { | |
231 | if (!(self::$_fields)) { | |
232 | self::$_fields = array( | |
233 | 'participant_id' => array( | |
234 | 'name' => 'id', | |
235 | 'type' => CRM_Utils_Type::T_INT, | |
236 | 'title' => ts('Participant ID') , | |
237 | 'description' => 'Participant Id', | |
238 | 'required' => true, | |
239 | 'import' => true, | |
240 | 'where' => 'civicrm_participant.id', | |
241 | 'headerPattern' => '/(^(participant(.)?)?id$)/i', | |
242 | 'dataPattern' => '', | |
243 | 'export' => true, | |
244 | ) , | |
245 | 'participant_contact_id' => array( | |
246 | 'name' => 'contact_id', | |
247 | 'type' => CRM_Utils_Type::T_INT, | |
248 | 'title' => ts('Contact ID') , | |
249 | 'description' => 'FK to Contact ID', | |
250 | 'required' => true, | |
251 | 'import' => true, | |
252 | 'where' => 'civicrm_participant.contact_id', | |
253 | 'headerPattern' => '/contact(.?id)?/i', | |
254 | 'dataPattern' => '', | |
255 | 'export' => true, | |
256 | 'FKClassName' => 'CRM_Contact_DAO_Contact', | |
257 | ) , | |
258 | 'event_id' => array( | |
259 | 'name' => 'event_id', | |
260 | 'type' => CRM_Utils_Type::T_INT, | |
261 | 'title' => ts('Event') , | |
262 | 'description' => 'FK to Event ID', | |
263 | 'required' => true, | |
264 | 'import' => true, | |
265 | 'where' => 'civicrm_participant.event_id', | |
266 | 'headerPattern' => '/event id$/i', | |
267 | 'dataPattern' => '', | |
268 | 'export' => true, | |
269 | 'FKClassName' => 'CRM_Event_DAO_Event', | |
270 | ) , | |
271 | 'participant_status_id' => array( | |
272 | 'name' => 'status_id', | |
273 | 'type' => CRM_Utils_Type::T_INT, | |
274 | 'title' => ts('Participant Status') , | |
275 | 'description' => 'Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered.', | |
276 | 'required' => true, | |
277 | 'import' => true, | |
278 | 'where' => 'civicrm_participant.status_id', | |
279 | 'headerPattern' => '/(participant.)?(status)$/i', | |
280 | 'dataPattern' => '', | |
281 | 'export' => true, | |
282 | 'default' => '1', | |
283 | 'FKClassName' => 'CRM_Event_DAO_ParticipantStatusType', | |
284 | 'html' => array( | |
285 | 'type' => 'Select', | |
286 | ) , | |
287 | 'pseudoconstant' => array( | |
288 | 'table' => 'civicrm_participant_status_type', | |
289 | 'keyColumn' => 'id', | |
290 | 'labelColumn' => 'label', | |
291 | ) | |
292 | ) , | |
293 | 'participant_role_id' => array( | |
294 | 'name' => 'role_id', | |
295 | 'type' => CRM_Utils_Type::T_STRING, | |
296 | 'title' => ts('Participant Role') , | |
297 | 'description' => 'Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.', | |
298 | 'maxlength' => 128, | |
299 | 'size' => CRM_Utils_Type::HUGE, | |
300 | 'import' => true, | |
301 | 'where' => 'civicrm_participant.role_id', | |
302 | 'headerPattern' => '/(participant.)?(role)$/i', | |
303 | 'dataPattern' => '', | |
304 | 'export' => true, | |
305 | 'default' => 'NULL', | |
306 | 'html' => array( | |
307 | 'type' => 'Select', | |
308 | ) , | |
309 | 'pseudoconstant' => array( | |
310 | 'optionGroupName' => 'participant_role', | |
311 | 'optionEditPath' => 'civicrm/admin/options/participant_role', | |
312 | ) | |
313 | ) , | |
314 | 'participant_register_date' => array( | |
315 | 'name' => 'register_date', | |
316 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
317 | 'title' => ts('Register date') , | |
318 | 'description' => 'When did contact register for event?', | |
319 | 'import' => true, | |
320 | 'where' => 'civicrm_participant.register_date', | |
321 | 'headerPattern' => '/^(r(egister\s)?date)$/i', | |
322 | 'dataPattern' => '', | |
323 | 'export' => true, | |
324 | ) , | |
325 | 'participant_source' => array( | |
326 | 'name' => 'source', | |
327 | 'type' => CRM_Utils_Type::T_STRING, | |
328 | 'title' => ts('Participant Source') , | |
329 | 'description' => 'Source of this event registration.', | |
330 | 'maxlength' => 128, | |
331 | 'size' => CRM_Utils_Type::HUGE, | |
332 | 'import' => true, | |
333 | 'where' => 'civicrm_participant.source', | |
334 | 'headerPattern' => '/(participant.)?(source)$/i', | |
335 | 'dataPattern' => '', | |
336 | 'export' => true, | |
337 | ) , | |
338 | 'participant_fee_level' => array( | |
339 | 'name' => 'fee_level', | |
340 | 'type' => CRM_Utils_Type::T_TEXT, | |
341 | 'title' => ts('Fee level') , | |
342 | 'description' => 'Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that | |
343 | we store the label value and not the key | |
344 | ', | |
345 | 'import' => true, | |
346 | 'where' => 'civicrm_participant.fee_level', | |
347 | 'headerPattern' => '/^(f(ee\s)?level)$/i', | |
348 | 'dataPattern' => '', | |
349 | 'export' => true, | |
350 | ) , | |
351 | 'participant_is_test' => array( | |
352 | 'name' => 'is_test', | |
353 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
354 | 'title' => ts('Test') , | |
355 | 'import' => true, | |
356 | 'where' => 'civicrm_participant.is_test', | |
357 | 'headerPattern' => '', | |
358 | 'dataPattern' => '', | |
359 | 'export' => true, | |
360 | ) , | |
361 | 'participant_is_pay_later' => array( | |
362 | 'name' => 'is_pay_later', | |
363 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
364 | 'title' => ts('Is Pay Later') , | |
365 | 'import' => true, | |
366 | 'where' => 'civicrm_participant.is_pay_later', | |
367 | 'headerPattern' => '/(is.)?(pay(.)?later)$/i', | |
368 | 'dataPattern' => '', | |
369 | 'export' => true, | |
370 | ) , | |
371 | 'participant_fee_amount' => array( | |
372 | 'name' => 'fee_amount', | |
373 | 'type' => CRM_Utils_Type::T_MONEY, | |
374 | 'title' => ts('Fee Amount') , | |
375 | 'description' => 'actual processor fee if known - may be 0.', | |
376 | 'precision' => array( | |
377 | 20, | |
378 | 2 | |
379 | ) , | |
380 | 'import' => true, | |
381 | 'where' => 'civicrm_participant.fee_amount', | |
382 | 'headerPattern' => '/fee(.?am(ou)?nt)?/i', | |
383 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
384 | 'export' => true, | |
385 | ) , | |
386 | 'participant_registered_by_id' => array( | |
387 | 'name' => 'registered_by_id', | |
388 | 'type' => CRM_Utils_Type::T_INT, | |
389 | 'title' => ts('Registered By ID') , | |
390 | 'description' => 'FK to Participant ID', | |
391 | 'import' => true, | |
392 | 'where' => 'civicrm_participant.registered_by_id', | |
393 | 'headerPattern' => '', | |
394 | 'dataPattern' => '', | |
395 | 'export' => true, | |
396 | 'default' => 'NULL', | |
397 | 'FKClassName' => 'CRM_Event_DAO_Participant', | |
398 | ) , | |
399 | 'participant_discount_id' => array( | |
400 | 'name' => 'discount_id', | |
401 | 'type' => CRM_Utils_Type::T_INT, | |
402 | 'title' => ts('Discount ID') , | |
403 | 'description' => 'FK to Discount ID', | |
404 | 'default' => 'NULL', | |
405 | 'FKClassName' => 'CRM_Core_DAO_Discount', | |
406 | ) , | |
407 | 'participant_fee_currency' => array( | |
408 | 'name' => 'fee_currency', | |
409 | 'type' => CRM_Utils_Type::T_STRING, | |
410 | 'title' => ts('Fee Currency') , | |
411 | 'description' => '3 character string, value derived from config setting.', | |
412 | 'maxlength' => 3, | |
413 | 'size' => CRM_Utils_Type::FOUR, | |
414 | 'import' => true, | |
415 | 'where' => 'civicrm_participant.fee_currency', | |
416 | 'headerPattern' => '/(fee)?.?cur(rency)?/i', | |
417 | 'dataPattern' => '/^[A-Z]{3}$/i', | |
418 | 'export' => true, | |
419 | 'default' => 'NULL', | |
420 | 'html' => array( | |
421 | 'type' => 'Select', | |
422 | ) , | |
423 | 'pseudoconstant' => array( | |
424 | 'table' => 'civicrm_currency', | |
425 | 'keyColumn' => 'name', | |
426 | 'labelColumn' => 'full_name', | |
427 | 'nameColumn' => 'name', | |
428 | ) | |
429 | ) , | |
430 | 'participant_campaign_id' => array( | |
431 | 'name' => 'campaign_id', | |
432 | 'type' => CRM_Utils_Type::T_INT, | |
433 | 'title' => ts('Campaign') , | |
434 | 'description' => 'The campaign for which this participant has been registered.', | |
435 | 'import' => true, | |
436 | 'where' => 'civicrm_participant.campaign_id', | |
437 | 'headerPattern' => '', | |
438 | 'dataPattern' => '', | |
439 | 'export' => true, | |
440 | 'FKClassName' => 'CRM_Campaign_DAO_Campaign', | |
441 | 'pseudoconstant' => array( | |
442 | 'table' => 'civicrm_campaign', | |
443 | 'keyColumn' => 'id', | |
444 | 'labelColumn' => 'title', | |
445 | ) | |
446 | ) , | |
447 | 'discount_amount' => array( | |
448 | 'name' => 'discount_amount', | |
449 | 'type' => CRM_Utils_Type::T_INT, | |
450 | 'title' => ts('Discount Amount') , | |
451 | 'description' => 'Discount Amount', | |
452 | ) , | |
453 | 'cart_id' => array( | |
454 | 'name' => 'cart_id', | |
455 | 'type' => CRM_Utils_Type::T_INT, | |
456 | 'title' => ts('Event Cart ID') , | |
457 | 'description' => 'FK to civicrm_event_carts', | |
458 | 'FKClassName' => 'CRM_Event_Cart_DAO_Cart', | |
459 | ) , | |
460 | 'must_wait' => array( | |
461 | 'name' => 'must_wait', | |
462 | 'type' => CRM_Utils_Type::T_INT, | |
463 | 'title' => ts('Must Wait on List') , | |
464 | 'description' => 'On Waiting List', | |
465 | ) , | |
466 | 'transferred_to_contact_id' => array( | |
467 | 'name' => 'transferred_to_contact_id', | |
468 | 'type' => CRM_Utils_Type::T_INT, | |
469 | 'title' => ts('Transferred to Contact ID') , | |
470 | 'description' => 'FK to Contact ID', | |
471 | 'import' => true, | |
472 | 'where' => 'civicrm_participant.transferred_to_contact_id', | |
473 | 'headerPattern' => '/transfer(.?id)?/i', | |
474 | 'dataPattern' => '', | |
475 | 'export' => true, | |
476 | 'default' => 'NULL', | |
477 | 'FKClassName' => 'CRM_Contact_DAO_Contact', | |
478 | ) , | |
479 | ); | |
480 | } | |
481 | return self::$_fields; | |
482 | } | |
483 | /** | |
484 | * Returns an array containing, for each field, the arary key used for that | |
485 | * field in self::$_fields. | |
486 | * | |
487 | * @return array | |
488 | */ | |
489 | static function &fieldKeys() { | |
490 | if (!(self::$_fieldKeys)) { | |
491 | self::$_fieldKeys = array( | |
492 | 'id' => 'participant_id', | |
493 | 'contact_id' => 'participant_contact_id', | |
494 | 'event_id' => 'event_id', | |
495 | 'status_id' => 'participant_status_id', | |
496 | 'role_id' => 'participant_role_id', | |
497 | 'register_date' => 'participant_register_date', | |
498 | 'source' => 'participant_source', | |
499 | 'fee_level' => 'participant_fee_level', | |
500 | 'is_test' => 'participant_is_test', | |
501 | 'is_pay_later' => 'participant_is_pay_later', | |
502 | 'fee_amount' => 'participant_fee_amount', | |
503 | 'registered_by_id' => 'participant_registered_by_id', | |
504 | 'discount_id' => 'participant_discount_id', | |
505 | 'fee_currency' => 'participant_fee_currency', | |
506 | 'campaign_id' => 'participant_campaign_id', | |
507 | 'discount_amount' => 'discount_amount', | |
508 | 'cart_id' => 'cart_id', | |
509 | 'must_wait' => 'must_wait', | |
510 | 'transferred_to_contact_id' => 'transferred_to_contact_id', | |
511 | ); | |
512 | } | |
513 | return self::$_fieldKeys; | |
514 | } | |
515 | /** | |
516 | * Returns the names of this table | |
517 | * | |
518 | * @return string | |
519 | */ | |
520 | static function getTableName() { | |
521 | return self::$_tableName; | |
522 | } | |
523 | /** | |
524 | * Returns if this table needs to be logged | |
525 | * | |
526 | * @return boolean | |
527 | */ | |
528 | function getLog() { | |
529 | return self::$_log; | |
530 | } | |
531 | /** | |
532 | * Returns the list of fields that can be imported | |
533 | * | |
534 | * @param bool $prefix | |
535 | * | |
536 | * @return array | |
537 | */ | |
538 | static function &import($prefix = false) { | |
539 | if (!(self::$_import)) { | |
540 | self::$_import = array(); | |
541 | $fields = self::fields(); | |
542 | foreach($fields as $name => $field) { | |
543 | if (CRM_Utils_Array::value('import', $field)) { | |
544 | if ($prefix) { | |
545 | self::$_import['participant'] = & $fields[$name]; | |
546 | } else { | |
547 | self::$_import[$name] = & $fields[$name]; | |
548 | } | |
549 | } | |
550 | } | |
551 | } | |
552 | return self::$_import; | |
553 | } | |
554 | /** | |
555 | * Returns the list of fields that can be exported | |
556 | * | |
557 | * @param bool $prefix | |
558 | * | |
559 | * @return array | |
560 | */ | |
561 | static function &export($prefix = false) { | |
562 | if (!(self::$_export)) { | |
563 | self::$_export = array(); | |
564 | $fields = self::fields(); | |
565 | foreach($fields as $name => $field) { | |
566 | if (CRM_Utils_Array::value('export', $field)) { | |
567 | if ($prefix) { | |
568 | self::$_export['participant'] = & $fields[$name]; | |
569 | } else { | |
570 | self::$_export[$name] = & $fields[$name]; | |
571 | } | |
572 | } | |
573 | } | |
574 | } | |
575 | return self::$_export; | |
576 | } | |
577 | } |