Merge pull request #9607 from yashodha/update-year
[civicrm-core.git] / CRM / Activity / DAO / Activity.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
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
29 * @copyright CiviCRM LLC (c) 2004-2017
30 *
31 * Generated from xml/schema/CRM/Activity/Activity.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:c9a4e687808af7624ecb22a5f328b3a4)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Activity_DAO_Activity extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_activity';
44 /**
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
47 *
48 * @var boolean
49 */
50 static $_log = true;
51 /**
52 * Unique Other Activity ID
53 *
54 * @var int unsigned
55 */
56 public $id;
57 /**
58 * 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.
59 *
60 * @var int unsigned
61 */
62 public $source_record_id;
63 /**
64 * FK to civicrm_option_value.id, that has to be valid, registered activity type.
65 *
66 * @var int unsigned
67 */
68 public $activity_type_id;
69 /**
70 * The subject/purpose/short description of the activity.
71 *
72 * @var string
73 */
74 public $subject;
75 /**
76 * Date and time this activity is scheduled to occur. Formerly named scheduled_date_time.
77 *
78 * @var datetime
79 */
80 public $activity_date_time;
81 /**
82 * Planned or actual duration of activity expressed in minutes. Conglomerate of former duration_hours and duration_minutes.
83 *
84 * @var int unsigned
85 */
86 public $duration;
87 /**
88 * Location of the activity (optional, open text).
89 *
90 * @var string
91 */
92 public $location;
93 /**
94 * Phone ID of the number called (optional - used if an existing phone number is selected).
95 *
96 * @var int unsigned
97 */
98 public $phone_id;
99 /**
100 * Phone number in case the number does not exist in the civicrm_phone table.
101 *
102 * @var string
103 */
104 public $phone_number;
105 /**
106 * Details about the activity (agenda, notes, etc).
107 *
108 * @var longtext
109 */
110 public $details;
111 /**
112 * ID of the status this activity is currently in. Foreign key to civicrm_option_value.
113 *
114 * @var int unsigned
115 */
116 public $status_id;
117 /**
118 * ID of the priority given to this activity. Foreign key to civicrm_option_value.
119 *
120 * @var int unsigned
121 */
122 public $priority_id;
123 /**
124 * Parent meeting ID (if this is a follow-up item). This is not currently implemented
125 *
126 * @var int unsigned
127 */
128 public $parent_id;
129 /**
130 *
131 * @var boolean
132 */
133 public $is_test;
134 /**
135 * Activity Medium, Implicit FK to civicrm_option_value where option_group = encounter_medium.
136 *
137 * @var int unsigned
138 */
139 public $medium_id;
140 /**
141 *
142 * @var boolean
143 */
144 public $is_auto;
145 /**
146 * FK to Relationship ID
147 *
148 * @var int unsigned
149 */
150 public $relationship_id;
151 /**
152 *
153 * @var boolean
154 */
155 public $is_current_revision;
156 /**
157 * Activity ID of the first activity record in versioning chain.
158 *
159 * @var int unsigned
160 */
161 public $original_id;
162 /**
163 * Currently being used to store result id for survey activity, FK to option value.
164 *
165 * @var string
166 */
167 public $result;
168 /**
169 *
170 * @var boolean
171 */
172 public $is_deleted;
173 /**
174 * The campaign for which this activity has been triggered.
175 *
176 * @var int unsigned
177 */
178 public $campaign_id;
179 /**
180 * Assign a specific level of engagement to this activity. Used for tracking constituents in ladder of engagement.
181 *
182 * @var int unsigned
183 */
184 public $engagement_level;
185 /**
186 *
187 * @var int
188 */
189 public $weight;
190 /**
191 * class constructor
192 *
193 * @return civicrm_activity
194 */
195 function __construct() {
196 $this->__table = 'civicrm_activity';
197 parent::__construct();
198 }
199 /**
200 * Returns foreign keys and entity references
201 *
202 * @return array
203 * [CRM_Core_Reference_Interface]
204 */
205 static function getReferenceColumns() {
206 if (!isset(Civi::$statics[__CLASS__]['links'])) {
207 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
208 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'phone_id', 'civicrm_phone', 'id');
209 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_activity', 'id');
210 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'relationship_id', 'civicrm_relationship', 'id');
211 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'original_id', 'civicrm_activity', 'id');
212 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id');
213 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
214 }
215 return Civi::$statics[__CLASS__]['links'];
216 }
217 /**
218 * Returns all the column names of this table
219 *
220 * @return array
221 */
222 static function &fields() {
223 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
224 Civi::$statics[__CLASS__]['fields'] = array(
225 'activity_id' => array(
226 'name' => 'id',
227 'type' => CRM_Utils_Type::T_INT,
228 'title' => ts('Activity ID') ,
229 'description' => 'Unique Other Activity ID',
230 'required' => true,
231 'import' => true,
232 'where' => 'civicrm_activity.id',
233 'headerPattern' => '',
234 'dataPattern' => '',
235 'export' => true,
236 ) ,
237 'source_record_id' => array(
238 'name' => 'source_record_id',
239 'type' => CRM_Utils_Type::T_INT,
240 'title' => ts('Source Record') ,
241 '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.',
242 ) ,
243 'activity_type_id' => array(
244 'name' => 'activity_type_id',
245 'type' => CRM_Utils_Type::T_INT,
246 'title' => ts('Activity Type ID') ,
247 'description' => 'FK to civicrm_option_value.id, that has to be valid, registered activity type.',
248 'required' => true,
249 'import' => true,
250 'where' => 'civicrm_activity.activity_type_id',
251 'headerPattern' => '/(activity.)?type(.id$)/i',
252 'dataPattern' => '',
253 'export' => true,
254 'default' => '1',
255 'html' => array(
256 'type' => 'Select',
257 ) ,
258 'pseudoconstant' => array(
259 'optionGroupName' => 'activity_type',
260 'optionEditPath' => 'civicrm/admin/options/activity_type',
261 )
262 ) ,
263 'activity_subject' => array(
264 'name' => 'subject',
265 'type' => CRM_Utils_Type::T_STRING,
266 'title' => ts('Subject') ,
267 'description' => 'The subject/purpose/short description of the activity.',
268 'maxlength' => 255,
269 'size' => CRM_Utils_Type::HUGE,
270 'import' => true,
271 'where' => 'civicrm_activity.subject',
272 'headerPattern' => '/(activity.)?subject/i',
273 'dataPattern' => '',
274 'export' => true,
275 'html' => array(
276 'type' => 'Text',
277 ) ,
278 ) ,
279 'activity_date_time' => array(
280 'name' => 'activity_date_time',
281 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
282 'title' => ts('Activity Date') ,
283 'description' => 'Date and time this activity is scheduled to occur. Formerly named scheduled_date_time.',
284 'import' => true,
285 'where' => 'civicrm_activity.activity_date_time',
286 'headerPattern' => '/(activity.)?date(.time$)?/i',
287 'dataPattern' => '',
288 'export' => true,
289 'html' => array(
290 'type' => 'Select Date',
291 ) ,
292 ) ,
293 'activity_duration' => array(
294 'name' => 'duration',
295 'type' => CRM_Utils_Type::T_INT,
296 'title' => ts('Duration') ,
297 'description' => 'Planned or actual duration of activity expressed in minutes. Conglomerate of former duration_hours and duration_minutes.',
298 'import' => true,
299 'where' => 'civicrm_activity.duration',
300 'headerPattern' => '/(activity.)?duration(s)?$/i',
301 'dataPattern' => '',
302 'export' => true,
303 'html' => array(
304 'type' => 'Text',
305 ) ,
306 ) ,
307 'activity_location' => array(
308 'name' => 'location',
309 'type' => CRM_Utils_Type::T_STRING,
310 'title' => ts('Location') ,
311 'description' => 'Location of the activity (optional, open text).',
312 'maxlength' => 255,
313 'size' => CRM_Utils_Type::HUGE,
314 'import' => true,
315 'where' => 'civicrm_activity.location',
316 'headerPattern' => '/(activity.)?location$/i',
317 'dataPattern' => '',
318 'export' => true,
319 'html' => array(
320 'type' => 'Text',
321 ) ,
322 ) ,
323 'phone_id' => array(
324 'name' => 'phone_id',
325 'type' => CRM_Utils_Type::T_INT,
326 'title' => ts('Phone (called) ID') ,
327 'description' => 'Phone ID of the number called (optional - used if an existing phone number is selected).',
328 'FKClassName' => 'CRM_Core_DAO_Phone',
329 'html' => array(
330 'type' => 'EntityRef',
331 ) ,
332 ) ,
333 'phone_number' => array(
334 'name' => 'phone_number',
335 'type' => CRM_Utils_Type::T_STRING,
336 'title' => ts('Phone (called) Number') ,
337 'description' => 'Phone number in case the number does not exist in the civicrm_phone table.',
338 'maxlength' => 64,
339 'size' => CRM_Utils_Type::BIG,
340 'html' => array(
341 'type' => 'Text',
342 ) ,
343 ) ,
344 'activity_details' => array(
345 'name' => 'details',
346 'type' => CRM_Utils_Type::T_LONGTEXT,
347 'title' => ts('Details') ,
348 'description' => 'Details about the activity (agenda, notes, etc).',
349 'import' => true,
350 'where' => 'civicrm_activity.details',
351 'headerPattern' => '/(activity.)?detail(s)?$/i',
352 'dataPattern' => '',
353 'export' => true,
354 'html' => array(
355 'type' => 'RichTextEditor',
356 ) ,
357 ) ,
358 'activity_status_id' => array(
359 'name' => 'status_id',
360 'type' => CRM_Utils_Type::T_INT,
361 'title' => ts('Activity Status') ,
362 'description' => 'ID of the status this activity is currently in. Foreign key to civicrm_option_value.',
363 'import' => true,
364 'where' => 'civicrm_activity.status_id',
365 'headerPattern' => '/(activity.)?status(.label$)?/i',
366 'dataPattern' => '',
367 'export' => false,
368 'html' => array(
369 'type' => 'Select',
370 ) ,
371 'pseudoconstant' => array(
372 'optionGroupName' => 'activity_status',
373 'optionEditPath' => 'civicrm/admin/options/activity_status',
374 )
375 ) ,
376 'priority_id' => array(
377 'name' => 'priority_id',
378 'type' => CRM_Utils_Type::T_INT,
379 'title' => ts('Priority') ,
380 'description' => 'ID of the priority given to this activity. Foreign key to civicrm_option_value.',
381 'html' => array(
382 'type' => 'Select',
383 ) ,
384 'pseudoconstant' => array(
385 'optionGroupName' => 'priority',
386 'optionEditPath' => 'civicrm/admin/options/priority',
387 )
388 ) ,
389 'parent_id' => array(
390 'name' => 'parent_id',
391 'type' => CRM_Utils_Type::T_INT,
392 'title' => ts('Parent Activity Id') ,
393 'description' => 'Parent meeting ID (if this is a follow-up item). This is not currently implemented',
394 'FKClassName' => 'CRM_Activity_DAO_Activity',
395 ) ,
396 'activity_is_test' => array(
397 'name' => 'is_test',
398 'type' => CRM_Utils_Type::T_BOOLEAN,
399 'title' => ts('Test') ,
400 'import' => true,
401 'where' => 'civicrm_activity.is_test',
402 'headerPattern' => '/(is.)?test(.activity)?/i',
403 'dataPattern' => '',
404 'export' => true,
405 'html' => array(
406 'type' => 'Select',
407 ) ,
408 ) ,
409 'activity_medium_id' => array(
410 'name' => 'medium_id',
411 'type' => CRM_Utils_Type::T_INT,
412 'title' => ts('Activity Medium') ,
413 'description' => 'Activity Medium, Implicit FK to civicrm_option_value where option_group = encounter_medium.',
414 'default' => 'NULL',
415 'html' => array(
416 'type' => 'Select',
417 ) ,
418 'pseudoconstant' => array(
419 'optionGroupName' => 'encounter_medium',
420 'optionEditPath' => 'civicrm/admin/options/encounter_medium',
421 )
422 ) ,
423 'is_auto' => array(
424 'name' => 'is_auto',
425 'type' => CRM_Utils_Type::T_BOOLEAN,
426 'title' => ts('Auto') ,
427 ) ,
428 'relationship_id' => array(
429 'name' => 'relationship_id',
430 'type' => CRM_Utils_Type::T_INT,
431 'title' => ts('Relationship Id') ,
432 'description' => 'FK to Relationship ID',
433 'default' => 'NULL',
434 'FKClassName' => 'CRM_Contact_DAO_Relationship',
435 ) ,
436 'is_current_revision' => array(
437 'name' => 'is_current_revision',
438 'type' => CRM_Utils_Type::T_BOOLEAN,
439 'title' => ts('Is this activity a current revision in versioning chain?') ,
440 'import' => true,
441 'where' => 'civicrm_activity.is_current_revision',
442 'headerPattern' => '/(is.)?(current.)?(revision|version(ing)?)/i',
443 'dataPattern' => '',
444 'export' => true,
445 'default' => '1',
446 'html' => array(
447 'type' => 'CheckBox',
448 ) ,
449 ) ,
450 'original_id' => array(
451 'name' => 'original_id',
452 'type' => CRM_Utils_Type::T_INT,
453 'title' => ts('Original Activity ID ') ,
454 'description' => 'Activity ID of the first activity record in versioning chain.',
455 'FKClassName' => 'CRM_Activity_DAO_Activity',
456 ) ,
457 'activity_result' => array(
458 'name' => 'result',
459 'type' => CRM_Utils_Type::T_STRING,
460 'title' => ts('Result') ,
461 'description' => 'Currently being used to store result id for survey activity, FK to option value.',
462 'maxlength' => 255,
463 'size' => CRM_Utils_Type::HUGE,
464 'html' => array(
465 'type' => 'Text',
466 ) ,
467 ) ,
468 'activity_is_deleted' => array(
469 'name' => 'is_deleted',
470 'type' => CRM_Utils_Type::T_BOOLEAN,
471 'title' => ts('Activity is in the Trash') ,
472 'import' => true,
473 'where' => 'civicrm_activity.is_deleted',
474 'headerPattern' => '/(activity.)?(trash|deleted)/i',
475 'dataPattern' => '',
476 'export' => true,
477 'html' => array(
478 'type' => 'Text',
479 ) ,
480 ) ,
481 'activity_campaign_id' => array(
482 'name' => 'campaign_id',
483 'type' => CRM_Utils_Type::T_INT,
484 'title' => ts('Campaign') ,
485 'description' => 'The campaign for which this activity has been triggered.',
486 'import' => true,
487 'where' => 'civicrm_activity.campaign_id',
488 'headerPattern' => '',
489 'dataPattern' => '',
490 'export' => true,
491 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
492 'html' => array(
493 'type' => 'CheckBox',
494 ) ,
495 'pseudoconstant' => array(
496 'table' => 'civicrm_campaign',
497 'keyColumn' => 'id',
498 'labelColumn' => 'title',
499 )
500 ) ,
501 'activity_engagement_level' => array(
502 'name' => 'engagement_level',
503 'type' => CRM_Utils_Type::T_INT,
504 'title' => ts('Engagement Index') ,
505 'description' => 'Assign a specific level of engagement to this activity. Used for tracking constituents in ladder of engagement.',
506 'import' => true,
507 'where' => 'civicrm_activity.engagement_level',
508 'headerPattern' => '',
509 'dataPattern' => '',
510 'export' => true,
511 'html' => array(
512 'type' => 'Select',
513 ) ,
514 'pseudoconstant' => array(
515 'optionGroupName' => 'engagement_index',
516 'optionEditPath' => 'civicrm/admin/options/engagement_index',
517 )
518 ) ,
519 'weight' => array(
520 'name' => 'weight',
521 'type' => CRM_Utils_Type::T_INT,
522 'title' => ts('Order') ,
523 'html' => array(
524 'type' => 'Text',
525 ) ,
526 ) ,
527 );
528 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
529 }
530 return Civi::$statics[__CLASS__]['fields'];
531 }
532 /**
533 * Return a mapping from field-name to the corresponding key (as used in fields()).
534 *
535 * @return array
536 * Array(string $name => string $uniqueName).
537 */
538 static function &fieldKeys() {
539 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
540 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
541 }
542 return Civi::$statics[__CLASS__]['fieldKeys'];
543 }
544 /**
545 * Returns the names of this table
546 *
547 * @return string
548 */
549 static function getTableName() {
550 return self::$_tableName;
551 }
552 /**
553 * Returns if this table needs to be logged
554 *
555 * @return boolean
556 */
557 function getLog() {
558 return self::$_log;
559 }
560 /**
561 * Returns the list of fields that can be imported
562 *
563 * @param bool $prefix
564 *
565 * @return array
566 */
567 static function &import($prefix = false) {
568 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'activity', $prefix, array());
569 return $r;
570 }
571 /**
572 * Returns the list of fields that can be exported
573 *
574 * @param bool $prefix
575 *
576 * @return array
577 */
578 static function &export($prefix = false) {
579 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'activity', $prefix, array());
580 return $r;
581 }
582 }