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:c9a4e687808af7624ecb22a5f328b3a4)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Activity_DAO_Activity
extends CRM_Core_DAO
{
39 * static instance to hold the table name
43 static $_tableName = 'civicrm_activity';
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
52 * Unique Other Activity ID
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.
62 public $source_record_id;
64 * FK to civicrm_option_value.id, that has to be valid, registered activity type.
68 public $activity_type_id;
70 * The subject/purpose/short description of the activity.
76 * Date and time this activity is scheduled to occur. Formerly named scheduled_date_time.
80 public $activity_date_time;
82 * Planned or actual duration of activity expressed in minutes. Conglomerate of former duration_hours and duration_minutes.
88 * Location of the activity (optional, open text).
94 * Phone ID of the number called (optional - used if an existing phone number is selected).
100 * Phone number in case the number does not exist in the civicrm_phone table.
104 public $phone_number;
106 * Details about the activity (agenda, notes, etc).
112 * ID of the status this activity is currently in. Foreign key to civicrm_option_value.
118 * ID of the priority given to this activity. Foreign key to civicrm_option_value.
124 * Parent meeting ID (if this is a follow-up item). This is not currently implemented
135 * Activity Medium, Implicit FK to civicrm_option_value where option_group = encounter_medium.
146 * FK to Relationship ID
150 public $relationship_id;
155 public $is_current_revision;
157 * Activity ID of the first activity record in versioning chain.
163 * Currently being used to store result id for survey activity, FK to option value.
174 * The campaign for which this activity has been triggered.
180 * Assign a specific level of engagement to this activity. Used for tracking constituents in ladder of engagement.
184 public $engagement_level;
193 * @return civicrm_activity
195 function __construct() {
196 $this->__table
= 'civicrm_activity';
197 parent
::__construct();
200 * Returns foreign keys and entity references
203 * [CRM_Core_Reference_Interface]
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']);
215 return Civi
::$statics[__CLASS__
]['links'];
218 * Returns all the column names of this table
222 static function &fields() {
223 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
224 Civi
::$statics[__CLASS__
]['fields'] = array(
225 'activity_id' => array(
227 'type' => CRM_Utils_Type
::T_INT
,
228 'title' => ts('Activity ID') ,
229 'description' => 'Unique Other Activity ID',
232 'where' => 'civicrm_activity.id',
233 'headerPattern' => '',
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.',
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.',
250 'where' => 'civicrm_activity.activity_type_id',
251 'headerPattern' => '/(activity.)?type(.id$)/i',
258 'pseudoconstant' => array(
259 'optionGroupName' => 'activity_type',
260 'optionEditPath' => 'civicrm/admin/options/activity_type',
263 'activity_subject' => array(
265 'type' => CRM_Utils_Type
::T_STRING
,
266 'title' => ts('Subject') ,
267 'description' => 'The subject/purpose/short description of the activity.',
269 'size' => CRM_Utils_Type
::HUGE
,
271 'where' => 'civicrm_activity.subject',
272 'headerPattern' => '/(activity.)?subject/i',
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.',
285 'where' => 'civicrm_activity.activity_date_time',
286 'headerPattern' => '/(activity.)?date(.time$)?/i',
290 'type' => 'Select Date',
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.',
299 'where' => 'civicrm_activity.duration',
300 'headerPattern' => '/(activity.)?duration(s)?$/i',
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).',
313 'size' => CRM_Utils_Type
::HUGE
,
315 'where' => 'civicrm_activity.location',
316 'headerPattern' => '/(activity.)?location$/i',
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',
330 'type' => 'EntityRef',
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.',
339 'size' => CRM_Utils_Type
::BIG
,
344 'activity_details' => array(
346 'type' => CRM_Utils_Type
::T_LONGTEXT
,
347 'title' => ts('Details') ,
348 'description' => 'Details about the activity (agenda, notes, etc).',
350 'where' => 'civicrm_activity.details',
351 'headerPattern' => '/(activity.)?detail(s)?$/i',
355 'type' => 'RichTextEditor',
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.',
364 'where' => 'civicrm_activity.status_id',
365 'headerPattern' => '/(activity.)?status(.label$)?/i',
371 'pseudoconstant' => array(
372 'optionGroupName' => 'activity_status',
373 'optionEditPath' => 'civicrm/admin/options/activity_status',
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.',
384 'pseudoconstant' => array(
385 'optionGroupName' => 'priority',
386 'optionEditPath' => 'civicrm/admin/options/priority',
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',
396 'activity_is_test' => array(
398 'type' => CRM_Utils_Type
::T_BOOLEAN
,
399 'title' => ts('Test') ,
401 'where' => 'civicrm_activity.is_test',
402 'headerPattern' => '/(is.)?test(.activity)?/i',
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.',
418 'pseudoconstant' => array(
419 'optionGroupName' => 'encounter_medium',
420 'optionEditPath' => 'civicrm/admin/options/encounter_medium',
425 'type' => CRM_Utils_Type
::T_BOOLEAN
,
426 'title' => ts('Auto') ,
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',
434 'FKClassName' => 'CRM_Contact_DAO_Relationship',
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?') ,
441 'where' => 'civicrm_activity.is_current_revision',
442 'headerPattern' => '/(is.)?(current.)?(revision|version(ing)?)/i',
447 'type' => 'CheckBox',
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',
457 'activity_result' => array(
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.',
463 'size' => CRM_Utils_Type
::HUGE
,
468 'activity_is_deleted' => array(
469 'name' => 'is_deleted',
470 'type' => CRM_Utils_Type
::T_BOOLEAN
,
471 'title' => ts('Activity is in the Trash') ,
473 'where' => 'civicrm_activity.is_deleted',
474 'headerPattern' => '/(activity.)?(trash|deleted)/i',
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.',
487 'where' => 'civicrm_activity.campaign_id',
488 'headerPattern' => '',
491 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
493 'type' => 'CheckBox',
495 'pseudoconstant' => array(
496 'table' => 'civicrm_campaign',
498 'labelColumn' => 'title',
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.',
507 'where' => 'civicrm_activity.engagement_level',
508 'headerPattern' => '',
514 'pseudoconstant' => array(
515 'optionGroupName' => 'engagement_index',
516 'optionEditPath' => 'civicrm/admin/options/engagement_index',
521 'type' => CRM_Utils_Type
::T_INT
,
522 'title' => ts('Order') ,
528 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
530 return Civi
::$statics[__CLASS__
]['fields'];
533 * Return a mapping from field-name to the corresponding key (as used in fields()).
536 * Array(string $name => string $uniqueName).
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()));
542 return Civi
::$statics[__CLASS__
]['fieldKeys'];
545 * Returns the names of this table
549 static function getTableName() {
550 return self
::$_tableName;
553 * Returns if this table needs to be logged
561 * Returns the list of fields that can be imported
563 * @param bool $prefix
567 static function &import($prefix = false) {
568 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'activity', $prefix, array());
572 * Returns the list of fields that can be exported
574 * @param bool $prefix
578 static function &export($prefix = false) {
579 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'activity', $prefix, array());