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