Merge pull request #22155 from eileenmcnaughton/n4
[civicrm-core.git] / CRM / Core / DAO / CustomGroup.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/CustomGroup.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:e06fe97917806daa0d337c43968ccf2b)
10 */
11
12 /**
13 * Database access object for the CustomGroup entity.
14 */
15 class CRM_Core_DAO_CustomGroup 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_custom_group';
25
26 /**
27 * Field to show when displaying a record.
28 *
29 * @var string
30 */
31 public static $_labelField = 'title';
32
33 /**
34 * Should CiviCRM log any modifications to this table in the civicrm_log table.
35 *
36 * @var bool
37 */
38 public static $_log = TRUE;
39
40 /**
41 * Unique Custom Group ID
42 *
43 * @var int
44 */
45 public $id;
46
47 /**
48 * Variable name/programmatic handle for this group.
49 *
50 * @var string
51 */
52 public $name;
53
54 /**
55 * Friendly Name.
56 *
57 * @var string
58 */
59 public $title;
60
61 /**
62 * Type of object this group extends (can add other options later e.g. contact_address, etc.).
63 *
64 * @var string
65 */
66 public $extends;
67
68 /**
69 * FK to civicrm_option_value.id (for option group custom_data_type.)
70 *
71 * @var int
72 */
73 public $extends_entity_column_id;
74
75 /**
76 * linking custom group for dynamic object
77 *
78 * @var string
79 */
80 public $extends_entity_column_value;
81
82 /**
83 * Visual relationship between this form and its parent.
84 *
85 * @var string
86 */
87 public $style;
88
89 /**
90 * Will this group be in collapsed or expanded mode on initial display ?
91 *
92 * @var bool
93 */
94 public $collapse_display;
95
96 /**
97 * Description and/or help text to display before fields in form.
98 *
99 * @var text
100 */
101 public $help_pre;
102
103 /**
104 * Description and/or help text to display after fields in form.
105 *
106 * @var text
107 */
108 public $help_post;
109
110 /**
111 * Controls display order when multiple extended property groups are setup for the same class.
112 *
113 * @var int
114 */
115 public $weight;
116
117 /**
118 * Is this property active?
119 *
120 * @var bool
121 */
122 public $is_active;
123
124 /**
125 * Name of the table that holds the values for this group.
126 *
127 * @var string
128 */
129 public $table_name;
130
131 /**
132 * Does this group hold multiple values?
133 *
134 * @var bool
135 */
136 public $is_multiple;
137
138 /**
139 * minimum number of multiple records (typically 0?)
140 *
141 * @var int
142 */
143 public $min_multiple;
144
145 /**
146 * maximum number of multiple records, if 0 - no max
147 *
148 * @var int
149 */
150 public $max_multiple;
151
152 /**
153 * Will this group be in collapsed or expanded mode on advanced search display ?
154 *
155 * @var bool
156 */
157 public $collapse_adv_display;
158
159 /**
160 * FK to civicrm_contact, who created this custom group
161 *
162 * @var int
163 */
164 public $created_id;
165
166 /**
167 * Date and time this custom group was created.
168 *
169 * @var datetime
170 */
171 public $created_date;
172
173 /**
174 * Is this a reserved Custom Group?
175 *
176 * @var bool
177 */
178 public $is_reserved;
179
180 /**
181 * Is this property public?
182 *
183 * @var bool
184 */
185 public $is_public;
186
187 /**
188 * crm-i icon class
189 *
190 * @var string
191 */
192 public $icon;
193
194 /**
195 * Class constructor.
196 */
197 public function __construct() {
198 $this->__table = 'civicrm_custom_group';
199 parent::__construct();
200 }
201
202 /**
203 * Returns localized title of this entity.
204 *
205 * @param bool $plural
206 * Whether to return the plural version of the title.
207 */
208 public static function getEntityTitle($plural = FALSE) {
209 return $plural ? ts('Custom Field Groups') : ts('Custom Field Group');
210 }
211
212 /**
213 * Returns foreign keys and entity references.
214 *
215 * @return array
216 * [CRM_Core_Reference_Interface]
217 */
218 public static function getReferenceColumns() {
219 if (!isset(Civi::$statics[__CLASS__]['links'])) {
220 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
221 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
222 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
223 }
224 return Civi::$statics[__CLASS__]['links'];
225 }
226
227 /**
228 * Returns all the column names of this table
229 *
230 * @return array
231 */
232 public static function &fields() {
233 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
234 Civi::$statics[__CLASS__]['fields'] = [
235 'id' => [
236 'name' => 'id',
237 'type' => CRM_Utils_Type::T_INT,
238 'title' => ts('Custom Group ID'),
239 'description' => ts('Unique Custom Group ID'),
240 'required' => TRUE,
241 'where' => 'civicrm_custom_group.id',
242 'table_name' => 'civicrm_custom_group',
243 'entity' => 'CustomGroup',
244 'bao' => 'CRM_Core_BAO_CustomGroup',
245 'localizable' => 0,
246 'html' => [
247 'type' => 'Number',
248 ],
249 'readonly' => TRUE,
250 'add' => '1.1',
251 ],
252 'name' => [
253 'name' => 'name',
254 'type' => CRM_Utils_Type::T_STRING,
255 'title' => ts('Custom Group Name'),
256 'description' => ts('Variable name/programmatic handle for this group.'),
257 'maxlength' => 64,
258 'size' => CRM_Utils_Type::BIG,
259 'where' => 'civicrm_custom_group.name',
260 'table_name' => 'civicrm_custom_group',
261 'entity' => 'CustomGroup',
262 'bao' => 'CRM_Core_BAO_CustomGroup',
263 'localizable' => 0,
264 'add' => '1.1',
265 ],
266 'title' => [
267 'name' => 'title',
268 'type' => CRM_Utils_Type::T_STRING,
269 'title' => ts('Custom Group Title'),
270 'description' => ts('Friendly Name.'),
271 'required' => TRUE,
272 'maxlength' => 64,
273 'size' => CRM_Utils_Type::BIG,
274 'where' => 'civicrm_custom_group.title',
275 'table_name' => 'civicrm_custom_group',
276 'entity' => 'CustomGroup',
277 'bao' => 'CRM_Core_BAO_CustomGroup',
278 'localizable' => 1,
279 'add' => '1.1',
280 ],
281 'extends' => [
282 'name' => 'extends',
283 'type' => CRM_Utils_Type::T_STRING,
284 'title' => ts('Custom Group Extends'),
285 'description' => ts('Type of object this group extends (can add other options later e.g. contact_address, etc.).'),
286 'maxlength' => 255,
287 'size' => CRM_Utils_Type::HUGE,
288 'where' => 'civicrm_custom_group.extends',
289 'default' => 'Contact',
290 'table_name' => 'civicrm_custom_group',
291 'entity' => 'CustomGroup',
292 'bao' => 'CRM_Core_BAO_CustomGroup',
293 'localizable' => 0,
294 'add' => '1.1',
295 ],
296 'extends_entity_column_id' => [
297 'name' => 'extends_entity_column_id',
298 'type' => CRM_Utils_Type::T_INT,
299 'title' => ts('Custom Group Subtype List'),
300 'description' => ts('FK to civicrm_option_value.id (for option group custom_data_type.)'),
301 'where' => 'civicrm_custom_group.extends_entity_column_id',
302 'default' => NULL,
303 'table_name' => 'civicrm_custom_group',
304 'entity' => 'CustomGroup',
305 'bao' => 'CRM_Core_BAO_CustomGroup',
306 'localizable' => 0,
307 'html' => [
308 'type' => 'Select',
309 ],
310 'pseudoconstant' => [
311 'optionGroupName' => 'custom_data_type',
312 'optionEditPath' => 'civicrm/admin/options/custom_data_type',
313 ],
314 'add' => '2.2',
315 ],
316 'extends_entity_column_value' => [
317 'name' => 'extends_entity_column_value',
318 'type' => CRM_Utils_Type::T_STRING,
319 'title' => ts('Custom Group Subtype'),
320 'description' => ts('linking custom group for dynamic object'),
321 'maxlength' => 255,
322 'size' => CRM_Utils_Type::HUGE,
323 'where' => 'civicrm_custom_group.extends_entity_column_value',
324 'table_name' => 'civicrm_custom_group',
325 'entity' => 'CustomGroup',
326 'bao' => 'CRM_Core_BAO_CustomGroup',
327 'localizable' => 0,
328 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND,
329 'add' => '1.6',
330 ],
331 'style' => [
332 'name' => 'style',
333 'type' => CRM_Utils_Type::T_STRING,
334 'title' => ts('Custom Group Style'),
335 'description' => ts('Visual relationship between this form and its parent.'),
336 'maxlength' => 15,
337 'size' => CRM_Utils_Type::TWELVE,
338 'where' => 'civicrm_custom_group.style',
339 'table_name' => 'civicrm_custom_group',
340 'entity' => 'CustomGroup',
341 'bao' => 'CRM_Core_BAO_CustomGroup',
342 'localizable' => 0,
343 'html' => [
344 'type' => 'Select',
345 ],
346 'pseudoconstant' => [
347 'callback' => 'CRM_Core_SelectValues::customGroupStyle',
348 ],
349 'add' => '1.1',
350 ],
351 'collapse_display' => [
352 'name' => 'collapse_display',
353 'type' => CRM_Utils_Type::T_BOOLEAN,
354 'title' => ts('Collapse Custom Group?'),
355 'description' => ts('Will this group be in collapsed or expanded mode on initial display ?'),
356 'where' => 'civicrm_custom_group.collapse_display',
357 'default' => '0',
358 'table_name' => 'civicrm_custom_group',
359 'entity' => 'CustomGroup',
360 'bao' => 'CRM_Core_BAO_CustomGroup',
361 'localizable' => 0,
362 'add' => '1.1',
363 ],
364 'help_pre' => [
365 'name' => 'help_pre',
366 'type' => CRM_Utils_Type::T_TEXT,
367 'title' => ts('Custom Group Pre Text'),
368 'description' => ts('Description and/or help text to display before fields in form.'),
369 'rows' => 4,
370 'cols' => 80,
371 'where' => 'civicrm_custom_group.help_pre',
372 'table_name' => 'civicrm_custom_group',
373 'entity' => 'CustomGroup',
374 'bao' => 'CRM_Core_BAO_CustomGroup',
375 'localizable' => 1,
376 'html' => [
377 'type' => 'TextArea',
378 ],
379 'add' => '1.1',
380 ],
381 'help_post' => [
382 'name' => 'help_post',
383 'type' => CRM_Utils_Type::T_TEXT,
384 'title' => ts('Custom Group Post Text'),
385 'description' => ts('Description and/or help text to display after fields in form.'),
386 'rows' => 4,
387 'cols' => 80,
388 'where' => 'civicrm_custom_group.help_post',
389 'table_name' => 'civicrm_custom_group',
390 'entity' => 'CustomGroup',
391 'bao' => 'CRM_Core_BAO_CustomGroup',
392 'localizable' => 1,
393 'html' => [
394 'type' => 'TextArea',
395 ],
396 'add' => '1.1',
397 ],
398 'weight' => [
399 'name' => 'weight',
400 'type' => CRM_Utils_Type::T_INT,
401 'title' => ts('Order'),
402 'description' => ts('Controls display order when multiple extended property groups are setup for the same class.'),
403 'required' => TRUE,
404 'where' => 'civicrm_custom_group.weight',
405 'default' => '1',
406 'table_name' => 'civicrm_custom_group',
407 'entity' => 'CustomGroup',
408 'bao' => 'CRM_Core_BAO_CustomGroup',
409 'localizable' => 0,
410 'add' => '1.1',
411 ],
412 'is_active' => [
413 'name' => 'is_active',
414 'type' => CRM_Utils_Type::T_BOOLEAN,
415 'title' => ts('Custom Group Is Active?'),
416 'description' => ts('Is this property active?'),
417 'where' => 'civicrm_custom_group.is_active',
418 'default' => '1',
419 'table_name' => 'civicrm_custom_group',
420 'entity' => 'CustomGroup',
421 'bao' => 'CRM_Core_BAO_CustomGroup',
422 'localizable' => 0,
423 'add' => '1.1',
424 ],
425 'table_name' => [
426 'name' => 'table_name',
427 'type' => CRM_Utils_Type::T_STRING,
428 'title' => ts('Table Name'),
429 'description' => ts('Name of the table that holds the values for this group.'),
430 'maxlength' => 255,
431 'size' => CRM_Utils_Type::HUGE,
432 'where' => 'civicrm_custom_group.table_name',
433 'table_name' => 'civicrm_custom_group',
434 'entity' => 'CustomGroup',
435 'bao' => 'CRM_Core_BAO_CustomGroup',
436 'localizable' => 0,
437 'html' => [
438 'label' => ts("Table Name"),
439 ],
440 'readonly' => TRUE,
441 'add' => '2.0',
442 ],
443 'is_multiple' => [
444 'name' => 'is_multiple',
445 'type' => CRM_Utils_Type::T_BOOLEAN,
446 'title' => ts('Supports Multiple Records'),
447 'description' => ts('Does this group hold multiple values?'),
448 'where' => 'civicrm_custom_group.is_multiple',
449 'default' => '0',
450 'table_name' => 'civicrm_custom_group',
451 'entity' => 'CustomGroup',
452 'bao' => 'CRM_Core_BAO_CustomGroup',
453 'localizable' => 0,
454 'add' => '2.0',
455 ],
456 'min_multiple' => [
457 'name' => 'min_multiple',
458 'type' => CRM_Utils_Type::T_INT,
459 'title' => ts('Minimum Multiple Records'),
460 'description' => ts('minimum number of multiple records (typically 0?)'),
461 'where' => 'civicrm_custom_group.min_multiple',
462 'table_name' => 'civicrm_custom_group',
463 'entity' => 'CustomGroup',
464 'bao' => 'CRM_Core_BAO_CustomGroup',
465 'localizable' => 0,
466 'add' => '2.2',
467 ],
468 'max_multiple' => [
469 'name' => 'max_multiple',
470 'type' => CRM_Utils_Type::T_INT,
471 'title' => ts('Maximum Multiple Records'),
472 'description' => ts('maximum number of multiple records, if 0 - no max'),
473 'where' => 'civicrm_custom_group.max_multiple',
474 'table_name' => 'civicrm_custom_group',
475 'entity' => 'CustomGroup',
476 'bao' => 'CRM_Core_BAO_CustomGroup',
477 'localizable' => 0,
478 'add' => '2.2',
479 ],
480 'collapse_adv_display' => [
481 'name' => 'collapse_adv_display',
482 'type' => CRM_Utils_Type::T_BOOLEAN,
483 'title' => ts('Collapse Group Display'),
484 'description' => ts('Will this group be in collapsed or expanded mode on advanced search display ?'),
485 'where' => 'civicrm_custom_group.collapse_adv_display',
486 'default' => '0',
487 'table_name' => 'civicrm_custom_group',
488 'entity' => 'CustomGroup',
489 'bao' => 'CRM_Core_BAO_CustomGroup',
490 'localizable' => 0,
491 'add' => '3.0',
492 ],
493 'created_id' => [
494 'name' => 'created_id',
495 'type' => CRM_Utils_Type::T_INT,
496 'title' => ts('Created By Contact ID'),
497 'description' => ts('FK to civicrm_contact, who created this custom group'),
498 'where' => 'civicrm_custom_group.created_id',
499 'table_name' => 'civicrm_custom_group',
500 'entity' => 'CustomGroup',
501 'bao' => 'CRM_Core_BAO_CustomGroup',
502 'localizable' => 0,
503 'FKClassName' => 'CRM_Contact_DAO_Contact',
504 'html' => [
505 'label' => ts("Created By"),
506 ],
507 'add' => '3.0',
508 ],
509 'created_date' => [
510 'name' => 'created_date',
511 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
512 'title' => ts('Custom Group Created Date'),
513 'description' => ts('Date and time this custom group was created.'),
514 'where' => 'civicrm_custom_group.created_date',
515 'table_name' => 'civicrm_custom_group',
516 'entity' => 'CustomGroup',
517 'bao' => 'CRM_Core_BAO_CustomGroup',
518 'localizable' => 0,
519 'add' => '3.0',
520 ],
521 'is_reserved' => [
522 'name' => 'is_reserved',
523 'type' => CRM_Utils_Type::T_BOOLEAN,
524 'title' => ts('Reserved Group?'),
525 'description' => ts('Is this a reserved Custom Group?'),
526 'where' => 'civicrm_custom_group.is_reserved',
527 'default' => '0',
528 'table_name' => 'civicrm_custom_group',
529 'entity' => 'CustomGroup',
530 'bao' => 'CRM_Core_BAO_CustomGroup',
531 'localizable' => 0,
532 'add' => '4.4',
533 ],
534 'is_public' => [
535 'name' => 'is_public',
536 'type' => CRM_Utils_Type::T_BOOLEAN,
537 'title' => ts('Custom Group Is Public?'),
538 'description' => ts('Is this property public?'),
539 'where' => 'civicrm_custom_group.is_public',
540 'default' => '1',
541 'table_name' => 'civicrm_custom_group',
542 'entity' => 'CustomGroup',
543 'bao' => 'CRM_Core_BAO_CustomGroup',
544 'localizable' => 0,
545 'add' => '4.7',
546 ],
547 'icon' => [
548 'name' => 'icon',
549 'type' => CRM_Utils_Type::T_STRING,
550 'title' => ts('Icon'),
551 'description' => ts('crm-i icon class'),
552 'maxlength' => 255,
553 'size' => CRM_Utils_Type::HUGE,
554 'where' => 'civicrm_custom_group.icon',
555 'default' => NULL,
556 'table_name' => 'civicrm_custom_group',
557 'entity' => 'CustomGroup',
558 'bao' => 'CRM_Core_BAO_CustomGroup',
559 'localizable' => 0,
560 'add' => '5.28',
561 ],
562 ];
563 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
564 }
565 return Civi::$statics[__CLASS__]['fields'];
566 }
567
568 /**
569 * Return a mapping from field-name to the corresponding key (as used in fields()).
570 *
571 * @return array
572 * Array(string $name => string $uniqueName).
573 */
574 public static function &fieldKeys() {
575 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
576 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
577 }
578 return Civi::$statics[__CLASS__]['fieldKeys'];
579 }
580
581 /**
582 * Returns the names of this table
583 *
584 * @return string
585 */
586 public static function getTableName() {
587 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
588 }
589
590 /**
591 * Returns if this table needs to be logged
592 *
593 * @return bool
594 */
595 public function getLog() {
596 return self::$_log;
597 }
598
599 /**
600 * Returns the list of fields that can be imported
601 *
602 * @param bool $prefix
603 *
604 * @return array
605 */
606 public static function &import($prefix = FALSE) {
607 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'custom_group', $prefix, []);
608 return $r;
609 }
610
611 /**
612 * Returns the list of fields that can be exported
613 *
614 * @param bool $prefix
615 *
616 * @return array
617 */
618 public static function &export($prefix = FALSE) {
619 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'custom_group', $prefix, []);
620 return $r;
621 }
622
623 /**
624 * Returns the list of indices
625 *
626 * @param bool $localize
627 *
628 * @return array
629 */
630 public static function indices($localize = TRUE) {
631 $indices = [
632 'UI_title_extends' => [
633 'name' => 'UI_title_extends',
634 'field' => [
635 0 => 'title',
636 1 => 'extends',
637 ],
638 'localizable' => TRUE,
639 'unique' => TRUE,
640 'sig' => 'civicrm_custom_group::1::title::extends',
641 ],
642 'UI_name_extends' => [
643 'name' => 'UI_name_extends',
644 'field' => [
645 0 => 'name',
646 1 => 'extends',
647 ],
648 'localizable' => FALSE,
649 'unique' => TRUE,
650 'sig' => 'civicrm_custom_group::1::name::extends',
651 ],
652 ];
653 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
654 }
655
656 }