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