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