Merge pull request #22138 from eileenmcnaughton/cust_edit
[civicrm-core.git] / CRM / Core / DAO / UFField.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/UFField.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:47f3fbbbd8d816a9cfb9f7fb4e7d5dc4)
10 */
11
12 /**
13 * Database access object for the UFField entity.
14 */
15 class CRM_Core_DAO_UFField extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.1';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_uf_field';
25
26 /**
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = TRUE;
32
33 /**
34 * Unique table ID
35 *
36 * @var int
37 */
38 public $id;
39
40 /**
41 * Which form does this field belong to.
42 *
43 * @var int
44 */
45 public $uf_group_id;
46
47 /**
48 * Name for CiviCRM field which is being exposed for sharing.
49 *
50 * @var string
51 */
52 public $field_name;
53
54 /**
55 * Is this field currently shareable? If false, hide the field for all sharing contexts.
56 *
57 * @var bool
58 */
59 public $is_active;
60
61 /**
62 * the field is view only and not editable in user forms.
63 *
64 * @var bool
65 */
66 public $is_view;
67
68 /**
69 * Is this field required when included in a user or registration form?
70 *
71 * @var bool
72 */
73 public $is_required;
74
75 /**
76 * Controls field display order when user framework fields are displayed in registration and account editing forms.
77 *
78 * @var int
79 */
80 public $weight;
81
82 /**
83 * Description and/or help text to display after this field.
84 *
85 * @var text
86 */
87 public $help_post;
88
89 /**
90 * Description and/or help text to display before this field.
91 *
92 * @var text
93 */
94 public $help_pre;
95
96 /**
97 * In what context(s) is this field visible.
98 *
99 * @var string
100 */
101 public $visibility;
102
103 /**
104 * Is this field included as a column in the selector table?
105 *
106 * @var bool
107 */
108 public $in_selector;
109
110 /**
111 * Is this field included search form of profile?
112 *
113 * @var bool
114 */
115 public $is_searchable;
116
117 /**
118 * Location type of this mapping, if required
119 *
120 * @var int
121 */
122 public $location_type_id;
123
124 /**
125 * Phone Type ID, if required
126 *
127 * @var int
128 */
129 public $phone_type_id;
130
131 /**
132 * Website Type ID, if required
133 *
134 * @var int
135 */
136 public $website_type_id;
137
138 /**
139 * To save label for fields.
140 *
141 * @var string
142 */
143 public $label;
144
145 /**
146 * This field saves field type (ie individual,household.. field etc).
147 *
148 * @var string
149 */
150 public $field_type;
151
152 /**
153 * Is this field reserved for use by some other CiviCRM functionality?
154 *
155 * @var bool
156 */
157 public $is_reserved;
158
159 /**
160 * Include in multi-record listing?
161 *
162 * @var bool
163 */
164 public $is_multi_summary;
165
166 /**
167 * Class constructor.
168 */
169 public function __construct() {
170 $this->__table = 'civicrm_uf_field';
171 parent::__construct();
172 }
173
174 /**
175 * Returns localized title of this entity.
176 *
177 * @param bool $plural
178 * Whether to return the plural version of the title.
179 */
180 public static function getEntityTitle($plural = FALSE) {
181 return $plural ? ts('UFFields') : ts('UFField');
182 }
183
184 /**
185 * Returns foreign keys and entity references.
186 *
187 * @return array
188 * [CRM_Core_Reference_Interface]
189 */
190 public static function getReferenceColumns() {
191 if (!isset(Civi::$statics[__CLASS__]['links'])) {
192 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
193 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'uf_group_id', 'civicrm_uf_group', 'id');
194 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'location_type_id', 'civicrm_location_type', 'id');
195 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
196 }
197 return Civi::$statics[__CLASS__]['links'];
198 }
199
200 /**
201 * Returns all the column names of this table
202 *
203 * @return array
204 */
205 public static function &fields() {
206 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
207 Civi::$statics[__CLASS__]['fields'] = [
208 'id' => [
209 'name' => 'id',
210 'type' => CRM_Utils_Type::T_INT,
211 'title' => ts('Profile Field ID'),
212 'description' => ts('Unique table ID'),
213 'required' => TRUE,
214 'where' => 'civicrm_uf_field.id',
215 'table_name' => 'civicrm_uf_field',
216 'entity' => 'UFField',
217 'bao' => 'CRM_Core_BAO_UFField',
218 'localizable' => 0,
219 'html' => [
220 'type' => 'Number',
221 ],
222 'readonly' => TRUE,
223 'add' => '1.1',
224 ],
225 'uf_group_id' => [
226 'name' => 'uf_group_id',
227 'type' => CRM_Utils_Type::T_INT,
228 'title' => ts('Profile ID'),
229 'description' => ts('Which form does this field belong to.'),
230 'required' => TRUE,
231 'where' => 'civicrm_uf_field.uf_group_id',
232 'table_name' => 'civicrm_uf_field',
233 'entity' => 'UFField',
234 'bao' => 'CRM_Core_BAO_UFField',
235 'localizable' => 0,
236 'FKClassName' => 'CRM_Core_DAO_UFGroup',
237 'html' => [
238 'type' => 'Select',
239 'label' => ts("Profile"),
240 ],
241 'pseudoconstant' => [
242 'table' => 'civicrm_uf_group',
243 'keyColumn' => 'id',
244 'labelColumn' => 'title',
245 ],
246 'add' => '1.1',
247 ],
248 'field_name' => [
249 'name' => 'field_name',
250 'type' => CRM_Utils_Type::T_STRING,
251 'title' => ts('Profile Field Name'),
252 'description' => ts('Name for CiviCRM field which is being exposed for sharing.'),
253 'required' => TRUE,
254 'maxlength' => 64,
255 'size' => CRM_Utils_Type::BIG,
256 'where' => 'civicrm_uf_field.field_name',
257 'table_name' => 'civicrm_uf_field',
258 'entity' => 'UFField',
259 'bao' => 'CRM_Core_BAO_UFField',
260 'localizable' => 0,
261 'pseudoconstant' => [
262 'callback' => 'CRM_Core_BAO_UFField::getAvailableFieldTitles',
263 ],
264 'add' => '1.1',
265 ],
266 'is_active' => [
267 'name' => 'is_active',
268 'type' => CRM_Utils_Type::T_BOOLEAN,
269 'title' => ts('Profile Field Is Active'),
270 'description' => ts('Is this field currently shareable? If false, hide the field for all sharing contexts.'),
271 'where' => 'civicrm_uf_field.is_active',
272 'default' => '1',
273 'table_name' => 'civicrm_uf_field',
274 'entity' => 'UFField',
275 'bao' => 'CRM_Core_BAO_UFField',
276 'localizable' => 0,
277 'add' => '1.1',
278 ],
279 'is_view' => [
280 'name' => 'is_view',
281 'type' => CRM_Utils_Type::T_BOOLEAN,
282 'title' => ts('Profile Is View Only'),
283 'description' => ts('the field is view only and not editable in user forms.'),
284 'where' => 'civicrm_uf_field.is_view',
285 'default' => '0',
286 'table_name' => 'civicrm_uf_field',
287 'entity' => 'UFField',
288 'bao' => 'CRM_Core_BAO_UFField',
289 'localizable' => 0,
290 'add' => '1.1',
291 ],
292 'is_required' => [
293 'name' => 'is_required',
294 'type' => CRM_Utils_Type::T_BOOLEAN,
295 'title' => ts('Profile Field Is Required'),
296 'description' => ts('Is this field required when included in a user or registration form?'),
297 'where' => 'civicrm_uf_field.is_required',
298 'default' => '0',
299 'table_name' => 'civicrm_uf_field',
300 'entity' => 'UFField',
301 'bao' => 'CRM_Core_BAO_UFField',
302 'localizable' => 0,
303 'add' => '1.1',
304 ],
305 'weight' => [
306 'name' => 'weight',
307 'type' => CRM_Utils_Type::T_INT,
308 'title' => ts('Order'),
309 'description' => ts('Controls field display order when user framework fields are displayed in registration and account editing forms.'),
310 'required' => TRUE,
311 'where' => 'civicrm_uf_field.weight',
312 'default' => '1',
313 'table_name' => 'civicrm_uf_field',
314 'entity' => 'UFField',
315 'bao' => 'CRM_Core_BAO_UFField',
316 'localizable' => 0,
317 'add' => '1.1',
318 ],
319 'help_post' => [
320 'name' => 'help_post',
321 'type' => CRM_Utils_Type::T_TEXT,
322 'title' => ts('Profile Field Post Help'),
323 'description' => ts('Description and/or help text to display after this field.'),
324 'where' => 'civicrm_uf_field.help_post',
325 'table_name' => 'civicrm_uf_field',
326 'entity' => 'UFField',
327 'bao' => 'CRM_Core_BAO_UFField',
328 'localizable' => 1,
329 'add' => '1.1',
330 ],
331 'help_pre' => [
332 'name' => 'help_pre',
333 'type' => CRM_Utils_Type::T_TEXT,
334 'title' => ts('Profile Field Pre Help'),
335 'description' => ts('Description and/or help text to display before this field.'),
336 'where' => 'civicrm_uf_field.help_pre',
337 'table_name' => 'civicrm_uf_field',
338 'entity' => 'UFField',
339 'bao' => 'CRM_Core_BAO_UFField',
340 'localizable' => 1,
341 'add' => '3.2',
342 ],
343 'visibility' => [
344 'name' => 'visibility',
345 'type' => CRM_Utils_Type::T_STRING,
346 'title' => ts('Profile Field Visibility'),
347 'description' => ts('In what context(s) is this field visible.'),
348 'maxlength' => 32,
349 'size' => CRM_Utils_Type::MEDIUM,
350 'where' => 'civicrm_uf_field.visibility',
351 'default' => 'User and User Admin Only',
352 'table_name' => 'civicrm_uf_field',
353 'entity' => 'UFField',
354 'bao' => 'CRM_Core_BAO_UFField',
355 'localizable' => 0,
356 'html' => [
357 'type' => 'Select',
358 ],
359 'pseudoconstant' => [
360 'callback' => 'CRM_Core_SelectValues::ufVisibility',
361 ],
362 'add' => '1.1',
363 ],
364 'in_selector' => [
365 'name' => 'in_selector',
366 'type' => CRM_Utils_Type::T_BOOLEAN,
367 'title' => ts('Profile Field Is a Filter'),
368 'description' => ts('Is this field included as a column in the selector table?'),
369 'where' => 'civicrm_uf_field.in_selector',
370 'default' => '0',
371 'table_name' => 'civicrm_uf_field',
372 'entity' => 'UFField',
373 'bao' => 'CRM_Core_BAO_UFField',
374 'localizable' => 0,
375 'add' => '1.2',
376 ],
377 'is_searchable' => [
378 'name' => 'is_searchable',
379 'type' => CRM_Utils_Type::T_BOOLEAN,
380 'title' => ts('Profile Field Is Searchable'),
381 'description' => ts('Is this field included search form of profile?'),
382 'where' => 'civicrm_uf_field.is_searchable',
383 'default' => '0',
384 'table_name' => 'civicrm_uf_field',
385 'entity' => 'UFField',
386 'bao' => 'CRM_Core_BAO_UFField',
387 'localizable' => 0,
388 'add' => '1.4',
389 ],
390 'location_type_id' => [
391 'name' => 'location_type_id',
392 'type' => CRM_Utils_Type::T_INT,
393 'title' => ts('Location Type ID'),
394 'description' => ts('Location type of this mapping, if required'),
395 'where' => 'civicrm_uf_field.location_type_id',
396 'table_name' => 'civicrm_uf_field',
397 'entity' => 'UFField',
398 'bao' => 'CRM_Core_BAO_UFField',
399 'localizable' => 0,
400 'FKClassName' => 'CRM_Core_DAO_LocationType',
401 'html' => [
402 'label' => ts("Location Type"),
403 ],
404 'add' => '1.3',
405 ],
406 'phone_type_id' => [
407 'name' => 'phone_type_id',
408 'type' => CRM_Utils_Type::T_INT,
409 'title' => ts('Profile Field Phone Type'),
410 'description' => ts('Phone Type ID, if required'),
411 'where' => 'civicrm_uf_field.phone_type_id',
412 'table_name' => 'civicrm_uf_field',
413 'entity' => 'UFField',
414 'bao' => 'CRM_Core_BAO_UFField',
415 'localizable' => 0,
416 'pseudoconstant' => [
417 'optionGroupName' => 'phone_type',
418 'optionEditPath' => 'civicrm/admin/options/phone_type',
419 ],
420 'add' => '2.2',
421 ],
422 'website_type_id' => [
423 'name' => 'website_type_id',
424 'type' => CRM_Utils_Type::T_INT,
425 'title' => ts('Profile Field Website Type'),
426 'description' => ts('Website Type ID, if required'),
427 'where' => 'civicrm_uf_field.website_type_id',
428 'table_name' => 'civicrm_uf_field',
429 'entity' => 'UFField',
430 'bao' => 'CRM_Core_BAO_UFField',
431 'localizable' => 0,
432 'pseudoconstant' => [
433 'optionGroupName' => 'website_type',
434 'optionEditPath' => 'civicrm/admin/options/website_type',
435 ],
436 'add' => '4.5',
437 ],
438 'label' => [
439 'name' => 'label',
440 'type' => CRM_Utils_Type::T_STRING,
441 'title' => ts('Profile Field Label'),
442 'description' => ts('To save label for fields.'),
443 'required' => TRUE,
444 'maxlength' => 255,
445 'size' => CRM_Utils_Type::HUGE,
446 'where' => 'civicrm_uf_field.label',
447 'table_name' => 'civicrm_uf_field',
448 'entity' => 'UFField',
449 'bao' => 'CRM_Core_BAO_UFField',
450 'localizable' => 1,
451 'add' => '1.4',
452 ],
453 'field_type' => [
454 'name' => 'field_type',
455 'type' => CRM_Utils_Type::T_STRING,
456 'title' => ts('Profile Field Type'),
457 'description' => ts('This field saves field type (ie individual,household.. field etc).'),
458 'maxlength' => 255,
459 'size' => CRM_Utils_Type::HUGE,
460 'where' => 'civicrm_uf_field.field_type',
461 'table_name' => 'civicrm_uf_field',
462 'entity' => 'UFField',
463 'bao' => 'CRM_Core_BAO_UFField',
464 'localizable' => 0,
465 'add' => '1.4',
466 ],
467 'is_reserved' => [
468 'name' => 'is_reserved',
469 'type' => CRM_Utils_Type::T_BOOLEAN,
470 'title' => ts('Profile Field Is Reserved'),
471 'description' => ts('Is this field reserved for use by some other CiviCRM functionality?'),
472 'where' => 'civicrm_uf_field.is_reserved',
473 'table_name' => 'civicrm_uf_field',
474 'entity' => 'UFField',
475 'bao' => 'CRM_Core_BAO_UFField',
476 'localizable' => 0,
477 'add' => '3.0',
478 ],
479 'is_multi_summary' => [
480 'name' => 'is_multi_summary',
481 'type' => CRM_Utils_Type::T_BOOLEAN,
482 'title' => ts('Profile Field Supports Multiple'),
483 'description' => ts('Include in multi-record listing?'),
484 'where' => 'civicrm_uf_field.is_multi_summary',
485 'default' => '0',
486 'table_name' => 'civicrm_uf_field',
487 'entity' => 'UFField',
488 'bao' => 'CRM_Core_BAO_UFField',
489 'localizable' => 0,
490 'add' => '4.3',
491 ],
492 ];
493 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
494 }
495 return Civi::$statics[__CLASS__]['fields'];
496 }
497
498 /**
499 * Return a mapping from field-name to the corresponding key (as used in fields()).
500 *
501 * @return array
502 * Array(string $name => string $uniqueName).
503 */
504 public static function &fieldKeys() {
505 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
506 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
507 }
508 return Civi::$statics[__CLASS__]['fieldKeys'];
509 }
510
511 /**
512 * Returns the names of this table
513 *
514 * @return string
515 */
516 public static function getTableName() {
517 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
518 }
519
520 /**
521 * Returns if this table needs to be logged
522 *
523 * @return bool
524 */
525 public function getLog() {
526 return self::$_log;
527 }
528
529 /**
530 * Returns the list of fields that can be imported
531 *
532 * @param bool $prefix
533 *
534 * @return array
535 */
536 public static function &import($prefix = FALSE) {
537 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_field', $prefix, []);
538 return $r;
539 }
540
541 /**
542 * Returns the list of fields that can be exported
543 *
544 * @param bool $prefix
545 *
546 * @return array
547 */
548 public static function &export($prefix = FALSE) {
549 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_field', $prefix, []);
550 return $r;
551 }
552
553 /**
554 * Returns the list of indices
555 *
556 * @param bool $localize
557 *
558 * @return array
559 */
560 public static function indices($localize = TRUE) {
561 $indices = [
562 'IX_website_type_id' => [
563 'name' => 'IX_website_type_id',
564 'field' => [
565 0 => 'website_type_id',
566 ],
567 'localizable' => FALSE,
568 'sig' => 'civicrm_uf_field::0::website_type_id',
569 ],
570 ];
571 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
572 }
573
574 }