Schema - Fix boolean fields in various tables
[civicrm-core.git] / CRM / Activity / DAO / Activity.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Activity/Activity.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:84bf6ac4a394e07666a4b2fb1456a794)
10 */
11
12 /**
13 * Database access object for the Activity entity.
14 */
15 class CRM_Activity_DAO_Activity extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.1';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_activity';
25
26 /**
27 * Icon associated with this entity.
28 *
29 * @var string
30 */
31 public static $_icon = 'fa-tasks';
32
33 /**
34 * Field to show when displaying a record.
35 *
36 * @var string
37 */
38 public static $_labelField = 'subject';
39
40 /**
41 * Should CiviCRM log any modifications to this table in the civicrm_log table.
42 *
43 * @var bool
44 */
45 public static $_log = TRUE;
46
47 /**
48 * Paths for accessing this entity in the UI.
49 *
50 * @var string[]
51 */
52 protected static $_paths = [
53 'add' => 'civicrm/activity?reset=1&action=add&context=standalone',
54 'view' => 'civicrm/activity?reset=1&action=view&id=[id]',
55 'update' => 'civicrm/activity/add?reset=1&action=update&id=[id]',
56 'delete' => 'civicrm/activity?reset=1&action=delete&id=[id]',
57 ];
58
59 /**
60 * Unique Other Activity ID
61 *
62 * @var int|string|null
63 * (SQL type: int unsigned)
64 * Note that values will be retrieved from the database as a string.
65 */
66 public $id;
67
68 /**
69 * Artificial FK to original transaction (e.g. contribution) IF it is not an Activity. Table can be figured out through activity_type_id, and further through component registry.
70 *
71 * @var int|string|null
72 * (SQL type: int unsigned)
73 * Note that values will be retrieved from the database as a string.
74 */
75 public $source_record_id;
76
77 /**
78 * FK to civicrm_option_value.id, that has to be valid, registered activity type.
79 *
80 * @var int|string
81 * (SQL type: int unsigned)
82 * Note that values will be retrieved from the database as a string.
83 */
84 public $activity_type_id;
85
86 /**
87 * The subject/purpose/short description of the activity.
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 $subject;
94
95 /**
96 * Date and time this activity is scheduled to occur. Formerly named scheduled_date_time.
97 *
98 * @var string
99 * (SQL type: datetime)
100 * Note that values will be retrieved from the database as a string.
101 */
102 public $activity_date_time;
103
104 /**
105 * Planned or actual duration of activity expressed in minutes. Conglomerate of former duration_hours and duration_minutes.
106 *
107 * @var int|string|null
108 * (SQL type: int unsigned)
109 * Note that values will be retrieved from the database as a string.
110 */
111 public $duration;
112
113 /**
114 * Location of the activity (optional, open text).
115 *
116 * @var string|null
117 * (SQL type: varchar(255))
118 * Note that values will be retrieved from the database as a string.
119 */
120 public $location;
121
122 /**
123 * Phone ID of the number called (optional - used if an existing phone number is selected).
124 *
125 * @var int|string|null
126 * (SQL type: int unsigned)
127 * Note that values will be retrieved from the database as a string.
128 */
129 public $phone_id;
130
131 /**
132 * Phone number in case the number does not exist in the civicrm_phone table.
133 *
134 * @var string|null
135 * (SQL type: varchar(64))
136 * Note that values will be retrieved from the database as a string.
137 */
138 public $phone_number;
139
140 /**
141 * Details about the activity (agenda, notes, etc).
142 *
143 * @var string|null
144 * (SQL type: longtext)
145 * Note that values will be retrieved from the database as a string.
146 */
147 public $details;
148
149 /**
150 * ID of the status this activity is currently in. Foreign key to civicrm_option_value.
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 $status_id;
157
158 /**
159 * ID of the priority given to this activity. Foreign key to civicrm_option_value.
160 *
161 * @var int|string|null
162 * (SQL type: int unsigned)
163 * Note that values will be retrieved from the database as a string.
164 */
165 public $priority_id;
166
167 /**
168 * Parent meeting ID (if this is a follow-up item). This is not currently implemented
169 *
170 * @var int|string|null
171 * (SQL type: int unsigned)
172 * Note that values will be retrieved from the database as a string.
173 */
174 public $parent_id;
175
176 /**
177 * @var bool|string
178 * (SQL type: tinyint)
179 * Note that values will be retrieved from the database as a string.
180 */
181 public $is_test;
182
183 /**
184 * Activity Medium, Implicit FK to civicrm_option_value where option_group = encounter_medium.
185 *
186 * @var int|string|null
187 * (SQL type: int unsigned)
188 * Note that values will be retrieved from the database as a string.
189 */
190 public $medium_id;
191
192 /**
193 * @var bool|string
194 * (SQL type: tinyint)
195 * Note that values will be retrieved from the database as a string.
196 */
197 public $is_auto;
198
199 /**
200 * FK to Relationship ID
201 *
202 * @var int|string|null
203 * (SQL type: int unsigned)
204 * Note that values will be retrieved from the database as a string.
205 */
206 public $relationship_id;
207
208 /**
209 * @var bool|string
210 * (SQL type: tinyint)
211 * Note that values will be retrieved from the database as a string.
212 */
213 public $is_current_revision;
214
215 /**
216 * Activity ID of the first activity record in versioning chain.
217 *
218 * @var int|string|null
219 * (SQL type: int unsigned)
220 * Note that values will be retrieved from the database as a string.
221 */
222 public $original_id;
223
224 /**
225 * Currently being used to store result id for survey activity, FK to option value.
226 *
227 * @var string|null
228 * (SQL type: varchar(255))
229 * Note that values will be retrieved from the database as a string.
230 */
231 public $result;
232
233 /**
234 * @var bool|string
235 * (SQL type: tinyint)
236 * Note that values will be retrieved from the database as a string.
237 */
238 public $is_deleted;
239
240 /**
241 * The campaign for which this activity has been triggered.
242 *
243 * @var int|string|null
244 * (SQL type: int unsigned)
245 * Note that values will be retrieved from the database as a string.
246 */
247 public $campaign_id;
248
249 /**
250 * Assign a specific level of engagement to this activity. Used for tracking constituents in ladder of engagement.
251 *
252 * @var int|string|null
253 * (SQL type: int unsigned)
254 * Note that values will be retrieved from the database as a string.
255 */
256 public $engagement_level;
257
258 /**
259 * @var int|string|null
260 * (SQL type: int)
261 * Note that values will be retrieved from the database as a string.
262 */
263 public $weight;
264
265 /**
266 * Activity marked as favorite.
267 *
268 * @var bool|string
269 * (SQL type: tinyint)
270 * Note that values will be retrieved from the database as a string.
271 */
272 public $is_star;
273
274 /**
275 * When was the activity was created.
276 *
277 * @var string
278 * (SQL type: timestamp)
279 * Note that values will be retrieved from the database as a string.
280 */
281 public $created_date;
282
283 /**
284 * When was the activity (or closely related entity) was created or modified or deleted.
285 *
286 * @var string
287 * (SQL type: timestamp)
288 * Note that values will be retrieved from the database as a string.
289 */
290 public $modified_date;
291
292 /**
293 * Class constructor.
294 */
295 public function __construct() {
296 $this->__table = 'civicrm_activity';
297 parent::__construct();
298 }
299
300 /**
301 * Returns localized title of this entity.
302 *
303 * @param bool $plural
304 * Whether to return the plural version of the title.
305 */
306 public static function getEntityTitle($plural = FALSE) {
307 return $plural ? ts('Activities') : ts('Activity');
308 }
309
310 /**
311 * Returns user-friendly description of this entity.
312 *
313 * @return string
314 */
315 public static function getEntityDescription() {
316 return ts('Past or future actions concerning one or more contacts.');
317 }
318
319 /**
320 * Returns foreign keys and entity references.
321 *
322 * @return array
323 * [CRM_Core_Reference_Interface]
324 */
325 public static function getReferenceColumns() {
326 if (!isset(Civi::$statics[__CLASS__]['links'])) {
327 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
328 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_id', 'civicrm_phone', 'id');
329 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_activity', 'id');
330 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'relationship_id', 'civicrm_relationship', 'id');
331 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'original_id', 'civicrm_activity', 'id');
332 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
333 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
334 }
335 return Civi::$statics[__CLASS__]['links'];
336 }
337
338 /**
339 * Returns all the column names of this table
340 *
341 * @return array
342 */
343 public static function &fields() {
344 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
345 Civi::$statics[__CLASS__]['fields'] = [
346 'activity_id' => [
347 'name' => 'id',
348 'type' => CRM_Utils_Type::T_INT,
349 'title' => ts('Activity ID'),
350 'description' => ts('Unique Other Activity ID'),
351 'required' => TRUE,
352 'import' => TRUE,
353 'where' => 'civicrm_activity.id',
354 'export' => TRUE,
355 'table_name' => 'civicrm_activity',
356 'entity' => 'Activity',
357 'bao' => 'CRM_Activity_BAO_Activity',
358 'localizable' => 0,
359 'html' => [
360 'type' => 'Number',
361 ],
362 'readonly' => TRUE,
363 'add' => '1.1',
364 ],
365 'source_record_id' => [
366 'name' => 'source_record_id',
367 'type' => CRM_Utils_Type::T_INT,
368 'title' => ts('Source Record'),
369 'description' => ts('Artificial FK to original transaction (e.g. contribution) IF it is not an Activity. Table can be figured out through activity_type_id, and further through component registry.'),
370 'where' => 'civicrm_activity.source_record_id',
371 'table_name' => 'civicrm_activity',
372 'entity' => 'Activity',
373 'bao' => 'CRM_Activity_BAO_Activity',
374 'localizable' => 0,
375 'readonly' => TRUE,
376 'add' => '2.0',
377 ],
378 'activity_type_id' => [
379 'name' => 'activity_type_id',
380 'type' => CRM_Utils_Type::T_INT,
381 'title' => ts('Activity Type ID'),
382 'description' => ts('FK to civicrm_option_value.id, that has to be valid, registered activity type.'),
383 'required' => TRUE,
384 'import' => TRUE,
385 'where' => 'civicrm_activity.activity_type_id',
386 'headerPattern' => '/(activity.)?type(.id$)/i',
387 'export' => TRUE,
388 'default' => '1',
389 'table_name' => 'civicrm_activity',
390 'entity' => 'Activity',
391 'bao' => 'CRM_Activity_BAO_Activity',
392 'localizable' => 0,
393 'html' => [
394 'type' => 'Select',
395 'label' => ts("Activity Type"),
396 ],
397 'pseudoconstant' => [
398 'optionGroupName' => 'activity_type',
399 'optionEditPath' => 'civicrm/admin/options/activity_type',
400 ],
401 'add' => '1.1',
402 ],
403 'activity_subject' => [
404 'name' => 'subject',
405 'type' => CRM_Utils_Type::T_STRING,
406 'title' => ts('Subject'),
407 'description' => ts('The subject/purpose/short description of the activity.'),
408 'maxlength' => 255,
409 'size' => CRM_Utils_Type::HUGE,
410 'import' => TRUE,
411 'where' => 'civicrm_activity.subject',
412 'headerPattern' => '/(activity.)?subject/i',
413 'export' => TRUE,
414 'table_name' => 'civicrm_activity',
415 'entity' => 'Activity',
416 'bao' => 'CRM_Activity_BAO_Activity',
417 'localizable' => 0,
418 'html' => [
419 'type' => 'Text',
420 ],
421 'add' => '1.1',
422 ],
423 'activity_date_time' => [
424 'name' => 'activity_date_time',
425 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
426 'title' => ts('Activity Date'),
427 'description' => ts('Date and time this activity is scheduled to occur. Formerly named scheduled_date_time.'),
428 'required' => FALSE,
429 'import' => TRUE,
430 'where' => 'civicrm_activity.activity_date_time',
431 'headerPattern' => '/(activity.)?date(.time$)?/i',
432 'export' => TRUE,
433 'default' => 'CURRENT_TIMESTAMP',
434 'table_name' => 'civicrm_activity',
435 'entity' => 'Activity',
436 'bao' => 'CRM_Activity_BAO_Activity',
437 'localizable' => 0,
438 'html' => [
439 'type' => 'Select Date',
440 'formatType' => 'activityDateTime',
441 ],
442 'add' => '2.0',
443 ],
444 'activity_duration' => [
445 'name' => 'duration',
446 'type' => CRM_Utils_Type::T_INT,
447 'title' => ts('Duration'),
448 'description' => ts('Planned or actual duration of activity expressed in minutes. Conglomerate of former duration_hours and duration_minutes.'),
449 'import' => TRUE,
450 'where' => 'civicrm_activity.duration',
451 'headerPattern' => '/(activity.)?duration(s)?$/i',
452 'export' => TRUE,
453 'table_name' => 'civicrm_activity',
454 'entity' => 'Activity',
455 'bao' => 'CRM_Activity_BAO_Activity',
456 'localizable' => 0,
457 'html' => [
458 'type' => 'Number',
459 ],
460 'add' => '2.0',
461 ],
462 'activity_location' => [
463 'name' => 'location',
464 'type' => CRM_Utils_Type::T_STRING,
465 'title' => ts('Location'),
466 'description' => ts('Location of the activity (optional, open text).'),
467 'maxlength' => 255,
468 'size' => CRM_Utils_Type::HUGE,
469 'import' => TRUE,
470 'where' => 'civicrm_activity.location',
471 'headerPattern' => '/(activity.)?location$/i',
472 'export' => TRUE,
473 'table_name' => 'civicrm_activity',
474 'entity' => 'Activity',
475 'bao' => 'CRM_Activity_BAO_Activity',
476 'localizable' => 0,
477 'html' => [
478 'type' => 'Text',
479 ],
480 'add' => '1.1',
481 ],
482 'phone_id' => [
483 'name' => 'phone_id',
484 'type' => CRM_Utils_Type::T_INT,
485 'title' => ts('Phone ID (called)'),
486 'description' => ts('Phone ID of the number called (optional - used if an existing phone number is selected).'),
487 'where' => 'civicrm_activity.phone_id',
488 'table_name' => 'civicrm_activity',
489 'entity' => 'Activity',
490 'bao' => 'CRM_Activity_BAO_Activity',
491 'localizable' => 0,
492 'FKClassName' => 'CRM_Core_DAO_Phone',
493 'html' => [
494 'type' => 'EntityRef',
495 'label' => ts("Phone (called)"),
496 ],
497 'add' => '2.0',
498 ],
499 'phone_number' => [
500 'name' => 'phone_number',
501 'type' => CRM_Utils_Type::T_STRING,
502 'title' => ts('Phone (called) Number'),
503 'description' => ts('Phone number in case the number does not exist in the civicrm_phone table.'),
504 'maxlength' => 64,
505 'size' => CRM_Utils_Type::BIG,
506 'where' => 'civicrm_activity.phone_number',
507 'table_name' => 'civicrm_activity',
508 'entity' => 'Activity',
509 'bao' => 'CRM_Activity_BAO_Activity',
510 'localizable' => 0,
511 'html' => [
512 'type' => 'Text',
513 ],
514 'add' => '2.0',
515 ],
516 'activity_details' => [
517 'name' => 'details',
518 'type' => CRM_Utils_Type::T_LONGTEXT,
519 'title' => ts('Details'),
520 'description' => ts('Details about the activity (agenda, notes, etc).'),
521 'import' => TRUE,
522 'where' => 'civicrm_activity.details',
523 'headerPattern' => '/(activity.)?detail(s)?$/i',
524 'export' => TRUE,
525 'table_name' => 'civicrm_activity',
526 'entity' => 'Activity',
527 'bao' => 'CRM_Activity_BAO_Activity',
528 'localizable' => 0,
529 'html' => [
530 'type' => 'RichTextEditor',
531 ],
532 'add' => '1.1',
533 ],
534 'activity_status_id' => [
535 'name' => 'status_id',
536 'type' => CRM_Utils_Type::T_INT,
537 'title' => ts('Activity Status'),
538 'description' => ts('ID of the status this activity is currently in. Foreign key to civicrm_option_value.'),
539 'import' => TRUE,
540 'where' => 'civicrm_activity.status_id',
541 'headerPattern' => '/(activity.)?status(.label$)?/i',
542 'export' => TRUE,
543 'table_name' => 'civicrm_activity',
544 'entity' => 'Activity',
545 'bao' => 'CRM_Activity_BAO_Activity',
546 'localizable' => 0,
547 'html' => [
548 'type' => 'Select',
549 ],
550 'pseudoconstant' => [
551 'optionGroupName' => 'activity_status',
552 'optionEditPath' => 'civicrm/admin/options/activity_status',
553 ],
554 'add' => '2.0',
555 ],
556 'priority_id' => [
557 'name' => 'priority_id',
558 'type' => CRM_Utils_Type::T_INT,
559 'title' => ts('Priority'),
560 'description' => ts('ID of the priority given to this activity. Foreign key to civicrm_option_value.'),
561 'import' => TRUE,
562 'where' => 'civicrm_activity.priority_id',
563 'export' => TRUE,
564 'table_name' => 'civicrm_activity',
565 'entity' => 'Activity',
566 'bao' => 'CRM_Activity_BAO_Activity',
567 'localizable' => 0,
568 'html' => [
569 'type' => 'Select',
570 ],
571 'pseudoconstant' => [
572 'optionGroupName' => 'priority',
573 'optionEditPath' => 'civicrm/admin/options/priority',
574 ],
575 'add' => '2.0',
576 ],
577 'parent_id' => [
578 'name' => 'parent_id',
579 'type' => CRM_Utils_Type::T_INT,
580 'title' => ts('Parent Activity ID'),
581 'description' => ts('Parent meeting ID (if this is a follow-up item). This is not currently implemented'),
582 'where' => 'civicrm_activity.parent_id',
583 'table_name' => 'civicrm_activity',
584 'entity' => 'Activity',
585 'bao' => 'CRM_Activity_BAO_Activity',
586 'localizable' => 0,
587 'FKClassName' => 'CRM_Activity_DAO_Activity',
588 'html' => [
589 'label' => ts("Parent Activity"),
590 ],
591 'readonly' => TRUE,
592 'add' => '1.1',
593 ],
594 'activity_is_test' => [
595 'name' => 'is_test',
596 'type' => CRM_Utils_Type::T_BOOLEAN,
597 'title' => ts('Test'),
598 'required' => TRUE,
599 'import' => TRUE,
600 'where' => 'civicrm_activity.is_test',
601 'headerPattern' => '/(is.)?test(.activity)?/i',
602 'export' => TRUE,
603 'default' => '0',
604 'table_name' => 'civicrm_activity',
605 'entity' => 'Activity',
606 'bao' => 'CRM_Activity_BAO_Activity',
607 'localizable' => 0,
608 'html' => [
609 'type' => 'CheckBox',
610 ],
611 'add' => '2.0',
612 ],
613 'activity_medium_id' => [
614 'name' => 'medium_id',
615 'type' => CRM_Utils_Type::T_INT,
616 'title' => ts('Activity Medium'),
617 'description' => ts('Activity Medium, Implicit FK to civicrm_option_value where option_group = encounter_medium.'),
618 'where' => 'civicrm_activity.medium_id',
619 'default' => NULL,
620 'table_name' => 'civicrm_activity',
621 'entity' => 'Activity',
622 'bao' => 'CRM_Activity_BAO_Activity',
623 'localizable' => 0,
624 'html' => [
625 'type' => 'Select',
626 ],
627 'pseudoconstant' => [
628 'optionGroupName' => 'encounter_medium',
629 'optionEditPath' => 'civicrm/admin/options/encounter_medium',
630 ],
631 'add' => '2.2',
632 ],
633 'is_auto' => [
634 'name' => 'is_auto',
635 'type' => CRM_Utils_Type::T_BOOLEAN,
636 'title' => ts('Auto'),
637 'required' => TRUE,
638 'where' => 'civicrm_activity.is_auto',
639 'default' => '0',
640 'table_name' => 'civicrm_activity',
641 'entity' => 'Activity',
642 'bao' => 'CRM_Activity_BAO_Activity',
643 'localizable' => 0,
644 'add' => '2.2',
645 ],
646 'relationship_id' => [
647 'name' => 'relationship_id',
648 'type' => CRM_Utils_Type::T_INT,
649 'title' => ts('Relationship ID'),
650 'description' => ts('FK to Relationship ID'),
651 'where' => 'civicrm_activity.relationship_id',
652 'default' => NULL,
653 'table_name' => 'civicrm_activity',
654 'entity' => 'Activity',
655 'bao' => 'CRM_Activity_BAO_Activity',
656 'localizable' => 0,
657 'FKClassName' => 'CRM_Contact_DAO_Relationship',
658 'html' => [
659 'label' => ts("Relationship"),
660 ],
661 'add' => '2.2',
662 ],
663 'is_current_revision' => [
664 'name' => 'is_current_revision',
665 'type' => CRM_Utils_Type::T_BOOLEAN,
666 'title' => ts('Is this activity a current revision in versioning chain?'),
667 'required' => TRUE,
668 'import' => TRUE,
669 'where' => 'civicrm_activity.is_current_revision',
670 'headerPattern' => '/(is.)?(current.)?(revision|version(ing)?)/i',
671 'export' => TRUE,
672 'default' => '1',
673 'table_name' => 'civicrm_activity',
674 'entity' => 'Activity',
675 'bao' => 'CRM_Activity_BAO_Activity',
676 'localizable' => 0,
677 'add' => '2.2',
678 ],
679 'original_id' => [
680 'name' => 'original_id',
681 'type' => CRM_Utils_Type::T_INT,
682 'title' => ts('Original Activity ID'),
683 'description' => ts('Activity ID of the first activity record in versioning chain.'),
684 'where' => 'civicrm_activity.original_id',
685 'table_name' => 'civicrm_activity',
686 'entity' => 'Activity',
687 'bao' => 'CRM_Activity_BAO_Activity',
688 'localizable' => 0,
689 'FKClassName' => 'CRM_Activity_DAO_Activity',
690 'html' => [
691 'label' => ts("Original Activity"),
692 ],
693 'readonly' => TRUE,
694 'add' => '2.2',
695 ],
696 'activity_result' => [
697 'name' => 'result',
698 'type' => CRM_Utils_Type::T_STRING,
699 'title' => ts('Result'),
700 'description' => ts('Currently being used to store result id for survey activity, FK to option value.'),
701 'maxlength' => 255,
702 'size' => CRM_Utils_Type::HUGE,
703 'where' => 'civicrm_activity.result',
704 'table_name' => 'civicrm_activity',
705 'entity' => 'Activity',
706 'bao' => 'CRM_Activity_BAO_Activity',
707 'localizable' => 0,
708 'add' => '3.3',
709 ],
710 'activity_is_deleted' => [
711 'name' => 'is_deleted',
712 'type' => CRM_Utils_Type::T_BOOLEAN,
713 'title' => ts('Activity is in the Trash'),
714 'required' => TRUE,
715 'import' => TRUE,
716 'where' => 'civicrm_activity.is_deleted',
717 'headerPattern' => '/(activity.)?(trash|deleted)/i',
718 'export' => TRUE,
719 'default' => '0',
720 'table_name' => 'civicrm_activity',
721 'entity' => 'Activity',
722 'bao' => 'CRM_Activity_BAO_Activity',
723 'localizable' => 0,
724 'html' => [
725 'type' => 'CheckBox',
726 ],
727 'add' => '2.2',
728 ],
729 'activity_campaign_id' => [
730 'name' => 'campaign_id',
731 'type' => CRM_Utils_Type::T_INT,
732 'title' => ts('Campaign ID'),
733 'description' => ts('The campaign for which this activity has been triggered.'),
734 'import' => TRUE,
735 'where' => 'civicrm_activity.campaign_id',
736 'export' => TRUE,
737 'table_name' => 'civicrm_activity',
738 'entity' => 'Activity',
739 'bao' => 'CRM_Activity_BAO_Activity',
740 'localizable' => 0,
741 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
742 'component' => 'CiviCampaign',
743 'html' => [
744 'type' => 'EntityRef',
745 'label' => ts("Campaign"),
746 ],
747 'pseudoconstant' => [
748 'table' => 'civicrm_campaign',
749 'keyColumn' => 'id',
750 'labelColumn' => 'title',
751 'prefetch' => 'FALSE',
752 ],
753 'add' => '3.4',
754 ],
755 'activity_engagement_level' => [
756 'name' => 'engagement_level',
757 'type' => CRM_Utils_Type::T_INT,
758 'title' => ts('Engagement Index'),
759 'description' => ts('Assign a specific level of engagement to this activity. Used for tracking constituents in ladder of engagement.'),
760 'import' => TRUE,
761 'where' => 'civicrm_activity.engagement_level',
762 'export' => TRUE,
763 'table_name' => 'civicrm_activity',
764 'entity' => 'Activity',
765 'bao' => 'CRM_Activity_BAO_Activity',
766 'localizable' => 0,
767 'html' => [
768 'type' => 'Select',
769 ],
770 'pseudoconstant' => [
771 'optionGroupName' => 'engagement_index',
772 'optionEditPath' => 'civicrm/admin/options/engagement_index',
773 ],
774 'add' => '3.4',
775 ],
776 'weight' => [
777 'name' => 'weight',
778 'type' => CRM_Utils_Type::T_INT,
779 'title' => ts('Order'),
780 'where' => 'civicrm_activity.weight',
781 'table_name' => 'civicrm_activity',
782 'entity' => 'Activity',
783 'bao' => 'CRM_Activity_BAO_Activity',
784 'localizable' => 0,
785 'add' => '4.1',
786 ],
787 'is_star' => [
788 'name' => 'is_star',
789 'type' => CRM_Utils_Type::T_BOOLEAN,
790 'title' => ts('Is Starred'),
791 'description' => ts('Activity marked as favorite.'),
792 'required' => TRUE,
793 'import' => TRUE,
794 'where' => 'civicrm_activity.is_star',
795 'headerPattern' => '/(activity.)?(star|favorite)/i',
796 'export' => TRUE,
797 'default' => '0',
798 'table_name' => 'civicrm_activity',
799 'entity' => 'Activity',
800 'bao' => 'CRM_Activity_BAO_Activity',
801 'localizable' => 0,
802 'html' => [
803 'type' => 'Checkbox',
804 ],
805 'add' => '4.7',
806 ],
807 'activity_created_date' => [
808 'name' => 'created_date',
809 'type' => CRM_Utils_Type::T_TIMESTAMP,
810 'title' => ts('Created Date'),
811 'description' => ts('When was the activity was created.'),
812 'required' => FALSE,
813 'where' => 'civicrm_activity.created_date',
814 'export' => TRUE,
815 'default' => 'CURRENT_TIMESTAMP',
816 'table_name' => 'civicrm_activity',
817 'entity' => 'Activity',
818 'bao' => 'CRM_Activity_BAO_Activity',
819 'localizable' => 0,
820 'html' => [
821 'type' => 'Select Date',
822 'label' => ts("Created Date"),
823 ],
824 'add' => '4.7',
825 ],
826 'activity_modified_date' => [
827 'name' => 'modified_date',
828 'type' => CRM_Utils_Type::T_TIMESTAMP,
829 'title' => ts('Modified Date'),
830 'description' => ts('When was the activity (or closely related entity) was created or modified or deleted.'),
831 'required' => FALSE,
832 'where' => 'civicrm_activity.modified_date',
833 'export' => TRUE,
834 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
835 'table_name' => 'civicrm_activity',
836 'entity' => 'Activity',
837 'bao' => 'CRM_Activity_BAO_Activity',
838 'localizable' => 0,
839 'html' => [
840 'type' => 'Select Date',
841 'label' => ts("Modified Date"),
842 ],
843 'readonly' => TRUE,
844 'add' => '4.7',
845 ],
846 ];
847 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
848 }
849 return Civi::$statics[__CLASS__]['fields'];
850 }
851
852 /**
853 * Return a mapping from field-name to the corresponding key (as used in fields()).
854 *
855 * @return array
856 * Array(string $name => string $uniqueName).
857 */
858 public static function &fieldKeys() {
859 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
860 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
861 }
862 return Civi::$statics[__CLASS__]['fieldKeys'];
863 }
864
865 /**
866 * Returns the names of this table
867 *
868 * @return string
869 */
870 public static function getTableName() {
871 return self::$_tableName;
872 }
873
874 /**
875 * Returns if this table needs to be logged
876 *
877 * @return bool
878 */
879 public function getLog() {
880 return self::$_log;
881 }
882
883 /**
884 * Returns the list of fields that can be imported
885 *
886 * @param bool $prefix
887 *
888 * @return array
889 */
890 public static function &import($prefix = FALSE) {
891 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'activity', $prefix, []);
892 return $r;
893 }
894
895 /**
896 * Returns the list of fields that can be exported
897 *
898 * @param bool $prefix
899 *
900 * @return array
901 */
902 public static function &export($prefix = FALSE) {
903 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'activity', $prefix, []);
904 return $r;
905 }
906
907 /**
908 * Returns the list of indices
909 *
910 * @param bool $localize
911 *
912 * @return array
913 */
914 public static function indices($localize = TRUE) {
915 $indices = [
916 'UI_source_record_id' => [
917 'name' => 'UI_source_record_id',
918 'field' => [
919 0 => 'source_record_id',
920 ],
921 'localizable' => FALSE,
922 'sig' => 'civicrm_activity::0::source_record_id',
923 ],
924 'UI_activity_type_id' => [
925 'name' => 'UI_activity_type_id',
926 'field' => [
927 0 => 'activity_type_id',
928 ],
929 'localizable' => FALSE,
930 'sig' => 'civicrm_activity::0::activity_type_id',
931 ],
932 'index_activity_date_time' => [
933 'name' => 'index_activity_date_time',
934 'field' => [
935 0 => 'activity_date_time',
936 ],
937 'localizable' => FALSE,
938 'sig' => 'civicrm_activity::0::activity_date_time',
939 ],
940 'index_status_id' => [
941 'name' => 'index_status_id',
942 'field' => [
943 0 => 'status_id',
944 ],
945 'localizable' => FALSE,
946 'sig' => 'civicrm_activity::0::status_id',
947 ],
948 'index_is_current_revision' => [
949 'name' => 'index_is_current_revision',
950 'field' => [
951 0 => 'is_current_revision',
952 ],
953 'localizable' => FALSE,
954 'sig' => 'civicrm_activity::0::is_current_revision',
955 ],
956 'index_is_deleted' => [
957 'name' => 'index_is_deleted',
958 'field' => [
959 0 => 'is_deleted',
960 ],
961 'localizable' => FALSE,
962 'sig' => 'civicrm_activity::0::is_deleted',
963 ],
964 ];
965 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
966 }
967
968 }