Schema - Fix boolean fields in various tables
[civicrm-core.git] / CRM / Report / DAO / ReportInstance.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Report/ReportInstance.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:588c8712caae98e6765ac8ed21c9e6b2)
10 */
11
12 /**
13 * Database access object for the ReportInstance entity.
14 */
15 class CRM_Report_DAO_ReportInstance extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '2.2';
18 const COMPONENT = 'CiviReport';
19
20 /**
21 * Static instance to hold the table name.
22 *
23 * @var string
24 */
25 public static $_tableName = 'civicrm_report_instance';
26
27 /**
28 * Icon associated with this entity.
29 *
30 * @var string
31 */
32 public static $_icon = 'fa-bar-chart';
33
34 /**
35 * Should CiviCRM log any modifications to this table in the civicrm_log table.
36 *
37 * @var bool
38 */
39 public static $_log = FALSE;
40
41 /**
42 * Report Instance ID
43 *
44 * @var int|string|null
45 * (SQL type: int unsigned)
46 * Note that values will be retrieved from the database as a string.
47 */
48 public $id;
49
50 /**
51 * Which Domain is this instance for
52 *
53 * @var int|string
54 * (SQL type: int unsigned)
55 * Note that values will be retrieved from the database as a string.
56 */
57 public $domain_id;
58
59 /**
60 * Report Instance Title.
61 *
62 * @var string|null
63 * (SQL type: varchar(255))
64 * Note that values will be retrieved from the database as a string.
65 */
66 public $title;
67
68 /**
69 * FK to civicrm_option_value for the report template
70 *
71 * @var string
72 * (SQL type: varchar(512))
73 * Note that values will be retrieved from the database as a string.
74 */
75 public $report_id;
76
77 /**
78 * when combined with report_id/template uniquely identifies the instance
79 *
80 * @var string|null
81 * (SQL type: varchar(255))
82 * Note that values will be retrieved from the database as a string.
83 */
84 public $name;
85
86 /**
87 * arguments that are passed in the url when invoking the instance
88 *
89 * @var string|null
90 * (SQL type: varchar(255))
91 * Note that values will be retrieved from the database as a string.
92 */
93 public $args;
94
95 /**
96 * Report Instance description.
97 *
98 * @var string|null
99 * (SQL type: varchar(255))
100 * Note that values will be retrieved from the database as a string.
101 */
102 public $description;
103
104 /**
105 * permission required to be able to run this instance
106 *
107 * @var string|null
108 * (SQL type: varchar(255))
109 * Note that values will be retrieved from the database as a string.
110 */
111 public $permission;
112
113 /**
114 * role required to be able to run this instance
115 *
116 * @var string|null
117 * (SQL type: varchar(1024))
118 * Note that values will be retrieved from the database as a string.
119 */
120 public $grouprole;
121
122 /**
123 * Submitted form values for this report
124 *
125 * @var string|null
126 * (SQL type: longtext)
127 * Note that values will be retrieved from the database as a string.
128 */
129 public $form_values;
130
131 /**
132 * Is this entry active?
133 *
134 * @var bool|string
135 * (SQL type: tinyint)
136 * Note that values will be retrieved from the database as a string.
137 */
138 public $is_active;
139
140 /**
141 * FK to contact table.
142 *
143 * @var int|string|null
144 * (SQL type: int unsigned)
145 * Note that values will be retrieved from the database as a string.
146 */
147 public $created_id;
148
149 /**
150 * FK to contact table.
151 *
152 * @var int|string|null
153 * (SQL type: int unsigned)
154 * Note that values will be retrieved from the database as a string.
155 */
156 public $owner_id;
157
158 /**
159 * Subject of email
160 *
161 * @var string|null
162 * (SQL type: varchar(255))
163 * Note that values will be retrieved from the database as a string.
164 */
165 public $email_subject;
166
167 /**
168 * comma-separated list of email addresses to send the report to
169 *
170 * @var string|null
171 * (SQL type: text)
172 * Note that values will be retrieved from the database as a string.
173 */
174 public $email_to;
175
176 /**
177 * comma-separated list of email addresses to send the report to
178 *
179 * @var string|null
180 * (SQL type: text)
181 * Note that values will be retrieved from the database as a string.
182 */
183 public $email_cc;
184
185 /**
186 * comma-separated list of email addresses to send the report to
187 *
188 * @var string|null
189 * (SQL type: text)
190 * Note that values will be retrieved from the database as a string.
191 */
192 public $header;
193
194 /**
195 * comma-separated list of email addresses to send the report to
196 *
197 * @var string|null
198 * (SQL type: text)
199 * Note that values will be retrieved from the database as a string.
200 */
201 public $footer;
202
203 /**
204 * FK to navigation ID
205 *
206 * @var int|string|null
207 * (SQL type: int unsigned)
208 * Note that values will be retrieved from the database as a string.
209 */
210 public $navigation_id;
211
212 /**
213 * FK to instance ID drilldown to
214 *
215 * @var int|string|null
216 * (SQL type: int unsigned)
217 * Note that values will be retrieved from the database as a string.
218 */
219 public $drilldown_id;
220
221 /**
222 * @var bool|string
223 * (SQL type: tinyint)
224 * Note that values will be retrieved from the database as a string.
225 */
226 public $is_reserved;
227
228 /**
229 * Class constructor.
230 */
231 public function __construct() {
232 $this->__table = 'civicrm_report_instance';
233 parent::__construct();
234 }
235
236 /**
237 * Returns localized title of this entity.
238 *
239 * @param bool $plural
240 * Whether to return the plural version of the title.
241 */
242 public static function getEntityTitle($plural = FALSE) {
243 return $plural ? ts('Reports') : ts('Report');
244 }
245
246 /**
247 * Returns foreign keys and entity references.
248 *
249 * @return array
250 * [CRM_Core_Reference_Interface]
251 */
252 public static function getReferenceColumns() {
253 if (!isset(Civi::$statics[__CLASS__]['links'])) {
254 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
255 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
256 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
257 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'owner_id', 'civicrm_contact', 'id');
258 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'navigation_id', 'civicrm_navigation', 'id');
259 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'drilldown_id', 'civicrm_report_instance', 'id');
260 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
261 }
262 return Civi::$statics[__CLASS__]['links'];
263 }
264
265 /**
266 * Returns all the column names of this table
267 *
268 * @return array
269 */
270 public static function &fields() {
271 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
272 Civi::$statics[__CLASS__]['fields'] = [
273 'id' => [
274 'name' => 'id',
275 'type' => CRM_Utils_Type::T_INT,
276 'title' => ts('Report Instance ID'),
277 'description' => ts('Report Instance ID'),
278 'required' => TRUE,
279 'where' => 'civicrm_report_instance.id',
280 'table_name' => 'civicrm_report_instance',
281 'entity' => 'ReportInstance',
282 'bao' => 'CRM_Report_BAO_ReportInstance',
283 'localizable' => 0,
284 'html' => [
285 'type' => 'Number',
286 ],
287 'readonly' => TRUE,
288 'add' => '2.2',
289 ],
290 'domain_id' => [
291 'name' => 'domain_id',
292 'type' => CRM_Utils_Type::T_INT,
293 'title' => ts('Domain ID'),
294 'description' => ts('Which Domain is this instance for'),
295 'required' => TRUE,
296 'where' => 'civicrm_report_instance.domain_id',
297 'table_name' => 'civicrm_report_instance',
298 'entity' => 'ReportInstance',
299 'bao' => 'CRM_Report_BAO_ReportInstance',
300 'localizable' => 0,
301 'FKClassName' => 'CRM_Core_DAO_Domain',
302 'html' => [
303 'label' => ts("Domain"),
304 ],
305 'pseudoconstant' => [
306 'table' => 'civicrm_domain',
307 'keyColumn' => 'id',
308 'labelColumn' => 'name',
309 ],
310 'add' => '3.1',
311 ],
312 'title' => [
313 'name' => 'title',
314 'type' => CRM_Utils_Type::T_STRING,
315 'title' => ts('Report Instance Title'),
316 'description' => ts('Report Instance Title.'),
317 'maxlength' => 255,
318 'size' => CRM_Utils_Type::HUGE,
319 'where' => 'civicrm_report_instance.title',
320 'table_name' => 'civicrm_report_instance',
321 'entity' => 'ReportInstance',
322 'bao' => 'CRM_Report_BAO_ReportInstance',
323 'localizable' => 0,
324 'html' => [
325 'type' => 'Text',
326 ],
327 'add' => '2.2',
328 ],
329 'report_id' => [
330 'name' => 'report_id',
331 'type' => CRM_Utils_Type::T_STRING,
332 'title' => ts('Report template ID'),
333 'description' => ts('FK to civicrm_option_value for the report template'),
334 'required' => TRUE,
335 'maxlength' => 512,
336 'size' => CRM_Utils_Type::HUGE,
337 'where' => 'civicrm_report_instance.report_id',
338 'table_name' => 'civicrm_report_instance',
339 'entity' => 'ReportInstance',
340 'bao' => 'CRM_Report_BAO_ReportInstance',
341 'localizable' => 0,
342 'html' => [
343 'type' => 'Select',
344 ],
345 'add' => '2.2',
346 ],
347 'name' => [
348 'name' => 'name',
349 'type' => CRM_Utils_Type::T_STRING,
350 'title' => ts('Report instance Name'),
351 'description' => ts('when combined with report_id/template uniquely identifies the instance'),
352 'maxlength' => 255,
353 'size' => CRM_Utils_Type::HUGE,
354 'where' => 'civicrm_report_instance.name',
355 'table_name' => 'civicrm_report_instance',
356 'entity' => 'ReportInstance',
357 'bao' => 'CRM_Report_BAO_ReportInstance',
358 'localizable' => 0,
359 'html' => [
360 'type' => 'Text',
361 ],
362 'add' => '3.2',
363 ],
364 'args' => [
365 'name' => 'args',
366 'type' => CRM_Utils_Type::T_STRING,
367 'title' => ts('Report Instance Arguments'),
368 'description' => ts('arguments that are passed in the url when invoking the instance'),
369 'maxlength' => 255,
370 'size' => CRM_Utils_Type::HUGE,
371 'where' => 'civicrm_report_instance.args',
372 'table_name' => 'civicrm_report_instance',
373 'entity' => 'ReportInstance',
374 'bao' => 'CRM_Report_BAO_ReportInstance',
375 'localizable' => 0,
376 'html' => [
377 'type' => 'Text',
378 ],
379 'add' => '3.2',
380 ],
381 'description' => [
382 'name' => 'description',
383 'type' => CRM_Utils_Type::T_STRING,
384 'title' => ts('Report Instance description'),
385 'description' => ts('Report Instance description.'),
386 'maxlength' => 255,
387 'size' => CRM_Utils_Type::HUGE,
388 'where' => 'civicrm_report_instance.description',
389 'table_name' => 'civicrm_report_instance',
390 'entity' => 'ReportInstance',
391 'bao' => 'CRM_Report_BAO_ReportInstance',
392 'localizable' => 0,
393 'html' => [
394 'type' => 'Text',
395 ],
396 'add' => '2.2',
397 ],
398 'permission' => [
399 'name' => 'permission',
400 'type' => CRM_Utils_Type::T_STRING,
401 'title' => ts('Report Instance Permissions'),
402 'description' => ts('permission required to be able to run this instance'),
403 'maxlength' => 255,
404 'size' => CRM_Utils_Type::HUGE,
405 'where' => 'civicrm_report_instance.permission',
406 'table_name' => 'civicrm_report_instance',
407 'entity' => 'ReportInstance',
408 'bao' => 'CRM_Report_BAO_ReportInstance',
409 'localizable' => 0,
410 'html' => [
411 'type' => 'Text',
412 ],
413 'add' => '2.2',
414 ],
415 'grouprole' => [
416 'name' => 'grouprole',
417 'type' => CRM_Utils_Type::T_STRING,
418 'title' => ts('Report Instance Assigned to Roles'),
419 'description' => ts('role required to be able to run this instance'),
420 'maxlength' => 1024,
421 'size' => CRM_Utils_Type::HUGE,
422 'where' => 'civicrm_report_instance.grouprole',
423 'table_name' => 'civicrm_report_instance',
424 'entity' => 'ReportInstance',
425 'bao' => 'CRM_Report_BAO_ReportInstance',
426 'localizable' => 0,
427 'html' => [
428 'type' => 'Text',
429 ],
430 'add' => '4.1',
431 ],
432 'form_values' => [
433 'name' => 'form_values',
434 'type' => CRM_Utils_Type::T_LONGTEXT,
435 'title' => ts('Submitted Form Values'),
436 'description' => ts('Submitted form values for this report'),
437 'import' => TRUE,
438 'where' => 'civicrm_report_instance.form_values',
439 'export' => TRUE,
440 'table_name' => 'civicrm_report_instance',
441 'entity' => 'ReportInstance',
442 'bao' => 'CRM_Report_BAO_ReportInstance',
443 'localizable' => 0,
444 'serialize' => self::SERIALIZE_PHP,
445 'add' => '2.2',
446 ],
447 'is_active' => [
448 'name' => 'is_active',
449 'type' => CRM_Utils_Type::T_BOOLEAN,
450 'title' => ts('Report Instance is Active'),
451 'description' => ts('Is this entry active?'),
452 'required' => TRUE,
453 'where' => 'civicrm_report_instance.is_active',
454 'default' => '1',
455 'table_name' => 'civicrm_report_instance',
456 'entity' => 'ReportInstance',
457 'bao' => 'CRM_Report_BAO_ReportInstance',
458 'localizable' => 0,
459 'html' => [
460 'type' => 'CheckBox',
461 ],
462 'add' => '2.2',
463 ],
464 'created_id' => [
465 'name' => 'created_id',
466 'type' => CRM_Utils_Type::T_INT,
467 'title' => ts('Created By Contact ID'),
468 'description' => ts('FK to contact table.'),
469 'where' => 'civicrm_report_instance.created_id',
470 'table_name' => 'civicrm_report_instance',
471 'entity' => 'ReportInstance',
472 'bao' => 'CRM_Report_BAO_ReportInstance',
473 'localizable' => 0,
474 'FKClassName' => 'CRM_Contact_DAO_Contact',
475 'html' => [
476 'label' => ts("Created By"),
477 ],
478 'add' => '4.6',
479 ],
480 'owner_id' => [
481 'name' => 'owner_id',
482 'type' => CRM_Utils_Type::T_INT,
483 'title' => ts('Owned By Contact ID'),
484 'description' => ts('FK to contact table.'),
485 'where' => 'civicrm_report_instance.owner_id',
486 'table_name' => 'civicrm_report_instance',
487 'entity' => 'ReportInstance',
488 'bao' => 'CRM_Report_BAO_ReportInstance',
489 'localizable' => 0,
490 'FKClassName' => 'CRM_Contact_DAO_Contact',
491 'html' => [
492 'label' => ts("Owned By"),
493 ],
494 'add' => '4.6',
495 ],
496 'email_subject' => [
497 'name' => 'email_subject',
498 'type' => CRM_Utils_Type::T_STRING,
499 'title' => ts('Report Instance email Subject'),
500 'description' => ts('Subject of email'),
501 'maxlength' => 255,
502 'size' => CRM_Utils_Type::HUGE,
503 'where' => 'civicrm_report_instance.email_subject',
504 'table_name' => 'civicrm_report_instance',
505 'entity' => 'ReportInstance',
506 'bao' => 'CRM_Report_BAO_ReportInstance',
507 'localizable' => 0,
508 'html' => [
509 'type' => 'Text',
510 ],
511 'add' => NULL,
512 ],
513 'email_to' => [
514 'name' => 'email_to',
515 'type' => CRM_Utils_Type::T_TEXT,
516 'title' => ts('Email Report Instance To'),
517 'description' => ts('comma-separated list of email addresses to send the report to'),
518 'where' => 'civicrm_report_instance.email_to',
519 'table_name' => 'civicrm_report_instance',
520 'entity' => 'ReportInstance',
521 'bao' => 'CRM_Report_BAO_ReportInstance',
522 'localizable' => 0,
523 'html' => [
524 'type' => 'Text',
525 ],
526 'add' => '2.2',
527 ],
528 'email_cc' => [
529 'name' => 'email_cc',
530 'type' => CRM_Utils_Type::T_TEXT,
531 'title' => ts('cc Email Report Instance To'),
532 'description' => ts('comma-separated list of email addresses to send the report to'),
533 'where' => 'civicrm_report_instance.email_cc',
534 'table_name' => 'civicrm_report_instance',
535 'entity' => 'ReportInstance',
536 'bao' => 'CRM_Report_BAO_ReportInstance',
537 'localizable' => 0,
538 'html' => [
539 'type' => 'Text',
540 ],
541 'add' => '2.2',
542 ],
543 'header' => [
544 'name' => 'header',
545 'type' => CRM_Utils_Type::T_TEXT,
546 'title' => ts('Report Instance Header'),
547 'description' => ts('comma-separated list of email addresses to send the report to'),
548 'rows' => 4,
549 'cols' => 60,
550 'where' => 'civicrm_report_instance.header',
551 'table_name' => 'civicrm_report_instance',
552 'entity' => 'ReportInstance',
553 'bao' => 'CRM_Report_BAO_ReportInstance',
554 'localizable' => 0,
555 'html' => [
556 'type' => 'TextArea',
557 ],
558 'add' => '2.2',
559 ],
560 'footer' => [
561 'name' => 'footer',
562 'type' => CRM_Utils_Type::T_TEXT,
563 'title' => ts('Report Instance Footer'),
564 'description' => ts('comma-separated list of email addresses to send the report to'),
565 'rows' => 4,
566 'cols' => 60,
567 'where' => 'civicrm_report_instance.footer',
568 'table_name' => 'civicrm_report_instance',
569 'entity' => 'ReportInstance',
570 'bao' => 'CRM_Report_BAO_ReportInstance',
571 'localizable' => 0,
572 'html' => [
573 'type' => 'TextArea',
574 ],
575 'add' => '2.2',
576 ],
577 'navigation_id' => [
578 'name' => 'navigation_id',
579 'type' => CRM_Utils_Type::T_INT,
580 'title' => ts('Navigation ID'),
581 'description' => ts('FK to navigation ID'),
582 'import' => TRUE,
583 'where' => 'civicrm_report_instance.navigation_id',
584 'export' => TRUE,
585 'table_name' => 'civicrm_report_instance',
586 'entity' => 'ReportInstance',
587 'bao' => 'CRM_Report_BAO_ReportInstance',
588 'localizable' => 0,
589 'FKClassName' => 'CRM_Core_DAO_Navigation',
590 'html' => [
591 'label' => ts("Navigation"),
592 ],
593 'add' => '3.0',
594 ],
595 'drilldown_id' => [
596 'name' => 'drilldown_id',
597 'type' => CRM_Utils_Type::T_INT,
598 'title' => ts('Drilldown Report ID'),
599 'description' => ts('FK to instance ID drilldown to'),
600 'import' => TRUE,
601 'where' => 'civicrm_report_instance.drilldown_id',
602 'export' => TRUE,
603 'table_name' => 'civicrm_report_instance',
604 'entity' => 'ReportInstance',
605 'bao' => 'CRM_Report_BAO_ReportInstance',
606 'localizable' => 0,
607 'FKClassName' => 'CRM_Report_DAO_ReportInstance',
608 'html' => [
609 'label' => ts("Drilldown Report"),
610 ],
611 'add' => '4.3',
612 ],
613 'is_reserved' => [
614 'name' => 'is_reserved',
615 'type' => CRM_Utils_Type::T_BOOLEAN,
616 'title' => ts('Instance is Reserved'),
617 'required' => TRUE,
618 'where' => 'civicrm_report_instance.is_reserved',
619 'default' => '0',
620 'table_name' => 'civicrm_report_instance',
621 'entity' => 'ReportInstance',
622 'bao' => 'CRM_Report_BAO_ReportInstance',
623 'localizable' => 0,
624 'html' => [
625 'type' => 'CheckBox',
626 ],
627 'add' => '4.2',
628 ],
629 ];
630 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
631 }
632 return Civi::$statics[__CLASS__]['fields'];
633 }
634
635 /**
636 * Return a mapping from field-name to the corresponding key (as used in fields()).
637 *
638 * @return array
639 * Array(string $name => string $uniqueName).
640 */
641 public static function &fieldKeys() {
642 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
643 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
644 }
645 return Civi::$statics[__CLASS__]['fieldKeys'];
646 }
647
648 /**
649 * Returns the names of this table
650 *
651 * @return string
652 */
653 public static function getTableName() {
654 return self::$_tableName;
655 }
656
657 /**
658 * Returns if this table needs to be logged
659 *
660 * @return bool
661 */
662 public function getLog() {
663 return self::$_log;
664 }
665
666 /**
667 * Returns the list of fields that can be imported
668 *
669 * @param bool $prefix
670 *
671 * @return array
672 */
673 public static function &import($prefix = FALSE) {
674 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'report_instance', $prefix, []);
675 return $r;
676 }
677
678 /**
679 * Returns the list of fields that can be exported
680 *
681 * @param bool $prefix
682 *
683 * @return array
684 */
685 public static function &export($prefix = FALSE) {
686 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'report_instance', $prefix, []);
687 return $r;
688 }
689
690 /**
691 * Returns the list of indices
692 *
693 * @param bool $localize
694 *
695 * @return array
696 */
697 public static function indices($localize = TRUE) {
698 $indices = [];
699 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
700 }
701
702 }