Merge pull request #22560 from eileenmcnaughton/fin_type
[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:8119de0836afac038bfa8eeed2c0fb63)
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 'html' => [
243 'type' => 'Number',
244 ],
245 'readonly' => TRUE,
246 'add' => '2.2',
247 ],
248 'domain_id' => [
249 'name' => 'domain_id',
250 'type' => CRM_Utils_Type::T_INT,
251 'title' => ts('Domain ID'),
252 'description' => ts('Which Domain is this instance for'),
253 'required' => TRUE,
254 'where' => 'civicrm_report_instance.domain_id',
255 'table_name' => 'civicrm_report_instance',
256 'entity' => 'ReportInstance',
257 'bao' => 'CRM_Report_BAO_ReportInstance',
258 'localizable' => 0,
259 'FKClassName' => 'CRM_Core_DAO_Domain',
260 'html' => [
261 'label' => ts("Domain"),
262 ],
263 'pseudoconstant' => [
264 'table' => 'civicrm_domain',
265 'keyColumn' => 'id',
266 'labelColumn' => 'name',
267 ],
268 'add' => '3.1',
269 ],
270 'title' => [
271 'name' => 'title',
272 'type' => CRM_Utils_Type::T_STRING,
273 'title' => ts('Report Instance Title'),
274 'description' => ts('Report Instance Title.'),
275 'maxlength' => 255,
276 'size' => CRM_Utils_Type::HUGE,
277 'where' => 'civicrm_report_instance.title',
278 'table_name' => 'civicrm_report_instance',
279 'entity' => 'ReportInstance',
280 'bao' => 'CRM_Report_BAO_ReportInstance',
281 'localizable' => 0,
282 'html' => [
283 'type' => 'Text',
284 ],
285 'add' => '2.2',
286 ],
287 'report_id' => [
288 'name' => 'report_id',
289 'type' => CRM_Utils_Type::T_STRING,
290 'title' => ts('Report template ID'),
291 'description' => ts('FK to civicrm_option_value for the report template'),
292 'required' => TRUE,
293 'maxlength' => 512,
294 'size' => CRM_Utils_Type::HUGE,
295 'where' => 'civicrm_report_instance.report_id',
296 'table_name' => 'civicrm_report_instance',
297 'entity' => 'ReportInstance',
298 'bao' => 'CRM_Report_BAO_ReportInstance',
299 'localizable' => 0,
300 'html' => [
301 'type' => 'Select',
302 ],
303 'add' => '2.2',
304 ],
305 'name' => [
306 'name' => 'name',
307 'type' => CRM_Utils_Type::T_STRING,
308 'title' => ts('Report instance Name'),
309 'description' => ts('when combined with report_id/template uniquely identifies the instance'),
310 'maxlength' => 255,
311 'size' => CRM_Utils_Type::HUGE,
312 'where' => 'civicrm_report_instance.name',
313 'table_name' => 'civicrm_report_instance',
314 'entity' => 'ReportInstance',
315 'bao' => 'CRM_Report_BAO_ReportInstance',
316 'localizable' => 0,
317 'html' => [
318 'type' => 'Text',
319 ],
320 'add' => '3.2',
321 ],
322 'args' => [
323 'name' => 'args',
324 'type' => CRM_Utils_Type::T_STRING,
325 'title' => ts('Report Instance Arguments'),
326 'description' => ts('arguments that are passed in the url when invoking the instance'),
327 'maxlength' => 255,
328 'size' => CRM_Utils_Type::HUGE,
329 'where' => 'civicrm_report_instance.args',
330 'table_name' => 'civicrm_report_instance',
331 'entity' => 'ReportInstance',
332 'bao' => 'CRM_Report_BAO_ReportInstance',
333 'localizable' => 0,
334 'html' => [
335 'type' => 'Text',
336 ],
337 'add' => '3.2',
338 ],
339 'description' => [
340 'name' => 'description',
341 'type' => CRM_Utils_Type::T_STRING,
342 'title' => ts('Report Instance description'),
343 'description' => ts('Report Instance description.'),
344 'maxlength' => 255,
345 'size' => CRM_Utils_Type::HUGE,
346 'where' => 'civicrm_report_instance.description',
347 'table_name' => 'civicrm_report_instance',
348 'entity' => 'ReportInstance',
349 'bao' => 'CRM_Report_BAO_ReportInstance',
350 'localizable' => 0,
351 'html' => [
352 'type' => 'Text',
353 ],
354 'add' => '2.2',
355 ],
356 'permission' => [
357 'name' => 'permission',
358 'type' => CRM_Utils_Type::T_STRING,
359 'title' => ts('Report Instance Permissions'),
360 'description' => ts('permission required to be able to run this instance'),
361 'maxlength' => 255,
362 'size' => CRM_Utils_Type::HUGE,
363 'where' => 'civicrm_report_instance.permission',
364 'table_name' => 'civicrm_report_instance',
365 'entity' => 'ReportInstance',
366 'bao' => 'CRM_Report_BAO_ReportInstance',
367 'localizable' => 0,
368 'html' => [
369 'type' => 'Text',
370 ],
371 'add' => '2.2',
372 ],
373 'grouprole' => [
374 'name' => 'grouprole',
375 'type' => CRM_Utils_Type::T_STRING,
376 'title' => ts('Report Instance Assigned to Roles'),
377 'description' => ts('role required to be able to run this instance'),
378 'maxlength' => 1024,
379 'size' => CRM_Utils_Type::HUGE,
380 'where' => 'civicrm_report_instance.grouprole',
381 'table_name' => 'civicrm_report_instance',
382 'entity' => 'ReportInstance',
383 'bao' => 'CRM_Report_BAO_ReportInstance',
384 'localizable' => 0,
385 'html' => [
386 'type' => 'Text',
387 ],
388 'add' => '4.1',
389 ],
390 'form_values' => [
391 'name' => 'form_values',
392 'type' => CRM_Utils_Type::T_LONGTEXT,
393 'title' => ts('Submitted Form Values'),
394 'description' => ts('Submitted form values for this report'),
395 'import' => TRUE,
396 'where' => 'civicrm_report_instance.form_values',
397 'export' => TRUE,
398 'table_name' => 'civicrm_report_instance',
399 'entity' => 'ReportInstance',
400 'bao' => 'CRM_Report_BAO_ReportInstance',
401 'localizable' => 0,
402 'serialize' => self::SERIALIZE_PHP,
403 'add' => '2.2',
404 ],
405 'is_active' => [
406 'name' => 'is_active',
407 'type' => CRM_Utils_Type::T_BOOLEAN,
408 'title' => ts('Report Instance is Active'),
409 'description' => ts('Is this entry active?'),
410 'where' => 'civicrm_report_instance.is_active',
411 'table_name' => 'civicrm_report_instance',
412 'entity' => 'ReportInstance',
413 'bao' => 'CRM_Report_BAO_ReportInstance',
414 'localizable' => 0,
415 'html' => [
416 'type' => 'CheckBox',
417 ],
418 'add' => '2.2',
419 ],
420 'created_id' => [
421 'name' => 'created_id',
422 'type' => CRM_Utils_Type::T_INT,
423 'title' => ts('Created By Contact ID'),
424 'description' => ts('FK to contact table.'),
425 'where' => 'civicrm_report_instance.created_id',
426 'table_name' => 'civicrm_report_instance',
427 'entity' => 'ReportInstance',
428 'bao' => 'CRM_Report_BAO_ReportInstance',
429 'localizable' => 0,
430 'FKClassName' => 'CRM_Contact_DAO_Contact',
431 'html' => [
432 'label' => ts("Created By"),
433 ],
434 'add' => '4.6',
435 ],
436 'owner_id' => [
437 'name' => 'owner_id',
438 'type' => CRM_Utils_Type::T_INT,
439 'title' => ts('Owned By Contact ID'),
440 'description' => ts('FK to contact table.'),
441 'where' => 'civicrm_report_instance.owner_id',
442 'table_name' => 'civicrm_report_instance',
443 'entity' => 'ReportInstance',
444 'bao' => 'CRM_Report_BAO_ReportInstance',
445 'localizable' => 0,
446 'FKClassName' => 'CRM_Contact_DAO_Contact',
447 'html' => [
448 'label' => ts("Owned By"),
449 ],
450 'add' => '4.6',
451 ],
452 'email_subject' => [
453 'name' => 'email_subject',
454 'type' => CRM_Utils_Type::T_STRING,
455 'title' => ts('Report Instance email Subject'),
456 'description' => ts('Subject of email'),
457 'maxlength' => 255,
458 'size' => CRM_Utils_Type::HUGE,
459 'where' => 'civicrm_report_instance.email_subject',
460 'table_name' => 'civicrm_report_instance',
461 'entity' => 'ReportInstance',
462 'bao' => 'CRM_Report_BAO_ReportInstance',
463 'localizable' => 0,
464 'html' => [
465 'type' => 'Text',
466 ],
467 'add' => NULL,
468 ],
469 'email_to' => [
470 'name' => 'email_to',
471 'type' => CRM_Utils_Type::T_TEXT,
472 'title' => ts('Email Report Instance To'),
473 'description' => ts('comma-separated list of email addresses to send the report to'),
474 'where' => 'civicrm_report_instance.email_to',
475 'table_name' => 'civicrm_report_instance',
476 'entity' => 'ReportInstance',
477 'bao' => 'CRM_Report_BAO_ReportInstance',
478 'localizable' => 0,
479 'html' => [
480 'type' => 'Text',
481 ],
482 'add' => '2.2',
483 ],
484 'email_cc' => [
485 'name' => 'email_cc',
486 'type' => CRM_Utils_Type::T_TEXT,
487 'title' => ts('cc Email Report Instance To'),
488 'description' => ts('comma-separated list of email addresses to send the report to'),
489 'where' => 'civicrm_report_instance.email_cc',
490 'table_name' => 'civicrm_report_instance',
491 'entity' => 'ReportInstance',
492 'bao' => 'CRM_Report_BAO_ReportInstance',
493 'localizable' => 0,
494 'html' => [
495 'type' => 'Text',
496 ],
497 'add' => '2.2',
498 ],
499 'header' => [
500 'name' => 'header',
501 'type' => CRM_Utils_Type::T_TEXT,
502 'title' => ts('Report Instance Header'),
503 'description' => ts('comma-separated list of email addresses to send the report to'),
504 'rows' => 4,
505 'cols' => 60,
506 'where' => 'civicrm_report_instance.header',
507 'table_name' => 'civicrm_report_instance',
508 'entity' => 'ReportInstance',
509 'bao' => 'CRM_Report_BAO_ReportInstance',
510 'localizable' => 0,
511 'html' => [
512 'type' => 'TextArea',
513 ],
514 'add' => '2.2',
515 ],
516 'footer' => [
517 'name' => 'footer',
518 'type' => CRM_Utils_Type::T_TEXT,
519 'title' => ts('Report Instance Footer'),
520 'description' => ts('comma-separated list of email addresses to send the report to'),
521 'rows' => 4,
522 'cols' => 60,
523 'where' => 'civicrm_report_instance.footer',
524 'table_name' => 'civicrm_report_instance',
525 'entity' => 'ReportInstance',
526 'bao' => 'CRM_Report_BAO_ReportInstance',
527 'localizable' => 0,
528 'html' => [
529 'type' => 'TextArea',
530 ],
531 'add' => '2.2',
532 ],
533 'navigation_id' => [
534 'name' => 'navigation_id',
535 'type' => CRM_Utils_Type::T_INT,
536 'title' => ts('Navigation ID'),
537 'description' => ts('FK to navigation ID'),
538 'import' => TRUE,
539 'where' => 'civicrm_report_instance.navigation_id',
540 'export' => TRUE,
541 'table_name' => 'civicrm_report_instance',
542 'entity' => 'ReportInstance',
543 'bao' => 'CRM_Report_BAO_ReportInstance',
544 'localizable' => 0,
545 'FKClassName' => 'CRM_Core_DAO_Navigation',
546 'html' => [
547 'label' => ts("Navigation"),
548 ],
549 'add' => '3.0',
550 ],
551 'drilldown_id' => [
552 'name' => 'drilldown_id',
553 'type' => CRM_Utils_Type::T_INT,
554 'title' => ts('Drilldown Report ID'),
555 'description' => ts('FK to instance ID drilldown to'),
556 'import' => TRUE,
557 'where' => 'civicrm_report_instance.drilldown_id',
558 'export' => TRUE,
559 'table_name' => 'civicrm_report_instance',
560 'entity' => 'ReportInstance',
561 'bao' => 'CRM_Report_BAO_ReportInstance',
562 'localizable' => 0,
563 'FKClassName' => 'CRM_Report_DAO_ReportInstance',
564 'html' => [
565 'label' => ts("Drilldown Report"),
566 ],
567 'add' => '4.3',
568 ],
569 'is_reserved' => [
570 'name' => 'is_reserved',
571 'type' => CRM_Utils_Type::T_BOOLEAN,
572 'title' => ts('Instance is Reserved'),
573 'where' => 'civicrm_report_instance.is_reserved',
574 'default' => '0',
575 'table_name' => 'civicrm_report_instance',
576 'entity' => 'ReportInstance',
577 'bao' => 'CRM_Report_BAO_ReportInstance',
578 'localizable' => 0,
579 'html' => [
580 'type' => 'CheckBox',
581 ],
582 'add' => '4.2',
583 ],
584 ];
585 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
586 }
587 return Civi::$statics[__CLASS__]['fields'];
588 }
589
590 /**
591 * Return a mapping from field-name to the corresponding key (as used in fields()).
592 *
593 * @return array
594 * Array(string $name => string $uniqueName).
595 */
596 public static function &fieldKeys() {
597 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
598 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
599 }
600 return Civi::$statics[__CLASS__]['fieldKeys'];
601 }
602
603 /**
604 * Returns the names of this table
605 *
606 * @return string
607 */
608 public static function getTableName() {
609 return self::$_tableName;
610 }
611
612 /**
613 * Returns if this table needs to be logged
614 *
615 * @return bool
616 */
617 public function getLog() {
618 return self::$_log;
619 }
620
621 /**
622 * Returns the list of fields that can be imported
623 *
624 * @param bool $prefix
625 *
626 * @return array
627 */
628 public static function &import($prefix = FALSE) {
629 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'report_instance', $prefix, []);
630 return $r;
631 }
632
633 /**
634 * Returns the list of fields that can be exported
635 *
636 * @param bool $prefix
637 *
638 * @return array
639 */
640 public static function &export($prefix = FALSE) {
641 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'report_instance', $prefix, []);
642 return $r;
643 }
644
645 /**
646 * Returns the list of indices
647 *
648 * @param bool $localize
649 *
650 * @return array
651 */
652 public static function indices($localize = TRUE) {
653 $indices = [];
654 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
655 }
656
657 }