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