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