Regenerate DAO files with improved var docblocks
[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:b37cf83d01ce6a8f72be6de97f00d7d3)
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|null
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|null
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|null
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|null
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|null
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 'import' => TRUE,
599 'where' => 'civicrm_activity.is_test',
600 'headerPattern' => '/(is.)?test(.activity)?/i',
601 'export' => TRUE,
602 'default' => '0',
603 'table_name' => 'civicrm_activity',
604 'entity' => 'Activity',
605 'bao' => 'CRM_Activity_BAO_Activity',
606 'localizable' => 0,
607 'html' => [
608 'type' => 'CheckBox',
609 ],
610 'add' => '2.0',
611 ],
612 'activity_medium_id' => [
613 'name' => 'medium_id',
614 'type' => CRM_Utils_Type::T_INT,
615 'title' => ts('Activity Medium'),
616 'description' => ts('Activity Medium, Implicit FK to civicrm_option_value where option_group = encounter_medium.'),
617 'where' => 'civicrm_activity.medium_id',
618 'default' => NULL,
619 'table_name' => 'civicrm_activity',
620 'entity' => 'Activity',
621 'bao' => 'CRM_Activity_BAO_Activity',
622 'localizable' => 0,
623 'html' => [
624 'type' => 'Select',
625 ],
626 'pseudoconstant' => [
627 'optionGroupName' => 'encounter_medium',
628 'optionEditPath' => 'civicrm/admin/options/encounter_medium',
629 ],
630 'add' => '2.2',
631 ],
632 'is_auto' => [
633 'name' => 'is_auto',
634 'type' => CRM_Utils_Type::T_BOOLEAN,
635 'title' => ts('Auto'),
636 'where' => 'civicrm_activity.is_auto',
637 'default' => '0',
638 'table_name' => 'civicrm_activity',
639 'entity' => 'Activity',
640 'bao' => 'CRM_Activity_BAO_Activity',
641 'localizable' => 0,
642 'add' => '2.2',
643 ],
644 'relationship_id' => [
645 'name' => 'relationship_id',
646 'type' => CRM_Utils_Type::T_INT,
647 'title' => ts('Relationship ID'),
648 'description' => ts('FK to Relationship ID'),
649 'where' => 'civicrm_activity.relationship_id',
650 'default' => NULL,
651 'table_name' => 'civicrm_activity',
652 'entity' => 'Activity',
653 'bao' => 'CRM_Activity_BAO_Activity',
654 'localizable' => 0,
655 'FKClassName' => 'CRM_Contact_DAO_Relationship',
656 'html' => [
657 'label' => ts("Relationship"),
658 ],
659 'add' => '2.2',
660 ],
661 'is_current_revision' => [
662 'name' => 'is_current_revision',
663 'type' => CRM_Utils_Type::T_BOOLEAN,
664 'title' => ts('Is this activity a current revision in versioning chain?'),
665 'import' => TRUE,
666 'where' => 'civicrm_activity.is_current_revision',
667 'headerPattern' => '/(is.)?(current.)?(revision|version(ing)?)/i',
668 'export' => TRUE,
669 'default' => '1',
670 'table_name' => 'civicrm_activity',
671 'entity' => 'Activity',
672 'bao' => 'CRM_Activity_BAO_Activity',
673 'localizable' => 0,
674 'add' => '2.2',
675 ],
676 'original_id' => [
677 'name' => 'original_id',
678 'type' => CRM_Utils_Type::T_INT,
679 'title' => ts('Original Activity ID'),
680 'description' => ts('Activity ID of the first activity record in versioning chain.'),
681 'where' => 'civicrm_activity.original_id',
682 'table_name' => 'civicrm_activity',
683 'entity' => 'Activity',
684 'bao' => 'CRM_Activity_BAO_Activity',
685 'localizable' => 0,
686 'FKClassName' => 'CRM_Activity_DAO_Activity',
687 'html' => [
688 'label' => ts("Original Activity"),
689 ],
690 'readonly' => TRUE,
691 'add' => '2.2',
692 ],
693 'activity_result' => [
694 'name' => 'result',
695 'type' => CRM_Utils_Type::T_STRING,
696 'title' => ts('Result'),
697 'description' => ts('Currently being used to store result id for survey activity, FK to option value.'),
698 'maxlength' => 255,
699 'size' => CRM_Utils_Type::HUGE,
700 'where' => 'civicrm_activity.result',
701 'table_name' => 'civicrm_activity',
702 'entity' => 'Activity',
703 'bao' => 'CRM_Activity_BAO_Activity',
704 'localizable' => 0,
705 'add' => '3.3',
706 ],
707 'activity_is_deleted' => [
708 'name' => 'is_deleted',
709 'type' => CRM_Utils_Type::T_BOOLEAN,
710 'title' => ts('Activity is in the Trash'),
711 'import' => TRUE,
712 'where' => 'civicrm_activity.is_deleted',
713 'headerPattern' => '/(activity.)?(trash|deleted)/i',
714 'export' => TRUE,
715 'default' => '0',
716 'table_name' => 'civicrm_activity',
717 'entity' => 'Activity',
718 'bao' => 'CRM_Activity_BAO_Activity',
719 'localizable' => 0,
720 'html' => [
721 'type' => 'CheckBox',
722 ],
723 'add' => '2.2',
724 ],
725 'activity_campaign_id' => [
726 'name' => 'campaign_id',
727 'type' => CRM_Utils_Type::T_INT,
728 'title' => ts('Campaign ID'),
729 'description' => ts('The campaign for which this activity has been triggered.'),
730 'import' => TRUE,
731 'where' => 'civicrm_activity.campaign_id',
732 'export' => TRUE,
733 'table_name' => 'civicrm_activity',
734 'entity' => 'Activity',
735 'bao' => 'CRM_Activity_BAO_Activity',
736 'localizable' => 0,
737 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
738 'component' => 'CiviCampaign',
739 'html' => [
740 'type' => 'EntityRef',
741 'label' => ts("Campaign"),
742 ],
743 'pseudoconstant' => [
744 'table' => 'civicrm_campaign',
745 'keyColumn' => 'id',
746 'labelColumn' => 'title',
747 'prefetch' => 'FALSE',
748 ],
749 'add' => '3.4',
750 ],
751 'activity_engagement_level' => [
752 'name' => 'engagement_level',
753 'type' => CRM_Utils_Type::T_INT,
754 'title' => ts('Engagement Index'),
755 'description' => ts('Assign a specific level of engagement to this activity. Used for tracking constituents in ladder of engagement.'),
756 'import' => TRUE,
757 'where' => 'civicrm_activity.engagement_level',
758 'export' => TRUE,
759 'table_name' => 'civicrm_activity',
760 'entity' => 'Activity',
761 'bao' => 'CRM_Activity_BAO_Activity',
762 'localizable' => 0,
763 'html' => [
764 'type' => 'Select',
765 ],
766 'pseudoconstant' => [
767 'optionGroupName' => 'engagement_index',
768 'optionEditPath' => 'civicrm/admin/options/engagement_index',
769 ],
770 'add' => '3.4',
771 ],
772 'weight' => [
773 'name' => 'weight',
774 'type' => CRM_Utils_Type::T_INT,
775 'title' => ts('Order'),
776 'where' => 'civicrm_activity.weight',
777 'table_name' => 'civicrm_activity',
778 'entity' => 'Activity',
779 'bao' => 'CRM_Activity_BAO_Activity',
780 'localizable' => 0,
781 'add' => '4.1',
782 ],
783 'is_star' => [
784 'name' => 'is_star',
785 'type' => CRM_Utils_Type::T_BOOLEAN,
786 'title' => ts('Is Starred'),
787 'description' => ts('Activity marked as favorite.'),
788 'import' => TRUE,
789 'where' => 'civicrm_activity.is_star',
790 'headerPattern' => '/(activity.)?(star|favorite)/i',
791 'export' => TRUE,
792 'default' => '0',
793 'table_name' => 'civicrm_activity',
794 'entity' => 'Activity',
795 'bao' => 'CRM_Activity_BAO_Activity',
796 'localizable' => 0,
797 'html' => [
798 'type' => 'Checkbox',
799 ],
800 'add' => '4.7',
801 ],
802 'activity_created_date' => [
803 'name' => 'created_date',
804 'type' => CRM_Utils_Type::T_TIMESTAMP,
805 'title' => ts('Created Date'),
806 'description' => ts('When was the activity was created.'),
807 'required' => FALSE,
808 'where' => 'civicrm_activity.created_date',
809 'export' => TRUE,
810 'default' => 'CURRENT_TIMESTAMP',
811 'table_name' => 'civicrm_activity',
812 'entity' => 'Activity',
813 'bao' => 'CRM_Activity_BAO_Activity',
814 'localizable' => 0,
815 'html' => [
816 'type' => 'Select Date',
817 'label' => ts("Created Date"),
818 ],
819 'add' => '4.7',
820 ],
821 'activity_modified_date' => [
822 'name' => 'modified_date',
823 'type' => CRM_Utils_Type::T_TIMESTAMP,
824 'title' => ts('Modified Date'),
825 'description' => ts('When was the activity (or closely related entity) was created or modified or deleted.'),
826 'required' => FALSE,
827 'where' => 'civicrm_activity.modified_date',
828 'export' => TRUE,
829 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
830 'table_name' => 'civicrm_activity',
831 'entity' => 'Activity',
832 'bao' => 'CRM_Activity_BAO_Activity',
833 'localizable' => 0,
834 'html' => [
835 'type' => 'Select Date',
836 'label' => ts("Modified Date"),
837 ],
838 'readonly' => TRUE,
839 'add' => '4.7',
840 ],
841 ];
842 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
843 }
844 return Civi::$statics[__CLASS__]['fields'];
845 }
846
847 /**
848 * Return a mapping from field-name to the corresponding key (as used in fields()).
849 *
850 * @return array
851 * Array(string $name => string $uniqueName).
852 */
853 public static function &fieldKeys() {
854 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
855 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
856 }
857 return Civi::$statics[__CLASS__]['fieldKeys'];
858 }
859
860 /**
861 * Returns the names of this table
862 *
863 * @return string
864 */
865 public static function getTableName() {
866 return self::$_tableName;
867 }
868
869 /**
870 * Returns if this table needs to be logged
871 *
872 * @return bool
873 */
874 public function getLog() {
875 return self::$_log;
876 }
877
878 /**
879 * Returns the list of fields that can be imported
880 *
881 * @param bool $prefix
882 *
883 * @return array
884 */
885 public static function &import($prefix = FALSE) {
886 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'activity', $prefix, []);
887 return $r;
888 }
889
890 /**
891 * Returns the list of fields that can be exported
892 *
893 * @param bool $prefix
894 *
895 * @return array
896 */
897 public static function &export($prefix = FALSE) {
898 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'activity', $prefix, []);
899 return $r;
900 }
901
902 /**
903 * Returns the list of indices
904 *
905 * @param bool $localize
906 *
907 * @return array
908 */
909 public static function indices($localize = TRUE) {
910 $indices = [
911 'UI_source_record_id' => [
912 'name' => 'UI_source_record_id',
913 'field' => [
914 0 => 'source_record_id',
915 ],
916 'localizable' => FALSE,
917 'sig' => 'civicrm_activity::0::source_record_id',
918 ],
919 'UI_activity_type_id' => [
920 'name' => 'UI_activity_type_id',
921 'field' => [
922 0 => 'activity_type_id',
923 ],
924 'localizable' => FALSE,
925 'sig' => 'civicrm_activity::0::activity_type_id',
926 ],
927 'index_activity_date_time' => [
928 'name' => 'index_activity_date_time',
929 'field' => [
930 0 => 'activity_date_time',
931 ],
932 'localizable' => FALSE,
933 'sig' => 'civicrm_activity::0::activity_date_time',
934 ],
935 'index_status_id' => [
936 'name' => 'index_status_id',
937 'field' => [
938 0 => 'status_id',
939 ],
940 'localizable' => FALSE,
941 'sig' => 'civicrm_activity::0::status_id',
942 ],
943 'index_is_current_revision' => [
944 'name' => 'index_is_current_revision',
945 'field' => [
946 0 => 'is_current_revision',
947 ],
948 'localizable' => FALSE,
949 'sig' => 'civicrm_activity::0::is_current_revision',
950 ],
951 'index_is_deleted' => [
952 'name' => 'index_is_deleted',
953 'field' => [
954 0 => 'is_deleted',
955 ],
956 'localizable' => FALSE,
957 'sig' => 'civicrm_activity::0::is_deleted',
958 ],
959 ];
960 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
961 }
962
963 }