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:a530f1fb1a27c5a15b5d138732b4c581)
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',
247 'source_record_id' => array(
248 'name' => 'source_record_id',
249 'type' => CRM_Utils_Type
::T_INT
,
250 'title' => ts('Source Record') ,
251 '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.',
252 'table_name' => 'civicrm_activity',
253 'entity' => 'Activity',
254 'bao' => 'CRM_Activity_BAO_Activity',
257 'activity_type_id' => array(
258 'name' => 'activity_type_id',
259 'type' => CRM_Utils_Type
::T_INT
,
260 'title' => ts('Activity Type ID') ,
261 'description' => 'FK to civicrm_option_value.id, that has to be valid, registered activity type.',
264 'where' => 'civicrm_activity.activity_type_id',
265 'headerPattern' => '/(activity.)?type(.id$)/i',
269 'table_name' => 'civicrm_activity',
270 'entity' => 'Activity',
271 'bao' => 'CRM_Activity_BAO_Activity',
276 'pseudoconstant' => array(
277 'optionGroupName' => 'activity_type',
278 'optionEditPath' => 'civicrm/admin/options/activity_type',
281 'activity_subject' => array(
283 'type' => CRM_Utils_Type
::T_STRING
,
284 'title' => ts('Subject') ,
285 'description' => 'The subject/purpose/short description of the activity.',
287 'size' => CRM_Utils_Type
::HUGE
,
289 'where' => 'civicrm_activity.subject',
290 'headerPattern' => '/(activity.)?subject/i',
293 'table_name' => 'civicrm_activity',
294 'entity' => 'Activity',
295 'bao' => 'CRM_Activity_BAO_Activity',
301 'activity_date_time' => array(
302 'name' => 'activity_date_time',
303 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
304 'title' => ts('Activity Date') ,
305 'description' => 'Date and time this activity is scheduled to occur. Formerly named scheduled_date_time.',
307 'where' => 'civicrm_activity.activity_date_time',
308 'headerPattern' => '/(activity.)?date(.time$)?/i',
311 'table_name' => 'civicrm_activity',
312 'entity' => 'Activity',
313 'bao' => 'CRM_Activity_BAO_Activity',
316 'type' => 'Select Date',
317 'formatType' => 'activityDateTime',
320 'activity_duration' => array(
321 'name' => 'duration',
322 'type' => CRM_Utils_Type
::T_INT
,
323 'title' => ts('Duration') ,
324 'description' => 'Planned or actual duration of activity expressed in minutes. Conglomerate of former duration_hours and duration_minutes.',
326 'where' => 'civicrm_activity.duration',
327 'headerPattern' => '/(activity.)?duration(s)?$/i',
330 'table_name' => 'civicrm_activity',
331 'entity' => 'Activity',
332 'bao' => 'CRM_Activity_BAO_Activity',
338 'activity_location' => array(
339 'name' => 'location',
340 'type' => CRM_Utils_Type
::T_STRING
,
341 'title' => ts('Location') ,
342 'description' => 'Location of the activity (optional, open text).',
344 'size' => CRM_Utils_Type
::HUGE
,
346 'where' => 'civicrm_activity.location',
347 'headerPattern' => '/(activity.)?location$/i',
350 'table_name' => 'civicrm_activity',
351 'entity' => 'Activity',
352 'bao' => 'CRM_Activity_BAO_Activity',
359 'name' => 'phone_id',
360 'type' => CRM_Utils_Type
::T_INT
,
361 'title' => ts('Phone (called) ID') ,
362 'description' => 'Phone ID of the number called (optional - used if an existing phone number is selected).',
363 'table_name' => 'civicrm_activity',
364 'entity' => 'Activity',
365 'bao' => 'CRM_Activity_BAO_Activity',
367 'FKClassName' => 'CRM_Core_DAO_Phone',
369 'type' => 'EntityRef',
372 'phone_number' => array(
373 'name' => 'phone_number',
374 'type' => CRM_Utils_Type
::T_STRING
,
375 'title' => ts('Phone (called) Number') ,
376 'description' => 'Phone number in case the number does not exist in the civicrm_phone table.',
378 'size' => CRM_Utils_Type
::BIG
,
379 'table_name' => 'civicrm_activity',
380 'entity' => 'Activity',
381 'bao' => 'CRM_Activity_BAO_Activity',
387 'activity_details' => array(
389 'type' => CRM_Utils_Type
::T_LONGTEXT
,
390 'title' => ts('Details') ,
391 'description' => 'Details about the activity (agenda, notes, etc).',
393 'where' => 'civicrm_activity.details',
394 'headerPattern' => '/(activity.)?detail(s)?$/i',
397 'table_name' => 'civicrm_activity',
398 'entity' => 'Activity',
399 'bao' => 'CRM_Activity_BAO_Activity',
402 'type' => 'RichTextEditor',
405 'activity_status_id' => array(
406 'name' => 'status_id',
407 'type' => CRM_Utils_Type
::T_INT
,
408 'title' => ts('Activity Status') ,
409 'description' => 'ID of the status this activity is currently in. Foreign key to civicrm_option_value.',
411 'where' => 'civicrm_activity.status_id',
412 'headerPattern' => '/(activity.)?status(.label$)?/i',
415 'table_name' => 'civicrm_activity',
416 'entity' => 'Activity',
417 'bao' => 'CRM_Activity_BAO_Activity',
422 'pseudoconstant' => array(
423 'optionGroupName' => 'activity_status',
424 'optionEditPath' => 'civicrm/admin/options/activity_status',
427 'priority_id' => array(
428 'name' => 'priority_id',
429 'type' => CRM_Utils_Type
::T_INT
,
430 'title' => ts('Priority') ,
431 'description' => 'ID of the priority given to this activity. Foreign key to civicrm_option_value.',
432 'table_name' => 'civicrm_activity',
433 'entity' => 'Activity',
434 'bao' => 'CRM_Activity_BAO_Activity',
439 'pseudoconstant' => array(
440 'optionGroupName' => 'priority',
441 'optionEditPath' => 'civicrm/admin/options/priority',
444 'parent_id' => array(
445 'name' => 'parent_id',
446 'type' => CRM_Utils_Type
::T_INT
,
447 'title' => ts('Parent Activity Id') ,
448 'description' => 'Parent meeting ID (if this is a follow-up item). This is not currently implemented',
449 'table_name' => 'civicrm_activity',
450 'entity' => 'Activity',
451 'bao' => 'CRM_Activity_BAO_Activity',
453 'FKClassName' => 'CRM_Activity_DAO_Activity',
455 'activity_is_test' => array(
457 'type' => CRM_Utils_Type
::T_BOOLEAN
,
458 'title' => ts('Test') ,
460 'where' => 'civicrm_activity.is_test',
461 'headerPattern' => '/(is.)?test(.activity)?/i',
464 'table_name' => 'civicrm_activity',
465 'entity' => 'Activity',
466 'bao' => 'CRM_Activity_BAO_Activity',
472 'activity_medium_id' => array(
473 'name' => 'medium_id',
474 'type' => CRM_Utils_Type
::T_INT
,
475 'title' => ts('Activity Medium') ,
476 'description' => 'Activity Medium, Implicit FK to civicrm_option_value where option_group = encounter_medium.',
478 'table_name' => 'civicrm_activity',
479 'entity' => 'Activity',
480 'bao' => 'CRM_Activity_BAO_Activity',
485 'pseudoconstant' => array(
486 'optionGroupName' => 'encounter_medium',
487 'optionEditPath' => 'civicrm/admin/options/encounter_medium',
492 'type' => CRM_Utils_Type
::T_BOOLEAN
,
493 'title' => ts('Auto') ,
494 'table_name' => 'civicrm_activity',
495 'entity' => 'Activity',
496 'bao' => 'CRM_Activity_BAO_Activity',
499 'relationship_id' => array(
500 'name' => 'relationship_id',
501 'type' => CRM_Utils_Type
::T_INT
,
502 'title' => ts('Relationship Id') ,
503 'description' => 'FK to Relationship ID',
505 'table_name' => 'civicrm_activity',
506 'entity' => 'Activity',
507 'bao' => 'CRM_Activity_BAO_Activity',
509 'FKClassName' => 'CRM_Contact_DAO_Relationship',
511 'is_current_revision' => array(
512 'name' => 'is_current_revision',
513 'type' => CRM_Utils_Type
::T_BOOLEAN
,
514 'title' => ts('Is this activity a current revision in versioning chain?') ,
516 'where' => 'civicrm_activity.is_current_revision',
517 'headerPattern' => '/(is.)?(current.)?(revision|version(ing)?)/i',
521 'table_name' => 'civicrm_activity',
522 'entity' => 'Activity',
523 'bao' => 'CRM_Activity_BAO_Activity',
526 'type' => 'CheckBox',
529 'original_id' => array(
530 'name' => 'original_id',
531 'type' => CRM_Utils_Type
::T_INT
,
532 'title' => ts('Original Activity ID ') ,
533 'description' => 'Activity ID of the first activity record in versioning chain.',
534 'table_name' => 'civicrm_activity',
535 'entity' => 'Activity',
536 'bao' => 'CRM_Activity_BAO_Activity',
538 'FKClassName' => 'CRM_Activity_DAO_Activity',
540 'activity_result' => array(
542 'type' => CRM_Utils_Type
::T_STRING
,
543 'title' => ts('Result') ,
544 'description' => 'Currently being used to store result id for survey activity, FK to option value.',
546 'size' => CRM_Utils_Type
::HUGE
,
547 'table_name' => 'civicrm_activity',
548 'entity' => 'Activity',
549 'bao' => 'CRM_Activity_BAO_Activity',
555 'activity_is_deleted' => array(
556 'name' => 'is_deleted',
557 'type' => CRM_Utils_Type
::T_BOOLEAN
,
558 'title' => ts('Activity is in the Trash') ,
560 'where' => 'civicrm_activity.is_deleted',
561 'headerPattern' => '/(activity.)?(trash|deleted)/i',
564 'table_name' => 'civicrm_activity',
565 'entity' => 'Activity',
566 'bao' => 'CRM_Activity_BAO_Activity',
572 'activity_campaign_id' => array(
573 'name' => 'campaign_id',
574 'type' => CRM_Utils_Type
::T_INT
,
575 'title' => ts('Campaign') ,
576 'description' => 'The campaign for which this activity has been triggered.',
578 'where' => 'civicrm_activity.campaign_id',
579 'headerPattern' => '',
582 'table_name' => 'civicrm_activity',
583 'entity' => 'Activity',
584 'bao' => 'CRM_Activity_BAO_Activity',
586 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
588 'type' => 'CheckBox',
590 'pseudoconstant' => array(
591 'table' => 'civicrm_campaign',
593 'labelColumn' => 'title',
596 'activity_engagement_level' => array(
597 'name' => 'engagement_level',
598 'type' => CRM_Utils_Type
::T_INT
,
599 'title' => ts('Engagement Index') ,
600 'description' => 'Assign a specific level of engagement to this activity. Used for tracking constituents in ladder of engagement.',
602 'where' => 'civicrm_activity.engagement_level',
603 'headerPattern' => '',
606 'table_name' => 'civicrm_activity',
607 'entity' => 'Activity',
608 'bao' => 'CRM_Activity_BAO_Activity',
613 'pseudoconstant' => array(
614 'optionGroupName' => 'engagement_index',
615 'optionEditPath' => 'civicrm/admin/options/engagement_index',
620 'type' => CRM_Utils_Type
::T_INT
,
621 'title' => ts('Order') ,
622 'table_name' => 'civicrm_activity',
623 'entity' => 'Activity',
624 'bao' => 'CRM_Activity_BAO_Activity',
632 'type' => CRM_Utils_Type
::T_BOOLEAN
,
633 'title' => ts('Is Starred') ,
634 'description' => 'Activity marked as favorite.',
636 'where' => 'civicrm_activity.is_star',
637 'headerPattern' => '/(activity.)?(star|favorite)/i',
640 'table_name' => 'civicrm_activity',
641 'entity' => 'Activity',
642 'bao' => 'CRM_Activity_BAO_Activity',
646 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
648 return Civi
::$statics[__CLASS__
]['fields'];
651 * Return a mapping from field-name to the corresponding key (as used in fields()).
654 * Array(string $name => string $uniqueName).
656 static function &fieldKeys() {
657 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
658 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
660 return Civi
::$statics[__CLASS__
]['fieldKeys'];
663 * Returns the names of this table
667 static function getTableName() {
668 return self
::$_tableName;
671 * Returns if this table needs to be logged
679 * Returns the list of fields that can be imported
681 * @param bool $prefix
685 static function &import($prefix = false) {
686 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'activity', $prefix, array());
690 * Returns the list of fields that can be exported
692 * @param bool $prefix
696 static function &export($prefix = false) {
697 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'activity', $prefix, array());
701 * Returns the list of indices
703 public static function indices($localize = TRUE) {
705 'UI_source_record_id' => array(
706 'name' => 'UI_source_record_id',
708 0 => 'source_record_id',
710 'localizable' => false,
711 'sig' => 'civicrm_activity::0::source_record_id',
713 'UI_activity_type_id' => array(
714 'name' => 'UI_activity_type_id',
716 0 => 'activity_type_id',
718 'localizable' => false,
719 'sig' => 'civicrm_activity::0::activity_type_id',
721 'index_activity_date_time' => array(
722 'name' => 'index_activity_date_time',
724 0 => 'activity_date_time',
726 'localizable' => false,
727 'sig' => 'civicrm_activity::0::activity_date_time',
729 'index_status_id' => array(
730 'name' => 'index_status_id',
734 'localizable' => false,
735 'sig' => 'civicrm_activity::0::status_id',
737 'index_medium_id' => array(
738 'name' => 'index_medium_id',
742 'localizable' => false,
743 'sig' => 'civicrm_activity::0::medium_id',
745 'index_is_current_revision' => array(
746 'name' => 'index_is_current_revision',
748 0 => 'is_current_revision',
750 'localizable' => false,
751 'sig' => 'civicrm_activity::0::is_current_revision',
753 'index_is_deleted' => array(
754 'name' => 'index_is_deleted',
758 'localizable' => false,
759 'sig' => 'civicrm_activity::0::is_deleted',
762 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;