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