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