Add "labelField" metadata to entities
[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:20d5b91c29b14f4df12aabfc07c58e94)
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 foreign keys and entity references.
258 *
259 * @return array
260 * [CRM_Core_Reference_Interface]
261 */
262 public static function getReferenceColumns() {
263 if (!isset(Civi::$statics[__CLASS__]['links'])) {
264 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
265 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_id', 'civicrm_phone', 'id');
266 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_activity', 'id');
267 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'relationship_id', 'civicrm_relationship', 'id');
268 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'original_id', 'civicrm_activity', 'id');
269 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
270 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
271 }
272 return Civi::$statics[__CLASS__]['links'];
273 }
274
275 /**
276 * Returns all the column names of this table
277 *
278 * @return array
279 */
280 public static function &fields() {
281 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
282 Civi::$statics[__CLASS__]['fields'] = [
283 'activity_id' => [
284 'name' => 'id',
285 'type' => CRM_Utils_Type::T_INT,
286 'title' => ts('Activity ID'),
287 'description' => ts('Unique Other Activity ID'),
288 'required' => TRUE,
289 'import' => TRUE,
290 'where' => 'civicrm_activity.id',
291 'export' => TRUE,
292 'table_name' => 'civicrm_activity',
293 'entity' => 'Activity',
294 'bao' => 'CRM_Activity_BAO_Activity',
295 'localizable' => 0,
296 'add' => '1.1',
297 ],
298 'source_record_id' => [
299 'name' => 'source_record_id',
300 'type' => CRM_Utils_Type::T_INT,
301 'title' => ts('Source Record'),
302 '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.'),
303 'where' => 'civicrm_activity.source_record_id',
304 'table_name' => 'civicrm_activity',
305 'entity' => 'Activity',
306 'bao' => 'CRM_Activity_BAO_Activity',
307 'localizable' => 0,
308 'add' => '2.0',
309 ],
310 'activity_type_id' => [
311 'name' => 'activity_type_id',
312 'type' => CRM_Utils_Type::T_INT,
313 'title' => ts('Activity Type ID'),
314 'description' => ts('FK to civicrm_option_value.id, that has to be valid, registered activity type.'),
315 'required' => TRUE,
316 'import' => TRUE,
317 'where' => 'civicrm_activity.activity_type_id',
318 'headerPattern' => '/(activity.)?type(.id$)/i',
319 'export' => TRUE,
320 'default' => '1',
321 'table_name' => 'civicrm_activity',
322 'entity' => 'Activity',
323 'bao' => 'CRM_Activity_BAO_Activity',
324 'localizable' => 0,
325 'html' => [
326 'type' => 'Select',
327 'label' => ts("Activity Type"),
328 ],
329 'pseudoconstant' => [
330 'optionGroupName' => 'activity_type',
331 'optionEditPath' => 'civicrm/admin/options/activity_type',
332 ],
333 'add' => '1.1',
334 ],
335 'activity_subject' => [
336 'name' => 'subject',
337 'type' => CRM_Utils_Type::T_STRING,
338 'title' => ts('Subject'),
339 'description' => ts('The subject/purpose/short description of the activity.'),
340 'maxlength' => 255,
341 'size' => CRM_Utils_Type::HUGE,
342 'import' => TRUE,
343 'where' => 'civicrm_activity.subject',
344 'headerPattern' => '/(activity.)?subject/i',
345 'export' => TRUE,
346 'table_name' => 'civicrm_activity',
347 'entity' => 'Activity',
348 'bao' => 'CRM_Activity_BAO_Activity',
349 'localizable' => 0,
350 'html' => [
351 'type' => 'Text',
352 ],
353 'add' => '1.1',
354 ],
355 'activity_date_time' => [
356 'name' => 'activity_date_time',
357 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
358 'title' => ts('Activity Date'),
359 'description' => ts('Date and time this activity is scheduled to occur. Formerly named scheduled_date_time.'),
360 'required' => FALSE,
361 'import' => TRUE,
362 'where' => 'civicrm_activity.activity_date_time',
363 'headerPattern' => '/(activity.)?date(.time$)?/i',
364 'export' => TRUE,
365 'default' => 'CURRENT_TIMESTAMP',
366 'table_name' => 'civicrm_activity',
367 'entity' => 'Activity',
368 'bao' => 'CRM_Activity_BAO_Activity',
369 'localizable' => 0,
370 'html' => [
371 'type' => 'Select Date',
372 'formatType' => 'activityDateTime',
373 ],
374 'add' => '2.0',
375 ],
376 'activity_duration' => [
377 'name' => 'duration',
378 'type' => CRM_Utils_Type::T_INT,
379 'title' => ts('Duration'),
380 'description' => ts('Planned or actual duration of activity expressed in minutes. Conglomerate of former duration_hours and duration_minutes.'),
381 'import' => TRUE,
382 'where' => 'civicrm_activity.duration',
383 'headerPattern' => '/(activity.)?duration(s)?$/i',
384 'export' => TRUE,
385 'table_name' => 'civicrm_activity',
386 'entity' => 'Activity',
387 'bao' => 'CRM_Activity_BAO_Activity',
388 'localizable' => 0,
389 'html' => [
390 'type' => 'Number',
391 ],
392 'add' => '2.0',
393 ],
394 'activity_location' => [
395 'name' => 'location',
396 'type' => CRM_Utils_Type::T_STRING,
397 'title' => ts('Location'),
398 'description' => ts('Location of the activity (optional, open text).'),
399 'maxlength' => 255,
400 'size' => CRM_Utils_Type::HUGE,
401 'import' => TRUE,
402 'where' => 'civicrm_activity.location',
403 'headerPattern' => '/(activity.)?location$/i',
404 'export' => TRUE,
405 'table_name' => 'civicrm_activity',
406 'entity' => 'Activity',
407 'bao' => 'CRM_Activity_BAO_Activity',
408 'localizable' => 0,
409 'html' => [
410 'type' => 'Text',
411 ],
412 'add' => '1.1',
413 ],
414 'phone_id' => [
415 'name' => 'phone_id',
416 'type' => CRM_Utils_Type::T_INT,
417 'title' => ts('Phone (called) ID'),
418 'description' => ts('Phone ID of the number called (optional - used if an existing phone number is selected).'),
419 'where' => 'civicrm_activity.phone_id',
420 'table_name' => 'civicrm_activity',
421 'entity' => 'Activity',
422 'bao' => 'CRM_Activity_BAO_Activity',
423 'localizable' => 0,
424 'FKClassName' => 'CRM_Core_DAO_Phone',
425 'html' => [
426 'type' => 'EntityRef',
427 'label' => ts("Phone (called)"),
428 ],
429 'add' => '2.0',
430 ],
431 'phone_number' => [
432 'name' => 'phone_number',
433 'type' => CRM_Utils_Type::T_STRING,
434 'title' => ts('Phone (called) Number'),
435 'description' => ts('Phone number in case the number does not exist in the civicrm_phone table.'),
436 'maxlength' => 64,
437 'size' => CRM_Utils_Type::BIG,
438 'where' => 'civicrm_activity.phone_number',
439 'table_name' => 'civicrm_activity',
440 'entity' => 'Activity',
441 'bao' => 'CRM_Activity_BAO_Activity',
442 'localizable' => 0,
443 'html' => [
444 'type' => 'Text',
445 ],
446 'add' => '2.0',
447 ],
448 'activity_details' => [
449 'name' => 'details',
450 'type' => CRM_Utils_Type::T_LONGTEXT,
451 'title' => ts('Details'),
452 'description' => ts('Details about the activity (agenda, notes, etc).'),
453 'import' => TRUE,
454 'where' => 'civicrm_activity.details',
455 'headerPattern' => '/(activity.)?detail(s)?$/i',
456 'export' => TRUE,
457 'table_name' => 'civicrm_activity',
458 'entity' => 'Activity',
459 'bao' => 'CRM_Activity_BAO_Activity',
460 'localizable' => 0,
461 'html' => [
462 'type' => 'RichTextEditor',
463 ],
464 'add' => '1.1',
465 ],
466 'activity_status_id' => [
467 'name' => 'status_id',
468 'type' => CRM_Utils_Type::T_INT,
469 'title' => ts('Activity Status'),
470 'description' => ts('ID of the status this activity is currently in. Foreign key to civicrm_option_value.'),
471 'import' => TRUE,
472 'where' => 'civicrm_activity.status_id',
473 'headerPattern' => '/(activity.)?status(.label$)?/i',
474 'export' => TRUE,
475 'table_name' => 'civicrm_activity',
476 'entity' => 'Activity',
477 'bao' => 'CRM_Activity_BAO_Activity',
478 'localizable' => 0,
479 'html' => [
480 'type' => 'Select',
481 ],
482 'pseudoconstant' => [
483 'optionGroupName' => 'activity_status',
484 'optionEditPath' => 'civicrm/admin/options/activity_status',
485 ],
486 'add' => '2.0',
487 ],
488 'priority_id' => [
489 'name' => 'priority_id',
490 'type' => CRM_Utils_Type::T_INT,
491 'title' => ts('Priority'),
492 'description' => ts('ID of the priority given to this activity. Foreign key to civicrm_option_value.'),
493 'import' => TRUE,
494 'where' => 'civicrm_activity.priority_id',
495 'export' => TRUE,
496 'table_name' => 'civicrm_activity',
497 'entity' => 'Activity',
498 'bao' => 'CRM_Activity_BAO_Activity',
499 'localizable' => 0,
500 'html' => [
501 'type' => 'Select',
502 ],
503 'pseudoconstant' => [
504 'optionGroupName' => 'priority',
505 'optionEditPath' => 'civicrm/admin/options/priority',
506 ],
507 'add' => '2.0',
508 ],
509 'parent_id' => [
510 'name' => 'parent_id',
511 'type' => CRM_Utils_Type::T_INT,
512 'title' => ts('Parent Activity Id'),
513 'description' => ts('Parent meeting ID (if this is a follow-up item). This is not currently implemented'),
514 'where' => 'civicrm_activity.parent_id',
515 'table_name' => 'civicrm_activity',
516 'entity' => 'Activity',
517 'bao' => 'CRM_Activity_BAO_Activity',
518 'localizable' => 0,
519 'FKClassName' => 'CRM_Activity_DAO_Activity',
520 'add' => '1.1',
521 ],
522 'activity_is_test' => [
523 'name' => 'is_test',
524 'type' => CRM_Utils_Type::T_BOOLEAN,
525 'title' => ts('Test'),
526 'import' => TRUE,
527 'where' => 'civicrm_activity.is_test',
528 'headerPattern' => '/(is.)?test(.activity)?/i',
529 'export' => TRUE,
530 'default' => '0',
531 'table_name' => 'civicrm_activity',
532 'entity' => 'Activity',
533 'bao' => 'CRM_Activity_BAO_Activity',
534 'localizable' => 0,
535 'html' => [
536 'type' => 'CheckBox',
537 ],
538 'add' => '2.0',
539 ],
540 'activity_medium_id' => [
541 'name' => 'medium_id',
542 'type' => CRM_Utils_Type::T_INT,
543 'title' => ts('Activity Medium'),
544 'description' => ts('Activity Medium, Implicit FK to civicrm_option_value where option_group = encounter_medium.'),
545 'where' => 'civicrm_activity.medium_id',
546 'default' => 'NULL',
547 'table_name' => 'civicrm_activity',
548 'entity' => 'Activity',
549 'bao' => 'CRM_Activity_BAO_Activity',
550 'localizable' => 0,
551 'html' => [
552 'type' => 'Select',
553 ],
554 'pseudoconstant' => [
555 'optionGroupName' => 'encounter_medium',
556 'optionEditPath' => 'civicrm/admin/options/encounter_medium',
557 ],
558 'add' => '2.2',
559 ],
560 'is_auto' => [
561 'name' => 'is_auto',
562 'type' => CRM_Utils_Type::T_BOOLEAN,
563 'title' => ts('Auto'),
564 'where' => 'civicrm_activity.is_auto',
565 'default' => '0',
566 'table_name' => 'civicrm_activity',
567 'entity' => 'Activity',
568 'bao' => 'CRM_Activity_BAO_Activity',
569 'localizable' => 0,
570 'add' => '2.2',
571 ],
572 'relationship_id' => [
573 'name' => 'relationship_id',
574 'type' => CRM_Utils_Type::T_INT,
575 'title' => ts('Relationship Id'),
576 'description' => ts('FK to Relationship ID'),
577 'where' => 'civicrm_activity.relationship_id',
578 'default' => 'NULL',
579 'table_name' => 'civicrm_activity',
580 'entity' => 'Activity',
581 'bao' => 'CRM_Activity_BAO_Activity',
582 'localizable' => 0,
583 'FKClassName' => 'CRM_Contact_DAO_Relationship',
584 'add' => '2.2',
585 ],
586 'is_current_revision' => [
587 'name' => 'is_current_revision',
588 'type' => CRM_Utils_Type::T_BOOLEAN,
589 'title' => ts('Is this activity a current revision in versioning chain?'),
590 'import' => TRUE,
591 'where' => 'civicrm_activity.is_current_revision',
592 'headerPattern' => '/(is.)?(current.)?(revision|version(ing)?)/i',
593 'export' => TRUE,
594 'default' => '1',
595 'table_name' => 'civicrm_activity',
596 'entity' => 'Activity',
597 'bao' => 'CRM_Activity_BAO_Activity',
598 'localizable' => 0,
599 'add' => '2.2',
600 ],
601 'original_id' => [
602 'name' => 'original_id',
603 'type' => CRM_Utils_Type::T_INT,
604 'title' => ts('Original Activity ID '),
605 'description' => ts('Activity ID of the first activity record in versioning chain.'),
606 'where' => 'civicrm_activity.original_id',
607 'table_name' => 'civicrm_activity',
608 'entity' => 'Activity',
609 'bao' => 'CRM_Activity_BAO_Activity',
610 'localizable' => 0,
611 'FKClassName' => 'CRM_Activity_DAO_Activity',
612 'add' => '2.2',
613 ],
614 'activity_result' => [
615 'name' => 'result',
616 'type' => CRM_Utils_Type::T_STRING,
617 'title' => ts('Result'),
618 'description' => ts('Currently being used to store result id for survey activity, FK to option value.'),
619 'maxlength' => 255,
620 'size' => CRM_Utils_Type::HUGE,
621 'where' => 'civicrm_activity.result',
622 'table_name' => 'civicrm_activity',
623 'entity' => 'Activity',
624 'bao' => 'CRM_Activity_BAO_Activity',
625 'localizable' => 0,
626 'add' => '3.3',
627 ],
628 'activity_is_deleted' => [
629 'name' => 'is_deleted',
630 'type' => CRM_Utils_Type::T_BOOLEAN,
631 'title' => ts('Activity is in the Trash'),
632 'import' => TRUE,
633 'where' => 'civicrm_activity.is_deleted',
634 'headerPattern' => '/(activity.)?(trash|deleted)/i',
635 'export' => TRUE,
636 'default' => '0',
637 'table_name' => 'civicrm_activity',
638 'entity' => 'Activity',
639 'bao' => 'CRM_Activity_BAO_Activity',
640 'localizable' => 0,
641 'html' => [
642 'type' => 'CheckBox',
643 ],
644 'add' => '2.2',
645 ],
646 'activity_campaign_id' => [
647 'name' => 'campaign_id',
648 'type' => CRM_Utils_Type::T_INT,
649 'title' => ts('Campaign'),
650 'description' => ts('The campaign for which this activity has been triggered.'),
651 'import' => TRUE,
652 'where' => 'civicrm_activity.campaign_id',
653 'export' => TRUE,
654 'table_name' => 'civicrm_activity',
655 'entity' => 'Activity',
656 'bao' => 'CRM_Activity_BAO_Activity',
657 'localizable' => 0,
658 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
659 'html' => [
660 'type' => 'Select',
661 ],
662 'pseudoconstant' => [
663 'table' => 'civicrm_campaign',
664 'keyColumn' => 'id',
665 'labelColumn' => 'title',
666 ],
667 'add' => '3.4',
668 ],
669 'activity_engagement_level' => [
670 'name' => 'engagement_level',
671 'type' => CRM_Utils_Type::T_INT,
672 'title' => ts('Engagement Index'),
673 'description' => ts('Assign a specific level of engagement to this activity. Used for tracking constituents in ladder of engagement.'),
674 'import' => TRUE,
675 'where' => 'civicrm_activity.engagement_level',
676 'export' => TRUE,
677 'table_name' => 'civicrm_activity',
678 'entity' => 'Activity',
679 'bao' => 'CRM_Activity_BAO_Activity',
680 'localizable' => 0,
681 'html' => [
682 'type' => 'Select',
683 ],
684 'pseudoconstant' => [
685 'optionGroupName' => 'engagement_index',
686 'optionEditPath' => 'civicrm/admin/options/engagement_index',
687 ],
688 'add' => '3.4',
689 ],
690 'weight' => [
691 'name' => 'weight',
692 'type' => CRM_Utils_Type::T_INT,
693 'title' => ts('Order'),
694 'where' => 'civicrm_activity.weight',
695 'table_name' => 'civicrm_activity',
696 'entity' => 'Activity',
697 'bao' => 'CRM_Activity_BAO_Activity',
698 'localizable' => 0,
699 'add' => '4.1',
700 ],
701 'is_star' => [
702 'name' => 'is_star',
703 'type' => CRM_Utils_Type::T_BOOLEAN,
704 'title' => ts('Is Starred'),
705 'description' => ts('Activity marked as favorite.'),
706 'import' => TRUE,
707 'where' => 'civicrm_activity.is_star',
708 'headerPattern' => '/(activity.)?(star|favorite)/i',
709 'export' => TRUE,
710 'default' => '0',
711 'table_name' => 'civicrm_activity',
712 'entity' => 'Activity',
713 'bao' => 'CRM_Activity_BAO_Activity',
714 'localizable' => 0,
715 'html' => [
716 'type' => 'Checkbox',
717 ],
718 'add' => '4.7',
719 ],
720 'activity_created_date' => [
721 'name' => 'created_date',
722 'type' => CRM_Utils_Type::T_TIMESTAMP,
723 'title' => ts('Created Date'),
724 'description' => ts('When was the activity was created.'),
725 'required' => FALSE,
726 'where' => 'civicrm_activity.created_date',
727 'export' => TRUE,
728 'default' => 'CURRENT_TIMESTAMP',
729 'table_name' => 'civicrm_activity',
730 'entity' => 'Activity',
731 'bao' => 'CRM_Activity_BAO_Activity',
732 'localizable' => 0,
733 'add' => '4.7',
734 ],
735 'activity_modified_date' => [
736 'name' => 'modified_date',
737 'type' => CRM_Utils_Type::T_TIMESTAMP,
738 'title' => ts('Modified Date'),
739 'description' => ts('When was the activity (or closely related entity) was created or modified or deleted.'),
740 'required' => FALSE,
741 'where' => 'civicrm_activity.modified_date',
742 'export' => TRUE,
743 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
744 'table_name' => 'civicrm_activity',
745 'entity' => 'Activity',
746 'bao' => 'CRM_Activity_BAO_Activity',
747 'localizable' => 0,
748 'add' => '4.7',
749 ],
750 ];
751 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
752 }
753 return Civi::$statics[__CLASS__]['fields'];
754 }
755
756 /**
757 * Return a mapping from field-name to the corresponding key (as used in fields()).
758 *
759 * @return array
760 * Array(string $name => string $uniqueName).
761 */
762 public static function &fieldKeys() {
763 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
764 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
765 }
766 return Civi::$statics[__CLASS__]['fieldKeys'];
767 }
768
769 /**
770 * Returns the names of this table
771 *
772 * @return string
773 */
774 public static function getTableName() {
775 return self::$_tableName;
776 }
777
778 /**
779 * Returns if this table needs to be logged
780 *
781 * @return bool
782 */
783 public function getLog() {
784 return self::$_log;
785 }
786
787 /**
788 * Returns the list of fields that can be imported
789 *
790 * @param bool $prefix
791 *
792 * @return array
793 */
794 public static function &import($prefix = FALSE) {
795 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'activity', $prefix, []);
796 return $r;
797 }
798
799 /**
800 * Returns the list of fields that can be exported
801 *
802 * @param bool $prefix
803 *
804 * @return array
805 */
806 public static function &export($prefix = FALSE) {
807 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'activity', $prefix, []);
808 return $r;
809 }
810
811 /**
812 * Returns the list of indices
813 *
814 * @param bool $localize
815 *
816 * @return array
817 */
818 public static function indices($localize = TRUE) {
819 $indices = [
820 'UI_source_record_id' => [
821 'name' => 'UI_source_record_id',
822 'field' => [
823 0 => 'source_record_id',
824 ],
825 'localizable' => FALSE,
826 'sig' => 'civicrm_activity::0::source_record_id',
827 ],
828 'UI_activity_type_id' => [
829 'name' => 'UI_activity_type_id',
830 'field' => [
831 0 => 'activity_type_id',
832 ],
833 'localizable' => FALSE,
834 'sig' => 'civicrm_activity::0::activity_type_id',
835 ],
836 'index_activity_date_time' => [
837 'name' => 'index_activity_date_time',
838 'field' => [
839 0 => 'activity_date_time',
840 ],
841 'localizable' => FALSE,
842 'sig' => 'civicrm_activity::0::activity_date_time',
843 ],
844 'index_status_id' => [
845 'name' => 'index_status_id',
846 'field' => [
847 0 => 'status_id',
848 ],
849 'localizable' => FALSE,
850 'sig' => 'civicrm_activity::0::status_id',
851 ],
852 'index_is_current_revision' => [
853 'name' => 'index_is_current_revision',
854 'field' => [
855 0 => 'is_current_revision',
856 ],
857 'localizable' => FALSE,
858 'sig' => 'civicrm_activity::0::is_current_revision',
859 ],
860 'index_is_deleted' => [
861 'name' => 'index_is_deleted',
862 'field' => [
863 0 => 'is_deleted',
864 ],
865 'localizable' => FALSE,
866 'sig' => 'civicrm_activity::0::is_deleted',
867 ],
868 ];
869 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
870 }
871
872 }