Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update civicrm.core.inc #382

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
169 changes: 169 additions & 0 deletions modules/views/components/civicrm.core.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1621,6 +1621,8 @@ function _civicrm_core_data(&$data, $enabled) {
'label' => t('Related Phone'),
),
);


// CIVICRM Activities are here with all the activeness they can muster, base tabling it up.
//----------------------------------------------------------------------------------------

Expand All @@ -1633,6 +1635,153 @@ function _civicrm_core_data(&$data, $enabled) {
'help' => t("View displays CiviCRM Activities"),
);

// CiviCRM Add support for attachments -civicrm_file Details of the file
$data['civicrm_file']['table']['group'] = t('CiviCRM Files');

$data['civicrm_file']['table']['base'] = array(
//
'field' => 'id',
'title' => t('CiviCRM Files'),
'help' => t("View displays CiviCRM Attachments"),
);

//Numeric File ID
$data['civicrm_file']['id'] = array(
'title' => t('File ID'),
'help' => t('The numeric ID of the Attachment'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
'numeric' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);

//URI
$data['civicrm_file']['uri'] = array(
'title' => t('URI'),
'help' => t('The URI of the Attachment'),
'field' => array(
'handler' => 'views_handler_field_file',
'click sortable' => TRUE,
),
);

//File Upload Date
$data['civicrm_file']['upload_date'] = array(
'title' => t('File Upload Date'),
'help' => t('The date the Attachment was uploaded'),
'field' => array(
'handler' => 'civicrm_handler_field_datetime',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'civicrm_handler_filter_datetime',
),
'sort' => array(
'handler' => 'civicrm_handler_sort_date',
),
);

//File Description
$data['civicrm_file']['description'] = array(
'title' => t('Description'),
'help' => t('The description of the Attachment'),
'field' => array(
'handler' => 'civicrm_handler_field',
'click sortable' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_string',
'numeric' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);

//File Mime Type
$data['civicrm_file']['mime_type'] = array(
'title' => t('Mime Type'),
'help' => t('The mime type of the Attachment'),
'field' => array(
'handler' => 'views_handler_field_file_filemime',
'click sortable' => TRUE,
),
);


// CiviCRM Add support for attachments - CiviCRM entity file table - what entity it is attached to
$data['civicrm_entity_file']['table']['group'] = t('CiviCRM Entity Files');

$data['civicrm_entity_file']['table']['base'] = array(
//
'field' => 'id',
'title' => t('CiviCRM Entity Files'),
'help' => t("View displays CiviCRM Attachments create link to download"),
);

//Numeric File ID
$data['civicrm_entity_file']['id'] = array(
'title' => t('Entity File ID'),
'help' => t('The numeric ID entity file record of the Attachment'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
'numeric' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);

//EntityTable
$data['civicrm_entity_file']['entity_table'] = array(
'title' => t('Entity Table'),
'help' => t('The content type associated with the attachment'),
'field' => array(
'handler' => 'civicrm_handler_field',
'click sortable' => TRUE,
),
);

//Entity ID
$data['civicrm_entity_file']['entity_id'] = array(
'title' => t('Entity ID'),
'help' => t('FK to the ID in entity_table'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
);

//File ID
$data['civicrm_entity_file']['file_id'] = array(
'title' => t('File ID'),
'help' => t('FK to the ID of the file in civicrm_file table'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
);

//TABLE JOINS FOR CIVICRM ACTIVITIES GO HERE!

//CiviCRM Activities - FIELDS
Expand Down Expand Up @@ -2123,6 +2272,26 @@ function _civicrm_core_data(&$data, $enabled) {
),
);

// Add joins for CiviCRM attachments
$data['civicrm_file']['table']['join']['civicrm_activity'] = array(
'left_table' => 'civicrm_entity_file',
'left_field' => 'file_id',
'field' => 'id',
);

$data['civicrm_entity_file']['table']['join']['civicrm_activity'] = array(
// Directly links to file table
'left_field' => 'id',
'field' => 'entity_id',
'extra' => array(
array(
'field' => 'entity_table',
'value' => 'civicrm_activity',
'numeric' => FALSE,
),
),
);

//----------------------------------------------------------------
// CIVICRM Relationships are here with all the connections, base tabling it up.
//----------------------------------------------------------------
Expand Down