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