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