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