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