Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
ca5cec67 | 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Activity/Activity.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
f29bf4f3 | 9 | * (GenCodeChecksum:a6494c64eb7395b2221ab118a480c951) |
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 | * | |
e6ca0a57 | 34 | * @var int |
e501603b TO |
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 | * | |
e6ca0a57 | 41 | * @var int |
e501603b TO |
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 | * | |
e6ca0a57 | 48 | * @var int |
e501603b TO |
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 | * | |
e6ca0a57 | 69 | * @var int |
e501603b TO |
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 | * | |
e6ca0a57 | 83 | * @var int |
e501603b TO |
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 | * | |
e6ca0a57 | 104 | * @var int |
e501603b TO |
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 | * | |
e6ca0a57 | 111 | * @var int |
e501603b TO |
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 | * | |
e6ca0a57 | 118 | * @var int |
e501603b TO |
119 | */ |
120 | public $parent_id; | |
c3fc2621 | 121 | |
e501603b | 122 | /** |
e6ca0a57 | 123 | * @var bool |
e501603b TO |
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 | * | |
e6ca0a57 | 130 | * @var int |
e501603b TO |
131 | */ |
132 | public $medium_id; | |
c3fc2621 | 133 | |
e501603b | 134 | /** |
e6ca0a57 | 135 | * @var bool |
e501603b TO |
136 | */ |
137 | public $is_auto; | |
c3fc2621 | 138 | |
e501603b TO |
139 | /** |
140 | * FK to Relationship ID | |
141 | * | |
e6ca0a57 | 142 | * @var int |
e501603b TO |
143 | */ |
144 | public $relationship_id; | |
c3fc2621 | 145 | |
e501603b | 146 | /** |
e6ca0a57 | 147 | * @var bool |
e501603b TO |
148 | */ |
149 | public $is_current_revision; | |
c3fc2621 | 150 | |
e501603b TO |
151 | /** |
152 | * Activity ID of the first activity record in versioning chain. | |
153 | * | |
e6ca0a57 | 154 | * @var int |
e501603b TO |
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 | /** |
e6ca0a57 | 166 | * @var bool |
e501603b TO |
167 | */ |
168 | public $is_deleted; | |
c3fc2621 | 169 | |
e501603b TO |
170 | /** |
171 | * The campaign for which this activity has been triggered. | |
172 | * | |
e6ca0a57 | 173 | * @var int |
e501603b TO |
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 | * | |
e6ca0a57 | 180 | * @var int |
e501603b TO |
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 | * | |
e6ca0a57 | 192 | * @var bool |
cd063b10 CW |
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, | |
3542118f | 273 | 'title' => ts('Activity Type'), |
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', | |
e6ca0a57 | 291 | ], |
c3fc2621 CW |
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' => [ |
3542118f | 344 | 'type' => 'Number', |
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, | |
3542118f | 369 | 'title' => ts('Phone (called)'), |
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', | |
e6ca0a57 | 433 | ], |
c3fc2621 CW |
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.'), |
6c0c4ac7 | 440 | 'import' => TRUE, |
a36434b9 | 441 | 'where' => 'civicrm_activity.priority_id', |
6c0c4ac7 | 442 | 'export' => TRUE, |
522a26c9 | 443 | 'table_name' => 'civicrm_activity', |
444 | 'entity' => 'Activity', | |
445 | 'bao' => 'CRM_Activity_BAO_Activity', | |
6a7e5e5d | 446 | 'localizable' => 0, |
c3fc2621 | 447 | 'html' => [ |
e501603b | 448 | 'type' => 'Select', |
c3fc2621 CW |
449 | ], |
450 | 'pseudoconstant' => [ | |
e501603b TO |
451 | 'optionGroupName' => 'priority', |
452 | 'optionEditPath' => 'civicrm/admin/options/priority', | |
e6ca0a57 | 453 | ], |
c3fc2621 CW |
454 | ], |
455 | 'parent_id' => [ | |
e501603b TO |
456 | 'name' => 'parent_id', |
457 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 458 | 'title' => ts('Parent Activity Id'), |
215b423e | 459 | 'description' => ts('Parent meeting ID (if this is a follow-up item). This is not currently implemented'), |
a36434b9 | 460 | 'where' => 'civicrm_activity.parent_id', |
522a26c9 | 461 | 'table_name' => 'civicrm_activity', |
462 | 'entity' => 'Activity', | |
463 | 'bao' => 'CRM_Activity_BAO_Activity', | |
6a7e5e5d | 464 | 'localizable' => 0, |
e501603b | 465 | 'FKClassName' => 'CRM_Activity_DAO_Activity', |
c3fc2621 CW |
466 | ], |
467 | 'activity_is_test' => [ | |
e501603b TO |
468 | 'name' => 'is_test', |
469 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 CW |
470 | 'title' => ts('Test'), |
471 | 'import' => TRUE, | |
e501603b TO |
472 | 'where' => 'civicrm_activity.is_test', |
473 | 'headerPattern' => '/(is.)?test(.activity)?/i', | |
c3fc2621 | 474 | 'export' => TRUE, |
45a83e42 | 475 | 'default' => '0', |
522a26c9 | 476 | 'table_name' => 'civicrm_activity', |
477 | 'entity' => 'Activity', | |
478 | 'bao' => 'CRM_Activity_BAO_Activity', | |
6a7e5e5d | 479 | 'localizable' => 0, |
c3fc2621 | 480 | 'html' => [ |
3542118f | 481 | 'type' => 'CheckBox', |
c3fc2621 CW |
482 | ], |
483 | ], | |
484 | 'activity_medium_id' => [ | |
e501603b TO |
485 | 'name' => 'medium_id', |
486 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 487 | 'title' => ts('Activity Medium'), |
215b423e | 488 | 'description' => ts('Activity Medium, Implicit FK to civicrm_option_value where option_group = encounter_medium.'), |
a36434b9 | 489 | 'where' => 'civicrm_activity.medium_id', |
e501603b | 490 | 'default' => 'NULL', |
522a26c9 | 491 | 'table_name' => 'civicrm_activity', |
492 | 'entity' => 'Activity', | |
493 | 'bao' => 'CRM_Activity_BAO_Activity', | |
6a7e5e5d | 494 | 'localizable' => 0, |
c3fc2621 | 495 | 'html' => [ |
e501603b | 496 | 'type' => 'Select', |
c3fc2621 CW |
497 | ], |
498 | 'pseudoconstant' => [ | |
e501603b TO |
499 | 'optionGroupName' => 'encounter_medium', |
500 | 'optionEditPath' => 'civicrm/admin/options/encounter_medium', | |
e6ca0a57 | 501 | ], |
c3fc2621 CW |
502 | ], |
503 | 'is_auto' => [ | |
e501603b TO |
504 | 'name' => 'is_auto', |
505 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 506 | 'title' => ts('Auto'), |
a36434b9 | 507 | 'where' => 'civicrm_activity.is_auto', |
45a83e42 | 508 | 'default' => '0', |
522a26c9 | 509 | 'table_name' => 'civicrm_activity', |
510 | 'entity' => 'Activity', | |
511 | 'bao' => 'CRM_Activity_BAO_Activity', | |
6a7e5e5d | 512 | 'localizable' => 0, |
c3fc2621 CW |
513 | ], |
514 | 'relationship_id' => [ | |
e501603b TO |
515 | 'name' => 'relationship_id', |
516 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 517 | 'title' => ts('Relationship Id'), |
215b423e | 518 | 'description' => ts('FK to Relationship ID'), |
a36434b9 | 519 | 'where' => 'civicrm_activity.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', | |
c3fc2621 | 534 | 'export' => TRUE, |
e501603b | 535 | 'default' => '1', |
522a26c9 | 536 | 'table_name' => 'civicrm_activity', |
537 | 'entity' => 'Activity', | |
538 | 'bao' => 'CRM_Activity_BAO_Activity', | |
6a7e5e5d | 539 | 'localizable' => 0, |
c3fc2621 CW |
540 | ], |
541 | 'original_id' => [ | |
e501603b TO |
542 | 'name' => 'original_id', |
543 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 544 | 'title' => ts('Original Activity ID '), |
215b423e | 545 | 'description' => ts('Activity ID of the first activity record in versioning chain.'), |
a36434b9 | 546 | 'where' => 'civicrm_activity.original_id', |
522a26c9 | 547 | 'table_name' => 'civicrm_activity', |
548 | 'entity' => 'Activity', | |
549 | 'bao' => 'CRM_Activity_BAO_Activity', | |
6a7e5e5d | 550 | 'localizable' => 0, |
e501603b | 551 | 'FKClassName' => 'CRM_Activity_DAO_Activity', |
c3fc2621 CW |
552 | ], |
553 | 'activity_result' => [ | |
e501603b TO |
554 | 'name' => 'result', |
555 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 556 | 'title' => ts('Result'), |
215b423e | 557 | 'description' => ts('Currently being used to store result id for survey activity, FK to option value.'), |
e501603b TO |
558 | 'maxlength' => 255, |
559 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 560 | 'where' => 'civicrm_activity.result', |
522a26c9 | 561 | 'table_name' => 'civicrm_activity', |
562 | 'entity' => 'Activity', | |
563 | 'bao' => 'CRM_Activity_BAO_Activity', | |
6a7e5e5d | 564 | 'localizable' => 0, |
c3fc2621 CW |
565 | ], |
566 | 'activity_is_deleted' => [ | |
e501603b TO |
567 | 'name' => 'is_deleted', |
568 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 CW |
569 | 'title' => ts('Activity is in the Trash'), |
570 | 'import' => TRUE, | |
e501603b TO |
571 | 'where' => 'civicrm_activity.is_deleted', |
572 | 'headerPattern' => '/(activity.)?(trash|deleted)/i', | |
c3fc2621 | 573 | 'export' => TRUE, |
45a83e42 | 574 | 'default' => '0', |
522a26c9 | 575 | 'table_name' => 'civicrm_activity', |
576 | 'entity' => 'Activity', | |
577 | 'bao' => 'CRM_Activity_BAO_Activity', | |
6a7e5e5d | 578 | 'localizable' => 0, |
c3fc2621 | 579 | 'html' => [ |
3542118f | 580 | 'type' => 'CheckBox', |
c3fc2621 CW |
581 | ], |
582 | ], | |
583 | 'activity_campaign_id' => [ | |
e501603b TO |
584 | 'name' => 'campaign_id', |
585 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 586 | 'title' => ts('Campaign'), |
215b423e | 587 | 'description' => ts('The campaign for which this activity has been triggered.'), |
c3fc2621 | 588 | 'import' => TRUE, |
e501603b | 589 | 'where' => 'civicrm_activity.campaign_id', |
c3fc2621 | 590 | 'export' => TRUE, |
522a26c9 | 591 | 'table_name' => 'civicrm_activity', |
592 | 'entity' => 'Activity', | |
593 | 'bao' => 'CRM_Activity_BAO_Activity', | |
6a7e5e5d | 594 | 'localizable' => 0, |
e501603b | 595 | 'FKClassName' => 'CRM_Campaign_DAO_Campaign', |
c3fc2621 | 596 | 'html' => [ |
3542118f | 597 | 'type' => 'Select', |
c3fc2621 CW |
598 | ], |
599 | 'pseudoconstant' => [ | |
e501603b TO |
600 | 'table' => 'civicrm_campaign', |
601 | 'keyColumn' => 'id', | |
602 | 'labelColumn' => 'title', | |
e6ca0a57 | 603 | ], |
c3fc2621 CW |
604 | ], |
605 | 'activity_engagement_level' => [ | |
e501603b TO |
606 | 'name' => 'engagement_level', |
607 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 608 | 'title' => ts('Engagement Index'), |
215b423e | 609 | 'description' => ts('Assign a specific level of engagement to this activity. Used for tracking constituents in ladder of engagement.'), |
c3fc2621 | 610 | 'import' => TRUE, |
e501603b | 611 | 'where' => 'civicrm_activity.engagement_level', |
c3fc2621 | 612 | 'export' => TRUE, |
522a26c9 | 613 | 'table_name' => 'civicrm_activity', |
614 | 'entity' => 'Activity', | |
615 | 'bao' => 'CRM_Activity_BAO_Activity', | |
6a7e5e5d | 616 | 'localizable' => 0, |
c3fc2621 | 617 | 'html' => [ |
e501603b | 618 | 'type' => 'Select', |
c3fc2621 CW |
619 | ], |
620 | 'pseudoconstant' => [ | |
e501603b TO |
621 | 'optionGroupName' => 'engagement_index', |
622 | 'optionEditPath' => 'civicrm/admin/options/engagement_index', | |
e6ca0a57 | 623 | ], |
c3fc2621 CW |
624 | ], |
625 | 'weight' => [ | |
e501603b TO |
626 | 'name' => 'weight', |
627 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 628 | 'title' => ts('Order'), |
a36434b9 | 629 | 'where' => 'civicrm_activity.weight', |
522a26c9 | 630 | 'table_name' => 'civicrm_activity', |
631 | 'entity' => 'Activity', | |
632 | 'bao' => 'CRM_Activity_BAO_Activity', | |
6a7e5e5d | 633 | 'localizable' => 0, |
c3fc2621 CW |
634 | ], |
635 | 'is_star' => [ | |
cd063b10 CW |
636 | 'name' => 'is_star', |
637 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 638 | 'title' => ts('Is Starred'), |
215b423e | 639 | 'description' => ts('Activity marked as favorite.'), |
c3fc2621 | 640 | 'import' => TRUE, |
cd063b10 CW |
641 | 'where' => 'civicrm_activity.is_star', |
642 | 'headerPattern' => '/(activity.)?(star|favorite)/i', | |
c3fc2621 | 643 | 'export' => TRUE, |
45a83e42 | 644 | 'default' => '0', |
522a26c9 | 645 | 'table_name' => 'civicrm_activity', |
646 | 'entity' => 'Activity', | |
647 | 'bao' => 'CRM_Activity_BAO_Activity', | |
6a7e5e5d | 648 | 'localizable' => 0, |
3542118f CW |
649 | 'html' => [ |
650 | 'type' => 'Checkbox', | |
651 | ], | |
c3fc2621 CW |
652 | ], |
653 | 'activity_created_date' => [ | |
3ed77291 TO |
654 | 'name' => 'created_date', |
655 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
c3fc2621 | 656 | 'title' => ts('Created Date'), |
215b423e | 657 | 'description' => ts('When was the activity was created.'), |
c3fc2621 | 658 | 'required' => FALSE, |
3ed77291 | 659 | 'where' => 'civicrm_activity.created_date', |
a36434b9 | 660 | 'export' => TRUE, |
3ed77291 TO |
661 | 'default' => 'NULL', |
662 | 'table_name' => 'civicrm_activity', | |
663 | 'entity' => 'Activity', | |
664 | 'bao' => 'CRM_Activity_BAO_Activity', | |
665 | 'localizable' => 0, | |
c3fc2621 CW |
666 | ], |
667 | 'activity_modified_date' => [ | |
3ed77291 TO |
668 | 'name' => 'modified_date', |
669 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
c3fc2621 | 670 | 'title' => ts('Modified Date'), |
215b423e | 671 | 'description' => ts('When was the activity (or closely related entity) was created or modified or deleted.'), |
c3fc2621 | 672 | 'required' => FALSE, |
3ed77291 | 673 | 'where' => 'civicrm_activity.modified_date', |
a36434b9 | 674 | 'export' => TRUE, |
3ed77291 TO |
675 | 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', |
676 | 'table_name' => 'civicrm_activity', | |
677 | 'entity' => 'Activity', | |
678 | 'bao' => 'CRM_Activity_BAO_Activity', | |
679 | 'localizable' => 0, | |
c3fc2621 CW |
680 | ], |
681 | ]; | |
346aaaba | 682 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 683 | } |
346aaaba | 684 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 685 | } |
c3fc2621 | 686 | |
e501603b | 687 | /** |
bd8e0b14 | 688 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
689 | * |
690 | * @return array | |
bd8e0b14 | 691 | * Array(string $name => string $uniqueName). |
e501603b | 692 | */ |
c3fc2621 | 693 | public static function &fieldKeys() { |
bd8e0b14 TO |
694 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
695 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 696 | } |
bd8e0b14 | 697 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 698 | } |
c3fc2621 | 699 | |
e501603b TO |
700 | /** |
701 | * Returns the names of this table | |
702 | * | |
703 | * @return string | |
704 | */ | |
c3fc2621 | 705 | public static function getTableName() { |
e501603b TO |
706 | return self::$_tableName; |
707 | } | |
c3fc2621 | 708 | |
e501603b TO |
709 | /** |
710 | * Returns if this table needs to be logged | |
711 | * | |
c3fc2621 | 712 | * @return bool |
e501603b | 713 | */ |
c3fc2621 | 714 | public function getLog() { |
e501603b TO |
715 | return self::$_log; |
716 | } | |
c3fc2621 | 717 | |
e501603b TO |
718 | /** |
719 | * Returns the list of fields that can be imported | |
720 | * | |
721 | * @param bool $prefix | |
722 | * | |
723 | * @return array | |
724 | */ | |
c3fc2621 CW |
725 | public static function &import($prefix = FALSE) { |
726 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'activity', $prefix, []); | |
60808919 | 727 | return $r; |
e501603b | 728 | } |
c3fc2621 | 729 | |
e501603b TO |
730 | /** |
731 | * Returns the list of fields that can be exported | |
732 | * | |
733 | * @param bool $prefix | |
734 | * | |
735 | * @return array | |
736 | */ | |
c3fc2621 CW |
737 | public static function &export($prefix = FALSE) { |
738 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'activity', $prefix, []); | |
60808919 | 739 | return $r; |
e501603b | 740 | } |
c3fc2621 | 741 | |
e7a6b91a AS |
742 | /** |
743 | * Returns the list of indices | |
c3fc2621 CW |
744 | * |
745 | * @param bool $localize | |
746 | * | |
747 | * @return array | |
e7a6b91a AS |
748 | */ |
749 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
750 | $indices = [ |
751 | 'UI_source_record_id' => [ | |
e7a6b91a | 752 | 'name' => 'UI_source_record_id', |
c3fc2621 | 753 | 'field' => [ |
e7a6b91a | 754 | 0 => 'source_record_id', |
c3fc2621 CW |
755 | ], |
756 | 'localizable' => FALSE, | |
e7a6b91a | 757 | 'sig' => 'civicrm_activity::0::source_record_id', |
c3fc2621 CW |
758 | ], |
759 | 'UI_activity_type_id' => [ | |
e7a6b91a | 760 | 'name' => 'UI_activity_type_id', |
c3fc2621 | 761 | 'field' => [ |
e7a6b91a | 762 | 0 => 'activity_type_id', |
c3fc2621 CW |
763 | ], |
764 | 'localizable' => FALSE, | |
e7a6b91a | 765 | 'sig' => 'civicrm_activity::0::activity_type_id', |
c3fc2621 CW |
766 | ], |
767 | 'index_activity_date_time' => [ | |
ab49600a | 768 | 'name' => 'index_activity_date_time', |
c3fc2621 | 769 | 'field' => [ |
ab49600a | 770 | 0 => 'activity_date_time', |
c3fc2621 CW |
771 | ], |
772 | 'localizable' => FALSE, | |
ab49600a | 773 | 'sig' => 'civicrm_activity::0::activity_date_time', |
c3fc2621 CW |
774 | ], |
775 | 'index_status_id' => [ | |
5b3543ce | 776 | 'name' => 'index_status_id', |
c3fc2621 | 777 | 'field' => [ |
5b3543ce | 778 | 0 => 'status_id', |
c3fc2621 CW |
779 | ], |
780 | 'localizable' => FALSE, | |
5b3543ce | 781 | 'sig' => 'civicrm_activity::0::status_id', |
c3fc2621 CW |
782 | ], |
783 | 'index_medium_id' => [ | |
e7a6b91a | 784 | 'name' => 'index_medium_id', |
c3fc2621 | 785 | 'field' => [ |
e7a6b91a | 786 | 0 => 'medium_id', |
c3fc2621 CW |
787 | ], |
788 | 'localizable' => FALSE, | |
e7a6b91a | 789 | 'sig' => 'civicrm_activity::0::medium_id', |
c3fc2621 CW |
790 | ], |
791 | 'index_is_current_revision' => [ | |
e7a6b91a | 792 | 'name' => 'index_is_current_revision', |
c3fc2621 | 793 | 'field' => [ |
e7a6b91a | 794 | 0 => 'is_current_revision', |
c3fc2621 CW |
795 | ], |
796 | 'localizable' => FALSE, | |
e7a6b91a | 797 | 'sig' => 'civicrm_activity::0::is_current_revision', |
c3fc2621 CW |
798 | ], |
799 | 'index_is_deleted' => [ | |
e7a6b91a | 800 | 'name' => 'index_is_deleted', |
c3fc2621 | 801 | 'field' => [ |
e7a6b91a | 802 | 0 => 'is_deleted', |
c3fc2621 CW |
803 | ], |
804 | 'localizable' => FALSE, | |
e7a6b91a | 805 | 'sig' => 'civicrm_activity::0::is_deleted', |
c3fc2621 CW |
806 | ], |
807 | ]; | |
e7a6b91a AS |
808 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
809 | } | |
c3fc2621 | 810 | |
e501603b | 811 | } |