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