3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
29 * @copyright CiviCRM LLC (c) 2004-2017
31 * Generated from xml/schema/CRM/Activity/Activity.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:e29dddab1cbaae042d11ea6e022f3dd5)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
38 * CRM_Activity_DAO_Activity constructor.
40 class CRM_Activity_DAO_Activity
extends CRM_Core_DAO
{
42 * Static instance to hold the table name.
46 static $_tableName = 'civicrm_activity';
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
54 * Unique Other Activity ID
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.
64 public $source_record_id;
66 * FK to civicrm_option_value.id, that has to be valid, registered activity type.
70 public $activity_type_id;
72 * The subject/purpose/short description of the activity.
78 * Date and time this activity is scheduled to occur. Formerly named scheduled_date_time.
82 public $activity_date_time;
84 * Planned or actual duration of activity expressed in minutes. Conglomerate of former duration_hours and duration_minutes.
90 * Location of the activity (optional, open text).
96 * Phone ID of the number called (optional - used if an existing phone number is selected).
102 * Phone number in case the number does not exist in the civicrm_phone table.
106 public $phone_number;
108 * Details about the activity (agenda, notes, etc).
114 * ID of the status this activity is currently in. Foreign key to civicrm_option_value.
120 * ID of the priority given to this activity. Foreign key to civicrm_option_value.
126 * Parent meeting ID (if this is a follow-up item). This is not currently implemented
137 * Activity Medium, Implicit FK to civicrm_option_value where option_group = encounter_medium.
148 * FK to Relationship ID
152 public $relationship_id;
157 public $is_current_revision;
159 * Activity ID of the first activity record in versioning chain.
165 * Currently being used to store result id for survey activity, FK to option value.
176 * The campaign for which this activity has been triggered.
182 * Assign a specific level of engagement to this activity. Used for tracking constituents in ladder of engagement.
186 public $engagement_level;
193 * Activity marked as favorite.
201 function __construct() {
202 $this->__table
= 'civicrm_activity';
203 parent
::__construct();
206 * Returns foreign keys and entity references.
209 * [CRM_Core_Reference_Interface]
211 static function getReferenceColumns() {
212 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
213 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
214 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'phone_id', 'civicrm_phone', 'id');
215 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'parent_id', 'civicrm_activity', 'id');
216 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'relationship_id', 'civicrm_relationship', 'id');
217 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'original_id', 'civicrm_activity', 'id');
218 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'campaign_id', 'civicrm_campaign', 'id');
219 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
221 return Civi
::$statics[__CLASS__
]['links'];
224 * Returns all the column names of this table
228 static function &fields() {
229 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
230 Civi
::$statics[__CLASS__
]['fields'] = array(
231 'activity_id' => array(
233 'type' => CRM_Utils_Type
::T_INT
,
234 'title' => ts('Activity ID') ,
235 'description' => 'Unique Other Activity ID',
238 'where' => 'civicrm_activity.id',
239 'headerPattern' => '',
242 'table_name' => 'civicrm_activity',
243 'entity' => 'Activity',
244 'bao' => 'CRM_Activity_BAO_Activity',
246 'source_record_id' => array(
247 'name' => 'source_record_id',
248 'type' => CRM_Utils_Type
::T_INT
,
249 'title' => ts('Source Record') ,
250 '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.',
251 'table_name' => 'civicrm_activity',
252 'entity' => 'Activity',
253 'bao' => 'CRM_Activity_BAO_Activity',
255 'activity_type_id' => array(
256 'name' => 'activity_type_id',
257 'type' => CRM_Utils_Type
::T_INT
,
258 'title' => ts('Activity Type ID') ,
259 'description' => 'FK to civicrm_option_value.id, that has to be valid, registered activity type.',
262 'where' => 'civicrm_activity.activity_type_id',
263 'headerPattern' => '/(activity.)?type(.id$)/i',
267 'table_name' => 'civicrm_activity',
268 'entity' => 'Activity',
269 'bao' => 'CRM_Activity_BAO_Activity',
273 'pseudoconstant' => array(
274 'optionGroupName' => 'activity_type',
275 'optionEditPath' => 'civicrm/admin/options/activity_type',
278 'activity_subject' => array(
280 'type' => CRM_Utils_Type
::T_STRING
,
281 'title' => ts('Subject') ,
282 'description' => 'The subject/purpose/short description of the activity.',
284 'size' => CRM_Utils_Type
::HUGE
,
286 'where' => 'civicrm_activity.subject',
287 'headerPattern' => '/(activity.)?subject/i',
290 'table_name' => 'civicrm_activity',
291 'entity' => 'Activity',
292 'bao' => 'CRM_Activity_BAO_Activity',
297 'activity_date_time' => array(
298 'name' => 'activity_date_time',
299 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
300 'title' => ts('Activity Date') ,
301 'description' => 'Date and time this activity is scheduled to occur. Formerly named scheduled_date_time.',
303 'where' => 'civicrm_activity.activity_date_time',
304 'headerPattern' => '/(activity.)?date(.time$)?/i',
307 'table_name' => 'civicrm_activity',
308 'entity' => 'Activity',
309 'bao' => 'CRM_Activity_BAO_Activity',
311 'type' => 'Select Date',
312 'formatType' => 'activityDateTime',
315 'activity_duration' => array(
316 'name' => 'duration',
317 'type' => CRM_Utils_Type
::T_INT
,
318 'title' => ts('Duration') ,
319 'description' => 'Planned or actual duration of activity expressed in minutes. Conglomerate of former duration_hours and duration_minutes.',
321 'where' => 'civicrm_activity.duration',
322 'headerPattern' => '/(activity.)?duration(s)?$/i',
325 'table_name' => 'civicrm_activity',
326 'entity' => 'Activity',
327 'bao' => 'CRM_Activity_BAO_Activity',
332 'activity_location' => array(
333 'name' => 'location',
334 'type' => CRM_Utils_Type
::T_STRING
,
335 'title' => ts('Location') ,
336 'description' => 'Location of the activity (optional, open text).',
338 'size' => CRM_Utils_Type
::HUGE
,
340 'where' => 'civicrm_activity.location',
341 'headerPattern' => '/(activity.)?location$/i',
344 'table_name' => 'civicrm_activity',
345 'entity' => 'Activity',
346 'bao' => 'CRM_Activity_BAO_Activity',
352 'name' => 'phone_id',
353 'type' => CRM_Utils_Type
::T_INT
,
354 'title' => ts('Phone (called) ID') ,
355 'description' => 'Phone ID of the number called (optional - used if an existing phone number is selected).',
356 'table_name' => 'civicrm_activity',
357 'entity' => 'Activity',
358 'bao' => 'CRM_Activity_BAO_Activity',
359 'FKClassName' => 'CRM_Core_DAO_Phone',
361 'type' => 'EntityRef',
364 'phone_number' => array(
365 'name' => 'phone_number',
366 'type' => CRM_Utils_Type
::T_STRING
,
367 'title' => ts('Phone (called) Number') ,
368 'description' => 'Phone number in case the number does not exist in the civicrm_phone table.',
370 'size' => CRM_Utils_Type
::BIG
,
371 'table_name' => 'civicrm_activity',
372 'entity' => 'Activity',
373 'bao' => 'CRM_Activity_BAO_Activity',
378 'activity_details' => array(
380 'type' => CRM_Utils_Type
::T_LONGTEXT
,
381 'title' => ts('Details') ,
382 'description' => 'Details about the activity (agenda, notes, etc).',
384 'where' => 'civicrm_activity.details',
385 'headerPattern' => '/(activity.)?detail(s)?$/i',
388 'table_name' => 'civicrm_activity',
389 'entity' => 'Activity',
390 'bao' => 'CRM_Activity_BAO_Activity',
392 'type' => 'RichTextEditor',
395 'activity_status_id' => array(
396 'name' => 'status_id',
397 'type' => CRM_Utils_Type
::T_INT
,
398 'title' => ts('Activity Status') ,
399 'description' => 'ID of the status this activity is currently in. Foreign key to civicrm_option_value.',
401 'where' => 'civicrm_activity.status_id',
402 'headerPattern' => '/(activity.)?status(.label$)?/i',
405 'table_name' => 'civicrm_activity',
406 'entity' => 'Activity',
407 'bao' => 'CRM_Activity_BAO_Activity',
411 'pseudoconstant' => array(
412 'optionGroupName' => 'activity_status',
413 'optionEditPath' => 'civicrm/admin/options/activity_status',
416 'priority_id' => array(
417 'name' => 'priority_id',
418 'type' => CRM_Utils_Type
::T_INT
,
419 'title' => ts('Priority') ,
420 'description' => 'ID of the priority given to this activity. Foreign key to civicrm_option_value.',
421 'table_name' => 'civicrm_activity',
422 'entity' => 'Activity',
423 'bao' => 'CRM_Activity_BAO_Activity',
427 'pseudoconstant' => array(
428 'optionGroupName' => 'priority',
429 'optionEditPath' => 'civicrm/admin/options/priority',
432 'parent_id' => array(
433 'name' => 'parent_id',
434 'type' => CRM_Utils_Type
::T_INT
,
435 'title' => ts('Parent Activity Id') ,
436 'description' => 'Parent meeting ID (if this is a follow-up item). This is not currently implemented',
437 'table_name' => 'civicrm_activity',
438 'entity' => 'Activity',
439 'bao' => 'CRM_Activity_BAO_Activity',
440 'FKClassName' => 'CRM_Activity_DAO_Activity',
442 'activity_is_test' => array(
444 'type' => CRM_Utils_Type
::T_BOOLEAN
,
445 'title' => ts('Test') ,
447 'where' => 'civicrm_activity.is_test',
448 'headerPattern' => '/(is.)?test(.activity)?/i',
451 'table_name' => 'civicrm_activity',
452 'entity' => 'Activity',
453 'bao' => 'CRM_Activity_BAO_Activity',
458 'activity_medium_id' => array(
459 'name' => 'medium_id',
460 'type' => CRM_Utils_Type
::T_INT
,
461 'title' => ts('Activity Medium') ,
462 'description' => 'Activity Medium, Implicit FK to civicrm_option_value where option_group = encounter_medium.',
464 'table_name' => 'civicrm_activity',
465 'entity' => 'Activity',
466 'bao' => 'CRM_Activity_BAO_Activity',
470 'pseudoconstant' => array(
471 'optionGroupName' => 'encounter_medium',
472 'optionEditPath' => 'civicrm/admin/options/encounter_medium',
477 'type' => CRM_Utils_Type
::T_BOOLEAN
,
478 'title' => ts('Auto') ,
479 'table_name' => 'civicrm_activity',
480 'entity' => 'Activity',
481 'bao' => 'CRM_Activity_BAO_Activity',
483 'relationship_id' => array(
484 'name' => 'relationship_id',
485 'type' => CRM_Utils_Type
::T_INT
,
486 'title' => ts('Relationship Id') ,
487 'description' => 'FK to Relationship ID',
489 'table_name' => 'civicrm_activity',
490 'entity' => 'Activity',
491 'bao' => 'CRM_Activity_BAO_Activity',
492 'FKClassName' => 'CRM_Contact_DAO_Relationship',
494 'is_current_revision' => array(
495 'name' => 'is_current_revision',
496 'type' => CRM_Utils_Type
::T_BOOLEAN
,
497 'title' => ts('Is this activity a current revision in versioning chain?') ,
499 'where' => 'civicrm_activity.is_current_revision',
500 'headerPattern' => '/(is.)?(current.)?(revision|version(ing)?)/i',
504 'table_name' => 'civicrm_activity',
505 'entity' => 'Activity',
506 'bao' => 'CRM_Activity_BAO_Activity',
508 'type' => 'CheckBox',
511 'original_id' => array(
512 'name' => 'original_id',
513 'type' => CRM_Utils_Type
::T_INT
,
514 'title' => ts('Original Activity ID ') ,
515 'description' => 'Activity ID of the first activity record in versioning chain.',
516 'table_name' => 'civicrm_activity',
517 'entity' => 'Activity',
518 'bao' => 'CRM_Activity_BAO_Activity',
519 'FKClassName' => 'CRM_Activity_DAO_Activity',
521 'activity_result' => array(
523 'type' => CRM_Utils_Type
::T_STRING
,
524 'title' => ts('Result') ,
525 'description' => 'Currently being used to store result id for survey activity, FK to option value.',
527 'size' => CRM_Utils_Type
::HUGE
,
528 'table_name' => 'civicrm_activity',
529 'entity' => 'Activity',
530 'bao' => 'CRM_Activity_BAO_Activity',
535 'activity_is_deleted' => array(
536 'name' => 'is_deleted',
537 'type' => CRM_Utils_Type
::T_BOOLEAN
,
538 'title' => ts('Activity is in the Trash') ,
540 'where' => 'civicrm_activity.is_deleted',
541 'headerPattern' => '/(activity.)?(trash|deleted)/i',
544 'table_name' => 'civicrm_activity',
545 'entity' => 'Activity',
546 'bao' => 'CRM_Activity_BAO_Activity',
551 'activity_campaign_id' => array(
552 'name' => 'campaign_id',
553 'type' => CRM_Utils_Type
::T_INT
,
554 'title' => ts('Campaign') ,
555 'description' => 'The campaign for which this activity has been triggered.',
557 'where' => 'civicrm_activity.campaign_id',
558 'headerPattern' => '',
561 'table_name' => 'civicrm_activity',
562 'entity' => 'Activity',
563 'bao' => 'CRM_Activity_BAO_Activity',
564 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
566 'type' => 'CheckBox',
568 'pseudoconstant' => array(
569 'table' => 'civicrm_campaign',
571 'labelColumn' => 'title',
574 'activity_engagement_level' => array(
575 'name' => 'engagement_level',
576 'type' => CRM_Utils_Type
::T_INT
,
577 'title' => ts('Engagement Index') ,
578 'description' => 'Assign a specific level of engagement to this activity. Used for tracking constituents in ladder of engagement.',
580 'where' => 'civicrm_activity.engagement_level',
581 'headerPattern' => '',
584 'table_name' => 'civicrm_activity',
585 'entity' => 'Activity',
586 'bao' => 'CRM_Activity_BAO_Activity',
590 'pseudoconstant' => array(
591 'optionGroupName' => 'engagement_index',
592 'optionEditPath' => 'civicrm/admin/options/engagement_index',
597 'type' => CRM_Utils_Type
::T_INT
,
598 'title' => ts('Order') ,
599 'table_name' => 'civicrm_activity',
600 'entity' => 'Activity',
601 'bao' => 'CRM_Activity_BAO_Activity',
608 'type' => CRM_Utils_Type
::T_BOOLEAN
,
609 'title' => ts('Is Starred') ,
610 'description' => 'Activity marked as favorite.',
612 'where' => 'civicrm_activity.is_star',
613 'headerPattern' => '/(activity.)?(star|favorite)/i',
616 'table_name' => 'civicrm_activity',
617 'entity' => 'Activity',
618 'bao' => 'CRM_Activity_BAO_Activity',
621 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
623 return Civi
::$statics[__CLASS__
]['fields'];
626 * Return a mapping from field-name to the corresponding key (as used in fields()).
629 * Array(string $name => string $uniqueName).
631 static function &fieldKeys() {
632 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
633 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
635 return Civi
::$statics[__CLASS__
]['fieldKeys'];
638 * Returns the names of this table
642 static function getTableName() {
643 return self
::$_tableName;
646 * Returns if this table needs to be logged
654 * Returns the list of fields that can be imported
656 * @param bool $prefix
660 static function &import($prefix = false) {
661 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'activity', $prefix, array());
665 * Returns the list of fields that can be exported
667 * @param bool $prefix
671 static function &export($prefix = false) {
672 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'activity', $prefix, array());