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