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