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