diff --git a/README.md b/README.md index 2bdc1df1..12c24e2a 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,22 @@ CiviHR employee portal custom Drupal modules ====================== -DEMO site available here: -http://178.79.132.53/welcome-page +CiviHR demo site is available at: + +http://demo.civihrhosting.co.uk/ + +For more information about CiviHR see: + +http://civihr.org/ + ====================== -Installation instructions - CiviHR 1.5 +Installation instructions - CiviHR 1.6+ ====================== -- Install the hr15 profile with civicrm_buildkit (https://github.com/civicrm/civicrm-buildkit) -- Example command to install CiviHR: civibuild create hr15 --civi-ver 4.5 --url http://localhost:8900 +- CiviHR is currently most easily installed by using CiviCRM Buildkit. Build kit can be downloaded from the following link: + +https://github.com/civicrm/civicrm-buildkit -Optionally: -- search for civihr_staff -> set absence entitlement for holidays, maternity etc -- put the leave approver for the civihr_staff, for example put leave approver as civihr_manager, after requesting a leave as staff, the civihr_manager will need to approve that leave. +- Install the hr16 profile with civicrm_buildkit +- Example command to install CiviHR: civibuild create hr16 --civi-ver 4.7 --url http://localhost:8900 diff --git a/civihr_employee_portal/civihr_employee_portal.module b/civihr_employee_portal/civihr_employee_portal.module index 89a09705..6fe14ce9 100755 --- a/civihr_employee_portal/civihr_employee_portal.module +++ b/civihr_employee_portal/civihr_employee_portal.module @@ -7431,3 +7431,29 @@ function civihr_employee_portal_html_head_alter(&$head_elements) { $head_elements[$default_favicon_element]['#attributes']['href'] = "{$base_url}/{$icoPath}"; } + +/** + * Return current version of Civihr. + */ +function get_civihr_version() { + $civihrVersion = &drupal_static(__FUNCTION__); + + if (!isset($civihrVersion)) { + if ($cache = cache_get('civihr_version')) { + $civihrVersion = $cache->data; + } else { + try { + // Civi init + civicrm_initialize(); + $result = civicrm_api3('HRCoreInfo', 'getversion', array('sequential' => 1)); + $civihrVersion = $result['values']; + } catch (CiviCRM_API3_Exception $e) { + $error = $e->getMessage(); + } + + cache_set('civihr_version', $civihrVersion, 'cache', time() + 86400); + } + } + + return $civihrVersion; +} diff --git a/civihr_employee_portal/css/custom.css b/civihr_employee_portal/css/custom.css index a689ae50..3280aa38 100644 --- a/civihr_employee_portal/css/custom.css +++ b/civihr_employee_portal/css/custom.css @@ -159,3 +159,27 @@ span.appraisals-employee-legend { vertical-align: middle; padding-left: 10px; } + +#footer { + height: 250px; + color: #727e8a; + padding-top: 85px; + font-size: 13px; + line-height: 2; +} + +#footer a { + color: #42afcb; +} + +#footer a:hover { + color: #42afcb; +} + +#footer a:visited { + color: #42afcb; +} + +.footer-logo { + margin-top: 25px; +} \ No newline at end of file diff --git a/civihr_employee_portal/features/civihr_employee_portal_features/civihr_employee_portal_features.pages_default.inc b/civihr_employee_portal/features/civihr_employee_portal_features/civihr_employee_portal_features.pages_default.inc index 58b0a4a6..bba31e8b 100755 --- a/civihr_employee_portal/features/civihr_employee_portal_features/civihr_employee_portal_features.pages_default.inc +++ b/civihr_employee_portal/features/civihr_employee_portal_features/civihr_employee_portal_features.pages_default.inc @@ -629,137 +629,176 @@ function civihr_employee_portal_features_default_page_manager_pages() { $display->cache = array(); $display->title = ''; $display->uuid = '65fa22bb-05c5-4318-b3eb-20181449dc7a'; + $display->storage_type = 'page_manager'; + $display->storage_id = 'page_welcome_page_panel_context'; $display->content = array(); $display->panels = array(); - $pane = new stdClass(); - $pane->pid = 'new-3f0db58e-4030-419c-add3-07e0e6e8c7e0'; - $pane->panel = 'column2'; - $pane->type = 'custom'; - $pane->subtype = 'custom'; - $pane->shown = TRUE; - $pane->access = array(); - $pane->configuration = array( - 'admin_title' => '', - 'title' => '', - 'body' => '
-
-
-
- -
-

CiviHR DEMO

-

Self Service Portal

-
-
-
', - 'format' => 'full_html', - 'substitute' => TRUE, - ); - $pane->cache = array(); - $pane->style = array( - 'settings' => NULL, - ); - $pane->css = array(); - $pane->extras = array(); - $pane->position = 0; - $pane->locks = array(); - $pane->uuid = '3f0db58e-4030-419c-add3-07e0e6e8c7e0'; - $display->content['new-3f0db58e-4030-419c-add3-07e0e6e8c7e0'] = $pane; - $display->panels['column2'][0] = 'new-3f0db58e-4030-419c-add3-07e0e6e8c7e0'; - $pane = new stdClass(); - $pane->pid = 'new-f122256d-6524-48e1-a630-60a24dfb412e'; - $pane->panel = 'column2'; - $pane->type = 'block'; - $pane->subtype = 'user-login'; - $pane->shown = TRUE; - $pane->access = array(); - $pane->configuration = array( - 'override_title' => 1, - 'override_title_text' => 'Login:', - 'override_title_heading' => 'h2', - ); - $pane->cache = array(); - $pane->style = array( - 'settings' => NULL, - ); - $pane->css = array(); - $pane->extras = array(); - $pane->position = 1; - $pane->locks = array(); - $pane->uuid = 'f122256d-6524-48e1-a630-60a24dfb412e'; - $display->content['new-f122256d-6524-48e1-a630-60a24dfb412e'] = $pane; - $display->panels['column2'][1] = 'new-f122256d-6524-48e1-a630-60a24dfb412e'; - $pane = new stdClass(); - $pane->pid = 'new-c1e74a5e-1513-4ae2-bd55-e097b00d3575'; - $pane->panel = 'column2'; - $pane->type = 'custom'; - $pane->subtype = 'custom'; - $pane->shown = TRUE; - $pane->access = array(); - $pane->configuration = array( - 'admin_title' => '', - 'title' => '', - 'body' => '

Don\'t have a login? - Click here to request one from your HR administrator

', - 'format' => 'full_html', - 'substitute' => TRUE, - ); - $pane->cache = array(); - $pane->style = array( - 'settings' => NULL, - ); - $pane->css = array(); - $pane->extras = array(); - $pane->position = 2; - $pane->locks = array(); - $pane->uuid = 'c1e74a5e-1513-4ae2-bd55-e097b00d3575'; - $display->content['new-c1e74a5e-1513-4ae2-bd55-e097b00d3575'] = $pane; - $display->panels['column2'][2] = 'new-c1e74a5e-1513-4ae2-bd55-e097b00d3575'; - $pane = new stdClass(); - $pane->pid = 'new-34a8c3b9-acb5-4419-ba57-7ebfc1f3e8f2'; - $pane->panel = 'header'; - $pane->type = 'node'; - $pane->subtype = 'node'; - $pane->shown = TRUE; - $pane->access = array( - 'plugins' => array( - 0 => array( - 'name' => 'role', - 'settings' => array( - 'rids' => array( - 0 => 30037204, - ), + $pane = new stdClass(); + $pane->pid = 'new-889a60ef-1b56-4330-85cf-d3c0f25fcc01'; + $pane->panel = 'column2'; + $pane->type = 'page_logo'; + $pane->subtype = 'page_logo'; + $pane->shown = TRUE; + $pane->access = array(); + $pane->configuration = array(); + $pane->cache = array(); + $pane->style = array( + 'settings' => NULL, + ); + $pane->css = array( + 'css_id' => 'block-welcome-logo', + 'css_class' => '', + ); + $pane->extras = array(); + $pane->position = 0; + $pane->locks = array(); + $pane->uuid = '889a60ef-1b56-4330-85cf-d3c0f25fcc01'; + $display->content['new-889a60ef-1b56-4330-85cf-d3c0f25fcc01'] = $pane; + $display->panels['column2'][0] = 'new-889a60ef-1b56-4330-85cf-d3c0f25fcc01'; + $pane = new stdClass(); + $pane->pid = 'new-3b43f2a1-c244-4018-adcc-ee092c4fa9d8'; + $pane->panel = 'column2'; + $pane->type = 'page_site_name'; + $pane->subtype = 'page_site_name'; + $pane->shown = TRUE; + $pane->access = array(); + $pane->configuration = array( + 'linked' => 0, + 'override_title' => 0, + 'override_title_text' => '', + 'override_title_heading' => 'h2', + ); + $pane->cache = array(); + $pane->style = array( + 'settings' => NULL, + ); + $pane->css = array( + 'css_id' => 'block-welcome-sitename', + 'css_class' => '', + ); + $pane->extras = array(); + $pane->position = 1; + $pane->locks = array(); + $pane->uuid = '3b43f2a1-c244-4018-adcc-ee092c4fa9d8'; + $display->content['new-3b43f2a1-c244-4018-adcc-ee092c4fa9d8'] = $pane; + $display->panels['column2'][1] = 'new-3b43f2a1-c244-4018-adcc-ee092c4fa9d8'; + $pane = new stdClass(); + $pane->pid = 'new-6f7f063d-ef96-4a44-8e20-921039687b30'; + $pane->panel = 'column2'; + $pane->type = 'page_slogan'; + $pane->subtype = 'page_slogan'; + $pane->shown = TRUE; + $pane->access = array(); + $pane->configuration = array(); + $pane->cache = array(); + $pane->style = array( + 'settings' => NULL, + ); + $pane->css = array( + 'css_id' => 'block-welcome-slogan', + 'css_class' => '', + ); + $pane->extras = array(); + $pane->position = 2; + $pane->locks = array(); + $pane->uuid = '6f7f063d-ef96-4a44-8e20-921039687b30'; + $display->content['new-6f7f063d-ef96-4a44-8e20-921039687b30'] = $pane; + $display->panels['column2'][2] = 'new-6f7f063d-ef96-4a44-8e20-921039687b30'; + $pane = new stdClass(); + $pane->pid = 'new-f122256d-6524-48e1-a630-60a24dfb412e'; + $pane->panel = 'column2'; + $pane->type = 'block'; + $pane->subtype = 'user-login'; + $pane->shown = TRUE; + $pane->access = array(); + $pane->configuration = array( + 'override_title' => 1, + 'override_title_text' => 'Login:', + 'override_title_heading' => 'h2', + ); + $pane->cache = array(); + $pane->style = array( + 'settings' => NULL, + ); + $pane->css = array(); + $pane->extras = array(); + $pane->position = 3; + $pane->locks = array(); + $pane->uuid = 'f122256d-6524-48e1-a630-60a24dfb412e'; + $display->content['new-f122256d-6524-48e1-a630-60a24dfb412e'] = $pane; + $display->panels['column2'][3] = 'new-f122256d-6524-48e1-a630-60a24dfb412e'; + $pane = new stdClass(); + $pane->pid = 'new-c1e74a5e-1513-4ae2-bd55-e097b00d3575'; + $pane->panel = 'column2'; + $pane->type = 'custom'; + $pane->subtype = 'custom'; + $pane->shown = TRUE; + $pane->access = array(); + $pane->configuration = array( + 'admin_title' => '', + 'title' => '', + 'body' => '

Don\'t have a login? + Click here to request one from your HR administrator

', + 'format' => 'full_html', + 'substitute' => TRUE, + ); + $pane->cache = array(); + $pane->style = array( + 'settings' => NULL, + ); + $pane->css = array(); + $pane->extras = array(); + $pane->position = 4; + $pane->locks = array(); + $pane->uuid = 'c1e74a5e-1513-4ae2-bd55-e097b00d3575'; + $display->content['new-c1e74a5e-1513-4ae2-bd55-e097b00d3575'] = $pane; + $display->panels['column2'][4] = 'new-c1e74a5e-1513-4ae2-bd55-e097b00d3575'; + $pane = new stdClass(); + $pane->pid = 'new-34a8c3b9-acb5-4419-ba57-7ebfc1f3e8f2'; + $pane->panel = 'header'; + $pane->type = 'node'; + $pane->subtype = 'node'; + $pane->shown = TRUE; + $pane->access = array( + 'plugins' => array( + 0 => array( + 'name' => 'role', + 'settings' => array( + 'rids' => array( + 0 => 30037204, ), - 'context' => 'logged-in-user', - 'not' => FALSE, ), + 'context' => 'logged-in-user', + 'not' => FALSE, ), - ); - $pane->configuration = array( - 'nid' => '1', - 'links' => 1, - 'leave_node_title' => 0, - 'identifier' => '', - 'build_mode' => 'full', - 'link_node_title' => 0, - 'override_title' => 1, - 'override_title_text' => '', - ); - $pane->cache = array(); - $pane->style = array( - 'settings' => NULL, - ); - $pane->css = array(); - $pane->extras = array(); - $pane->position = 0; - $pane->locks = array(); - $pane->uuid = '34a8c3b9-acb5-4419-ba57-7ebfc1f3e8f2'; - $display->content['new-34a8c3b9-acb5-4419-ba57-7ebfc1f3e8f2'] = $pane; - $display->panels['header'][0] = 'new-34a8c3b9-acb5-4419-ba57-7ebfc1f3e8f2'; + ), + ); + $pane->configuration = array( + 'nid' => '1', + 'links' => 1, + 'leave_node_title' => 0, + 'identifier' => '', + 'build_mode' => 'full', + 'link_node_title' => 0, + 'override_title' => 1, + 'override_title_text' => '', + ); + $pane->cache = array(); + $pane->style = array( + 'settings' => NULL, + ); + $pane->css = array(); + $pane->extras = array(); + $pane->position = 0; + $pane->locks = array(); + $pane->uuid = '34a8c3b9-acb5-4419-ba57-7ebfc1f3e8f2'; + $display->content['new-34a8c3b9-acb5-4419-ba57-7ebfc1f3e8f2'] = $pane; + $display->panels['header'][0] = 'new-34a8c3b9-acb5-4419-ba57-7ebfc1f3e8f2'; $display->hide_title = PANELS_TITLE_FIXED; $display->title_pane = '0'; $handler->conf['display'] = $display; $page->default_handlers[$handler->name] = $handler; + $pages['welcome_page'] = $page; return $pages; diff --git a/civihr_employee_portal/features/civihr_employee_portal_features/civihr_employee_portal_features.views_default.inc b/civihr_employee_portal/features/civihr_employee_portal_features/civihr_employee_portal_features.views_default.inc index 3e1b7821..e2adf99f 100644 --- a/civihr_employee_portal/features/civihr_employee_portal_features/civihr_employee_portal_features.views_default.inc +++ b/civihr_employee_portal/features/civihr_employee_portal_features/civihr_employee_portal_features.views_default.inc @@ -563,12 +563,12 @@ Type ID: [activity_type_id] '), $handler->display->display_options['fields']['end_reason']['table'] = 'hrjc_details'; $handler->display->display_options['fields']['end_reason']['field'] = 'end_reason'; $handler->display->display_options['fields']['end_reason']['relationship'] = 'details_revision_id'; - /* Field: HRJobContract Details entity: Location */ - $handler->display->display_options['fields']['location']['id'] = 'location'; - $handler->display->display_options['fields']['location']['table'] = 'hrjc_details'; - $handler->display->display_options['fields']['location']['field'] = 'location'; - $handler->display->display_options['fields']['location']['relationship'] = 'details_revision_id'; - $handler->display->display_options['fields']['location']['label'] = 'Contract Normal Place of Work'; + /* Field: HRJobContract Details entity: Location_label */ + $handler->display->display_options['fields']['location_label']['id'] = 'location_label'; + $handler->display->display_options['fields']['location_label']['table'] = 'hrjc_details'; + $handler->display->display_options['fields']['location_label']['field'] = 'location_label'; + $handler->display->display_options['fields']['location_label']['relationship'] = 'details_revision_id'; + $handler->display->display_options['fields']['location_label']['label'] = 'Contract Normal Place of Work'; /* Field: HRJobContract Hour entity: Contract location standard hours */ $handler->display->display_options['fields']['location_standard_hours']['id'] = 'location_standard_hours'; $handler->display->display_options['fields']['location_standard_hours']['table'] = 'hrjc_hour'; @@ -1562,12 +1562,12 @@ Type ID: [activity_type_id] '), $handler->display->display_options['fields']['end_reason']['table'] = 'hrjc_details'; $handler->display->display_options['fields']['end_reason']['field'] = 'end_reason'; $handler->display->display_options['fields']['end_reason']['relationship'] = 'details_revision_id'; - /* Field: HRJobContract Details entity: Location */ - $handler->display->display_options['fields']['location']['id'] = 'location'; - $handler->display->display_options['fields']['location']['table'] = 'hrjc_details'; - $handler->display->display_options['fields']['location']['field'] = 'location'; - $handler->display->display_options['fields']['location']['relationship'] = 'details_revision_id'; - $handler->display->display_options['fields']['location']['label'] = 'Contract Normal Place of Work'; + /* Field: HRJobContract Details entity: Location_label */ + $handler->display->display_options['fields']['location_label']['id'] = 'location_label'; + $handler->display->display_options['fields']['location_label']['table'] = 'hrjc_details'; + $handler->display->display_options['fields']['location_label']['field'] = 'location_label'; + $handler->display->display_options['fields']['location_label']['relationship'] = 'details_revision_id'; + $handler->display->display_options['fields']['location_label']['label'] = 'Contract Normal Place of Work'; /* Field: HRJobContract Hour entity: Contract location standard hours */ $handler->display->display_options['fields']['location_standard_hours']['id'] = 'location_standard_hours'; $handler->display->display_options['fields']['location_standard_hours']['table'] = 'hrjc_hour'; @@ -1822,44 +1822,6 @@ return date(\'Y-m-d\');'; $handler->display->display_options['arguments']['period_end_date']['summary_options']['items_per_page'] = '25'; $handler->display->display_options['arguments']['period_end_date']['civihr_range'] = '>='; $handler->display->display_options['arguments']['period_end_date']['civihr_range_empty'] = '1'; - /* Contextual filter: HRJobContract Role entity: Role start date */ - $handler->display->display_options['arguments']['role_start_date']['id'] = 'role_start_date'; - $handler->display->display_options['arguments']['role_start_date']['table'] = 'hrjc_role'; - $handler->display->display_options['arguments']['role_start_date']['field'] = 'role_start_date'; - $handler->display->display_options['arguments']['role_start_date']['relationship'] = 'role_jobcontract_id'; - $handler->display->display_options['arguments']['role_start_date']['default_action'] = 'default'; - $handler->display->display_options['arguments']['role_start_date']['default_argument_type'] = 'php'; - $handler->display->display_options['arguments']['role_start_date']['default_argument_options']['code'] = '$date_filter = !empty($_REQUEST[\'between_date_filter\']) ? $_REQUEST[\'between_date_filter\'] : null; -if (!empty($date_filter[\'value\'])) { - $expl = explode(\'/\', $date_filter[\'value\']); -if (count($expl) === 1) { return $date_filter[\'value\']; } - return $expl[2] . \'-\' . $expl[1] . \'-\' . $expl[0]; -} -return date(\'Y-m-d\');'; - $handler->display->display_options['arguments']['role_start_date']['summary']['number_of_records'] = '0'; - $handler->display->display_options['arguments']['role_start_date']['summary']['format'] = 'default_summary'; - $handler->display->display_options['arguments']['role_start_date']['summary_options']['items_per_page'] = '25'; - $handler->display->display_options['arguments']['role_start_date']['civihr_range'] = '<='; - $handler->display->display_options['arguments']['role_start_date']['civihr_range_empty'] = '0'; - /* Contextual filter: HRJobContract Role entity: Role end date */ - $handler->display->display_options['arguments']['role_end_date']['id'] = 'role_end_date'; - $handler->display->display_options['arguments']['role_end_date']['table'] = 'hrjc_role'; - $handler->display->display_options['arguments']['role_end_date']['field'] = 'role_end_date'; - $handler->display->display_options['arguments']['role_end_date']['relationship'] = 'role_jobcontract_id'; - $handler->display->display_options['arguments']['role_end_date']['default_action'] = 'default'; - $handler->display->display_options['arguments']['role_end_date']['default_argument_type'] = 'php'; - $handler->display->display_options['arguments']['role_end_date']['default_argument_options']['code'] = '$date_filter = !empty($_REQUEST[\'between_date_filter\']) ? $_REQUEST[\'between_date_filter\'] : null; -if (!empty($date_filter[\'value\'])) { - $expl = explode(\'/\', $date_filter[\'value\']); -if (count($expl) === 1) { return $date_filter[\'value\']; } - return $expl[2] . \'-\' . $expl[1] . \'-\' . $expl[0]; -} -return date(\'Y-m-d\');'; - $handler->display->display_options['arguments']['role_end_date']['summary']['number_of_records'] = '0'; - $handler->display->display_options['arguments']['role_end_date']['summary']['format'] = 'default_summary'; - $handler->display->display_options['arguments']['role_end_date']['summary_options']['items_per_page'] = '25'; - $handler->display->display_options['arguments']['role_end_date']['civihr_range'] = '>='; - $handler->display->display_options['arguments']['role_end_date']['civihr_range_empty'] = '1'; /* Filter criterion: CiviCRM Contacts: Is Deleted */ $handler->display->display_options['filters']['is_deleted']['id'] = 'is_deleted'; $handler->display->display_options['filters']['is_deleted']['table'] = 'civicrm_contact'; diff --git a/civihr_employee_portal/views/includes/civihr_employee_portal_handler_absence_table_header_block_area.inc b/civihr_employee_portal/views/includes/civihr_employee_portal_handler_absence_table_header_block_area.inc index 8afcf2b9..c5423116 100644 --- a/civihr_employee_portal/views/includes/civihr_employee_portal_handler_absence_table_header_block_area.inc +++ b/civihr_employee_portal/views/includes/civihr_employee_portal_handler_absence_table_header_block_area.inc @@ -98,7 +98,7 @@ class civihr_employee_portal_handler_absence_table_header_block_area extends vie $row['type_' . $typeId] = ''; } $row['type_' . $activityAbsenceTypeIds[$absence->absence_list_activity_type_id]] = ($absence->absence_list_is_credit ? '+ ' : '- ') . $amount; - $entitlements[$activityAbsenceTypeIds[$absence->absence_list_activity_type_id]] -= $amount; + $entitlements[$activityAbsenceTypeIds[$absence->absence_list_activity_type_id]] += ($absence->absence_list_is_credit ? $amount : -$amount); $rows[] = $row; } diff --git a/civihr_employee_portal/views/views_export/views_hr_staff_directory.inc b/civihr_employee_portal/views/views_export/views_hr_staff_directory.inc index 494cd28e..14f97e59 100755 --- a/civihr_employee_portal/views/views_export/views_hr_staff_directory.inc +++ b/civihr_employee_portal/views/views_export/views_hr_staff_directory.inc @@ -42,8 +42,8 @@ $handler->display->display_options['style_options']['columns'] = array( 'first_name' => 'first_name', 'last_name' => 'last_name', 'display_name' => 'display_name', - 'phone' => 'phone', - 'phone_ext' => 'phone_ext', + 'work_phone' => 'work_phone', + 'work_phone_ext' => 'work_phone_ext', 'title' => 'title', 'email_1' => 'email_1', 'location_label' => 'location_label', @@ -95,14 +95,14 @@ $handler->display->display_options['style_options']['info'] = array( 'separator' => '', 'empty_column' => 0, ), - 'phone' => array( + 'work_phone' => array( 'sortable' => 1, 'default_sort_order' => 'asc', 'align' => '', 'separator' => '', 'empty_column' => 0, ), - 'phone_ext' => array( + 'work_phone_ext' => array( 'sortable' => 1, 'default_sort_order' => 'asc', 'align' => '', @@ -252,6 +252,10 @@ $handler->display->display_options['relationships']['contact_id_b__1']['table'] $handler->display->display_options['relationships']['contact_id_b__1']['field'] = 'contact_id_b_'; $handler->display->display_options['relationships']['contact_id_b__1']['relationship'] = 'relationship_id_a_1'; $handler->display->display_options['relationships']['contact_id_b__1']['label'] = 'Unfiltered Managers'; +/* Relationship: CiviCRM Contacts: HRJobContract Contact Work/Home Phone and E-mail Entity */ +$handler->display->display_options['relationships']['hrjc_contact_details']['id'] = 'hrjc_contact_details'; +$handler->display->display_options['relationships']['hrjc_contact_details']['table'] = 'civicrm_contact'; +$handler->display->display_options['relationships']['hrjc_contact_details']['field'] = 'hrjc_contact_details'; /* Field: CiviCRM Contacts: Contact ID */ $handler->display->display_options['fields']['id']['id'] = 'id'; $handler->display->display_options['fields']['id']['table'] = 'civicrm_contact'; @@ -287,24 +291,18 @@ $handler->display->display_options['fields']['display_name']['exclude'] = TRUE; $handler->display->display_options['fields']['display_name']['alter']['alter_text'] = TRUE; $handler->display->display_options['fields']['display_name']['alter']['text'] = '[first_name] [last_name]'; $handler->display->display_options['fields']['display_name']['link_to_civicrm_contact'] = 0; -/* Field: CiviCRM Phone Details: Phone */ -$handler->display->display_options['fields']['phone']['id'] = 'phone'; -$handler->display->display_options['fields']['phone']['table'] = 'civicrm_phone'; -$handler->display->display_options['fields']['phone']['field'] = 'phone'; -$handler->display->display_options['fields']['phone']['label'] = 'Work Phone'; -$handler->display->display_options['fields']['phone']['location_type'] = '2'; -$handler->display->display_options['fields']['phone']['location_op'] = '0'; -$handler->display->display_options['fields']['phone']['is_primary'] = 0; -$handler->display->display_options['fields']['phone']['phone_type'] = '0'; -/* Field: CiviCRM Phone Details: Phone Number Extension */ -$handler->display->display_options['fields']['phone_ext']['id'] = 'phone_ext'; -$handler->display->display_options['fields']['phone_ext']['table'] = 'civicrm_phone'; -$handler->display->display_options['fields']['phone_ext']['field'] = 'phone_ext'; -$handler->display->display_options['fields']['phone_ext']['label'] = 'Work Phone Extension'; -$handler->display->display_options['fields']['phone_ext']['location_type'] = '2'; -$handler->display->display_options['fields']['phone_ext']['location_op'] = '0'; -$handler->display->display_options['fields']['phone_ext']['is_primary'] = 0; -$handler->display->display_options['fields']['phone_ext']['phone_type'] = '0'; +/* Field: HRJobContract Contact Work/Home Phone and E-mail Entity: Work_phone */ +$handler->display->display_options['fields']['work_phone']['id'] = 'work_phone'; +$handler->display->display_options['fields']['work_phone']['table'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['work_phone']['field'] = 'work_phone'; +$handler->display->display_options['fields']['work_phone']['relationship'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['work_phone']['label'] = 'Work Phone'; +/* Field: HRJobContract Contact Work/Home Phone and E-mail Entity: Work_phone_ext */ +$handler->display->display_options['fields']['work_phone_ext']['id'] = 'work_phone_ext'; +$handler->display->display_options['fields']['work_phone_ext']['table'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['work_phone_ext']['field'] = 'work_phone_ext'; +$handler->display->display_options['fields']['work_phone_ext']['relationship'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['work_phone_ext']['label'] = 'Work Phone Extension'; /* Field: HRJobContract Details entity: Title */ $handler->display->display_options['fields']['title']['id'] = 'title'; $handler->display->display_options['fields']['title']['table'] = 'hrjc_details'; @@ -456,32 +454,32 @@ $handler->display->display_options['filters']['title']['expose']['autocomplete_f $handler->display->display_options['filters']['title']['expose']['autocomplete_raw_suggestion'] = 1; $handler->display->display_options['filters']['title']['expose']['autocomplete_raw_dropdown'] = 1; $handler->display->display_options['filters']['title']['expose']['autocomplete_dependent'] = 0; -/* Filter criterion: CiviCRM Phone Details: Phone */ -$handler->display->display_options['filters']['phone']['id'] = 'phone'; -$handler->display->display_options['filters']['phone']['table'] = 'civicrm_phone'; -$handler->display->display_options['filters']['phone']['field'] = 'phone'; -$handler->display->display_options['filters']['phone']['operator'] = 'contains'; -$handler->display->display_options['filters']['phone']['group'] = 1; -$handler->display->display_options['filters']['phone']['exposed'] = TRUE; -$handler->display->display_options['filters']['phone']['expose']['operator_id'] = 'phone_op'; -$handler->display->display_options['filters']['phone']['expose']['label'] = 'Phone'; -$handler->display->display_options['filters']['phone']['expose']['operator'] = 'phone_op'; -$handler->display->display_options['filters']['phone']['expose']['identifier'] = 'phone'; -$handler->display->display_options['filters']['phone']['expose']['remember_roles'] = array( +/* Filter criterion: HRJobContract Contact Work/Home Phone and E-mail Entity: Work_phone */ +$handler->display->display_options['filters']['work_phone']['id'] = 'work_phone'; +$handler->display->display_options['filters']['work_phone']['table'] = 'hrjc_contact_details'; +$handler->display->display_options['filters']['work_phone']['field'] = 'work_phone'; +$handler->display->display_options['filters']['work_phone']['relationship'] = 'hrjc_contact_details'; +$handler->display->display_options['filters']['work_phone']['operator'] = 'contains'; +$handler->display->display_options['filters']['work_phone']['group'] = 1; +$handler->display->display_options['filters']['work_phone']['exposed'] = TRUE; +$handler->display->display_options['filters']['work_phone']['expose']['operator_id'] = 'work_phone_op'; +$handler->display->display_options['filters']['work_phone']['expose']['label'] = 'Work Phone'; +$handler->display->display_options['filters']['work_phone']['expose']['operator'] = 'work_phone_op'; +$handler->display->display_options['filters']['work_phone']['expose']['identifier'] = 'work_phone'; +$handler->display->display_options['filters']['work_phone']['expose']['remember_roles'] = array( 2 => '2', 1 => 0, 3 => 0, - 4 => 0, - 6 => 0, - 5 => 0, + 55120974 => 0, + 17087012 => 0, + 57573969 => 0, ); -$handler->display->display_options['filters']['phone']['expose']['autocomplete_filter'] = 1; -$handler->display->display_options['filters']['phone']['expose']['autocomplete_items'] = '10'; -$handler->display->display_options['filters']['phone']['expose']['autocomplete_min_chars'] = '0'; -$handler->display->display_options['filters']['phone']['expose']['autocomplete_field'] = 'phone'; -$handler->display->display_options['filters']['phone']['expose']['autocomplete_raw_suggestion'] = 1; -$handler->display->display_options['filters']['phone']['expose']['autocomplete_raw_dropdown'] = 1; -$handler->display->display_options['filters']['phone']['expose']['autocomplete_dependent'] = 0; +$handler->display->display_options['filters']['work_phone']['expose']['autocomplete_items'] = '10'; +$handler->display->display_options['filters']['work_phone']['expose']['autocomplete_min_chars'] = '0'; +$handler->display->display_options['filters']['work_phone']['expose']['autocomplete_field'] = 'work_phone'; +$handler->display->display_options['filters']['work_phone']['expose']['autocomplete_raw_suggestion'] = 1; +$handler->display->display_options['filters']['work_phone']['expose']['autocomplete_raw_dropdown'] = 1; +$handler->display->display_options['filters']['work_phone']['expose']['autocomplete_dependent'] = 0; /* Filter criterion: CiviCRM Email: Email Address */ $handler->display->display_options['filters']['email']['id'] = 'email'; $handler->display->display_options['filters']['email']['table'] = 'civicrm_email'; @@ -750,6 +748,7 @@ $translatables['civihr_staff_directory'] = array( t('CiviCRM Contact B'), t('Rel From A Unfiltered'), t('Unfiltered Managers'), + t('HRJobContract Contact Work/Home Phone and E-mail Entity'), t('Contact ID'), t('.'), t('Name'), @@ -768,7 +767,6 @@ $translatables['civihr_staff_directory'] = array( t('Broken handler hrjc_role.role_star_date'), t('Manager'), t('Managers'), - t('Phone'), t('Email'), t('Department'), t('Staff directory list page'), diff --git a/civihr_employee_portal/views/views_export/views_my_details_block.inc b/civihr_employee_portal/views/views_export/views_my_details_block.inc old mode 100644 new mode 100755 index e56b3287..13bd5c35 --- a/civihr_employee_portal/views/views_export/views_my_details_block.inc +++ b/civihr_employee_portal/views/views_export/views_my_details_block.inc @@ -89,6 +89,10 @@ $handler->display->display_options['relationships']['role_jobcontract_id']['id'] $handler->display->display_options['relationships']['role_jobcontract_id']['table'] = 'hrjc_revision'; $handler->display->display_options['relationships']['role_jobcontract_id']['field'] = 'role_jobcontract_id'; $handler->display->display_options['relationships']['role_jobcontract_id']['relationship'] = 'hrjc_revision'; +/* Relationship: CiviCRM Contacts: HRJobContract Contact Work/Home Phone and E-mail Entity */ +$handler->display->display_options['relationships']['hrjc_contact_details']['id'] = 'hrjc_contact_details'; +$handler->display->display_options['relationships']['hrjc_contact_details']['table'] = 'civicrm_contact'; +$handler->display->display_options['relationships']['hrjc_contact_details']['field'] = 'hrjc_contact_details'; $handler->display->display_options['defaults']['fields'] = FALSE; /* Field: CiviCRM Contacts: Contact ID */ $handler->display->display_options['fields']['id']['id'] = 'id'; @@ -102,40 +106,32 @@ $handler->display->display_options['fields']['display_name']['table'] = 'civicrm $handler->display->display_options['fields']['display_name']['field'] = 'display_name'; $handler->display->display_options['fields']['display_name']['label'] = 'Name'; $handler->display->display_options['fields']['display_name']['link_to_civicrm_contact'] = 0; -/* Field: CiviCRM Phone Details: Phone */ -$handler->display->display_options['fields']['phone']['id'] = 'phone'; -$handler->display->display_options['fields']['phone']['table'] = 'civicrm_phone'; -$handler->display->display_options['fields']['phone']['field'] = 'phone'; -$handler->display->display_options['fields']['phone']['label'] = 'Work Phone'; -$handler->display->display_options['fields']['phone']['exclude'] = TRUE; -$handler->display->display_options['fields']['phone']['location_type'] = '2'; -$handler->display->display_options['fields']['phone']['location_op'] = '0'; -$handler->display->display_options['fields']['phone']['is_primary'] = 0; -$handler->display->display_options['fields']['phone']['phone_type'] = '1'; -/* Field: CiviCRM Phone Details: Phone Number Extension */ -$handler->display->display_options['fields']['phone_ext']['id'] = 'phone_ext'; -$handler->display->display_options['fields']['phone_ext']['table'] = 'civicrm_phone'; -$handler->display->display_options['fields']['phone_ext']['field'] = 'phone_ext'; -$handler->display->display_options['fields']['phone_ext']['label'] = 'Work Phone Extension'; -$handler->display->display_options['fields']['phone_ext']['exclude'] = TRUE; -$handler->display->display_options['fields']['phone_ext']['location_type'] = '2'; -$handler->display->display_options['fields']['phone_ext']['location_op'] = '0'; -$handler->display->display_options['fields']['phone_ext']['is_primary'] = 0; -$handler->display->display_options['fields']['phone_ext']['phone_type'] = '1'; +/* Field: HRJobContract Contact Work/Home Phone and E-mail Entity: Work_phone */ +$handler->display->display_options['fields']['work_phone']['id'] = 'work_phone'; +$handler->display->display_options['fields']['work_phone']['table'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['work_phone']['field'] = 'work_phone'; +$handler->display->display_options['fields']['work_phone']['relationship'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['work_phone']['label'] = 'Work Phone'; +$handler->display->display_options['fields']['work_phone']['exclude'] = TRUE; +/* Field: HRJobContract Contact Work/Home Phone and E-mail Entity: Work_phone_ext */ +$handler->display->display_options['fields']['work_phone_ext']['id'] = 'work_phone_ext'; +$handler->display->display_options['fields']['work_phone_ext']['table'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['work_phone_ext']['field'] = 'work_phone_ext'; +$handler->display->display_options['fields']['work_phone_ext']['relationship'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['work_phone_ext']['label'] = 'Work Phone Extension'; +$handler->display->display_options['fields']['work_phone_ext']['exclude'] = TRUE; /* Field: Global: Custom text */ $handler->display->display_options['fields']['nothing']['id'] = 'nothing'; $handler->display->display_options['fields']['nothing']['table'] = 'views'; $handler->display->display_options['fields']['nothing']['field'] = 'nothing'; $handler->display->display_options['fields']['nothing']['label'] = 'Work Phone'; -$handler->display->display_options['fields']['nothing']['alter']['text'] = '[phone] ext. [phone_ext]'; -/* Field: CiviCRM Email: Email Address */ -$handler->display->display_options['fields']['email']['id'] = 'email'; -$handler->display->display_options['fields']['email']['table'] = 'civicrm_email'; -$handler->display->display_options['fields']['email']['field'] = 'email'; -$handler->display->display_options['fields']['email']['label'] = 'Work Email'; -$handler->display->display_options['fields']['email']['location_type'] = '2'; -$handler->display->display_options['fields']['email']['location_op'] = '0'; -$handler->display->display_options['fields']['email']['is_primary'] = 0; +$handler->display->display_options['fields']['nothing']['alter']['text'] = '[work_phone] ext. [work_phone_ext]'; +/* Field: HRJobContract Contact Work/Home Phone and E-mail Entity: Work_email */ +$handler->display->display_options['fields']['work_email']['id'] = 'work_email'; +$handler->display->display_options['fields']['work_email']['table'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['work_email']['field'] = 'work_email'; +$handler->display->display_options['fields']['work_email']['relationship'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['work_email']['label'] = 'Work E-mail'; /* Field: HRJobContract Details entity: Title */ $handler->display->display_options['fields']['title']['id'] = 'title'; $handler->display->display_options['fields']['title']['table'] = 'hrjc_details'; @@ -147,7 +143,6 @@ $handler->display->display_options['fields']['location']['id'] = 'location'; $handler->display->display_options['fields']['location']['table'] = 'hrjc_details'; $handler->display->display_options['fields']['location']['field'] = 'location'; $handler->display->display_options['fields']['location']['relationship'] = 'details_revision_id'; -$handler->display->display_options['fields']['location']['label'] = 'Location'; /* Field: HRJobContract Role entity: Role_title */ $handler->display->display_options['fields']['role_title']['id'] = 'role_title'; $handler->display->display_options['fields']['role_title']['table'] = 'hrjc_role'; @@ -221,25 +216,23 @@ $handler->display->display_options['defaults']['relationships'] = FALSE; $handler->display->display_options['relationships']['drupal_id']['id'] = 'drupal_id'; $handler->display->display_options['relationships']['drupal_id']['table'] = 'civicrm_contact'; $handler->display->display_options['relationships']['drupal_id']['field'] = 'drupal_id'; +/* Relationship: CiviCRM Contacts: HRJobContract Contact Work/Home Phone and E-mail Entity */ +$handler->display->display_options['relationships']['hrjc_contact_details']['id'] = 'hrjc_contact_details'; +$handler->display->display_options['relationships']['hrjc_contact_details']['table'] = 'civicrm_contact'; +$handler->display->display_options['relationships']['hrjc_contact_details']['field'] = 'hrjc_contact_details'; $handler->display->display_options['defaults']['fields'] = FALSE; -/* Field: CiviCRM Phone Details: Phone */ -$handler->display->display_options['fields']['phone']['id'] = 'phone'; -$handler->display->display_options['fields']['phone']['table'] = 'civicrm_phone'; -$handler->display->display_options['fields']['phone']['field'] = 'phone'; -$handler->display->display_options['fields']['phone']['relationship'] = 'drupal_id'; -$handler->display->display_options['fields']['phone']['label'] = 'Personal Phone'; -$handler->display->display_options['fields']['phone']['location_type'] = '1'; -$handler->display->display_options['fields']['phone']['location_op'] = '0'; -$handler->display->display_options['fields']['phone']['is_primary'] = 0; -$handler->display->display_options['fields']['phone']['phone_type'] = '1'; -/* Field: CiviCRM Email: Email Address */ -$handler->display->display_options['fields']['email']['id'] = 'email'; -$handler->display->display_options['fields']['email']['table'] = 'civicrm_email'; -$handler->display->display_options['fields']['email']['field'] = 'email'; -$handler->display->display_options['fields']['email']['label'] = 'Personal Email'; -$handler->display->display_options['fields']['email']['location_type'] = '1'; -$handler->display->display_options['fields']['email']['location_op'] = '0'; -$handler->display->display_options['fields']['email']['is_primary'] = 0; +/* Field: HRJobContract Contact Work/Home Phone and E-mail Entity: Home_phone */ +$handler->display->display_options['fields']['home_phone']['id'] = 'home_phone'; +$handler->display->display_options['fields']['home_phone']['table'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['home_phone']['field'] = 'home_phone'; +$handler->display->display_options['fields']['home_phone']['relationship'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['home_phone']['label'] = 'Personal Phone'; +/* Field: HRJobContract Contact Work/Home Phone and E-mail Entity: Home_email */ +$handler->display->display_options['fields']['home_email']['id'] = 'home_email'; +$handler->display->display_options['fields']['home_email']['table'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['home_email']['field'] = 'home_email'; +$handler->display->display_options['fields']['home_email']['relationship'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['home_email']['label'] = 'Personal E-mail'; /* Field: CiviCRM Address: Full Street Address */ $handler->display->display_options['fields']['street_address']['id'] = 'street_address'; $handler->display->display_options['fields']['street_address']['table'] = 'civicrm_address'; @@ -319,6 +312,10 @@ $handler->display->display_options['relationships']['role_jobcontract_id']['id'] $handler->display->display_options['relationships']['role_jobcontract_id']['table'] = 'hrjc_revision'; $handler->display->display_options['relationships']['role_jobcontract_id']['field'] = 'role_jobcontract_id'; $handler->display->display_options['relationships']['role_jobcontract_id']['relationship'] = 'hrjc_revision'; +/* Relationship: CiviCRM Contacts: HRJobContract Contact Work/Home Phone and E-mail Entity */ +$handler->display->display_options['relationships']['hrjc_contact_details']['id'] = 'hrjc_contact_details'; +$handler->display->display_options['relationships']['hrjc_contact_details']['table'] = 'civicrm_contact'; +$handler->display->display_options['relationships']['hrjc_contact_details']['field'] = 'hrjc_contact_details'; $handler->display->display_options['defaults']['fields'] = FALSE; /* Field: CiviCRM Contacts: Contact ID */ $handler->display->display_options['fields']['id']['id'] = 'id'; @@ -330,40 +327,32 @@ $handler->display->display_options['fields']['display_name']['table'] = 'civicrm $handler->display->display_options['fields']['display_name']['field'] = 'display_name'; $handler->display->display_options['fields']['display_name']['label'] = 'Display name'; $handler->display->display_options['fields']['display_name']['link_to_civicrm_contact'] = 0; -/* Field: CiviCRM Phone Details: Phone */ -$handler->display->display_options['fields']['phone']['id'] = 'phone'; -$handler->display->display_options['fields']['phone']['table'] = 'civicrm_phone'; -$handler->display->display_options['fields']['phone']['field'] = 'phone'; -$handler->display->display_options['fields']['phone']['label'] = 'Work phone'; -$handler->display->display_options['fields']['phone']['exclude'] = TRUE; -$handler->display->display_options['fields']['phone']['location_type'] = '2'; -$handler->display->display_options['fields']['phone']['location_op'] = '0'; -$handler->display->display_options['fields']['phone']['is_primary'] = 0; -$handler->display->display_options['fields']['phone']['phone_type'] = '1'; -/* Field: CiviCRM Phone Details: Phone Number Extension */ -$handler->display->display_options['fields']['phone_ext']['id'] = 'phone_ext'; -$handler->display->display_options['fields']['phone_ext']['table'] = 'civicrm_phone'; -$handler->display->display_options['fields']['phone_ext']['field'] = 'phone_ext'; -$handler->display->display_options['fields']['phone_ext']['label'] = 'Work Phone Extension'; -$handler->display->display_options['fields']['phone_ext']['exclude'] = TRUE; -$handler->display->display_options['fields']['phone_ext']['location_type'] = '2'; -$handler->display->display_options['fields']['phone_ext']['location_op'] = '0'; -$handler->display->display_options['fields']['phone_ext']['is_primary'] = 0; -$handler->display->display_options['fields']['phone_ext']['phone_type'] = '1'; +/* Field: HRJobContract Contact Work/Home Phone and E-mail Entity: Work_phone */ +$handler->display->display_options['fields']['work_phone']['id'] = 'work_phone'; +$handler->display->display_options['fields']['work_phone']['table'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['work_phone']['field'] = 'work_phone'; +$handler->display->display_options['fields']['work_phone']['relationship'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['work_phone']['label'] = 'Work Phone'; +$handler->display->display_options['fields']['work_phone']['exclude'] = TRUE; +/* Field: HRJobContract Contact Work/Home Phone and E-mail Entity: Work_phone_ext */ +$handler->display->display_options['fields']['work_phone_ext']['id'] = 'work_phone_ext'; +$handler->display->display_options['fields']['work_phone_ext']['table'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['work_phone_ext']['field'] = 'work_phone_ext'; +$handler->display->display_options['fields']['work_phone_ext']['relationship'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['work_phone_ext']['label'] = 'Work Phone Extension'; +$handler->display->display_options['fields']['work_phone_ext']['exclude'] = TRUE; /* Field: Global: Custom text */ $handler->display->display_options['fields']['nothing_1']['id'] = 'nothing_1'; $handler->display->display_options['fields']['nothing_1']['table'] = 'views'; $handler->display->display_options['fields']['nothing_1']['field'] = 'nothing'; $handler->display->display_options['fields']['nothing_1']['label'] = 'Work Phone'; -$handler->display->display_options['fields']['nothing_1']['alter']['text'] = '[phone] ext. [phone_ext]'; -/* Field: CiviCRM Email: Email Address */ -$handler->display->display_options['fields']['email']['id'] = 'email'; -$handler->display->display_options['fields']['email']['table'] = 'civicrm_email'; -$handler->display->display_options['fields']['email']['field'] = 'email'; -$handler->display->display_options['fields']['email']['label'] = 'Work Email'; -$handler->display->display_options['fields']['email']['location_type'] = '2'; -$handler->display->display_options['fields']['email']['location_op'] = '0'; -$handler->display->display_options['fields']['email']['is_primary'] = 0; +$handler->display->display_options['fields']['nothing_1']['alter']['text'] = '[work_phone] ext. [work_phone_ext]'; +/* Field: HRJobContract Contact Work/Home Phone and E-mail Entity: Work_email */ +$handler->display->display_options['fields']['work_email']['id'] = 'work_email'; +$handler->display->display_options['fields']['work_email']['table'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['work_email']['field'] = 'work_email'; +$handler->display->display_options['fields']['work_email']['relationship'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['work_email']['label'] = 'Work Email'; /* Field: CiviCRM Contacts: Birth Date */ $handler->display->display_options['fields']['birth_date']['id'] = 'birth_date'; $handler->display->display_options['fields']['birth_date']['table'] = 'civicrm_contact'; @@ -372,23 +361,18 @@ $handler->display->display_options['fields']['birth_date']['label'] = 'Date of b $handler->display->display_options['fields']['birth_date']['date_format'] = 'custom'; $handler->display->display_options['fields']['birth_date']['custom_date_format'] = 'd.m.Y'; $handler->display->display_options['fields']['birth_date']['second_date_format'] = 'long'; -/* Field: CiviCRM Phone Details: Phone */ -$handler->display->display_options['fields']['phone_1']['id'] = 'phone_1'; -$handler->display->display_options['fields']['phone_1']['table'] = 'civicrm_phone'; -$handler->display->display_options['fields']['phone_1']['field'] = 'phone'; -$handler->display->display_options['fields']['phone_1']['label'] = 'Personal Phone'; -$handler->display->display_options['fields']['phone_1']['location_type'] = '1'; -$handler->display->display_options['fields']['phone_1']['location_op'] = '0'; -$handler->display->display_options['fields']['phone_1']['is_primary'] = 0; -$handler->display->display_options['fields']['phone_1']['phone_type'] = '1'; -/* Field: CiviCRM Email: Email Address */ -$handler->display->display_options['fields']['email_1']['id'] = 'email_1'; -$handler->display->display_options['fields']['email_1']['table'] = 'civicrm_email'; -$handler->display->display_options['fields']['email_1']['field'] = 'email'; -$handler->display->display_options['fields']['email_1']['label'] = 'Personal Email'; -$handler->display->display_options['fields']['email_1']['location_type'] = '1'; -$handler->display->display_options['fields']['email_1']['location_op'] = '0'; -$handler->display->display_options['fields']['email_1']['is_primary'] = 0; +/* Field: HRJobContract Contact Work/Home Phone and E-mail Entity: Home_phone */ +$handler->display->display_options['fields']['home_phone']['id'] = 'home_phone'; +$handler->display->display_options['fields']['home_phone']['table'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['home_phone']['field'] = 'home_phone'; +$handler->display->display_options['fields']['home_phone']['relationship'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['home_phone']['label'] = 'Personal Phone'; +/* Field: HRJobContract Contact Work/Home Phone and E-mail Entity: Home_email */ +$handler->display->display_options['fields']['home_email']['id'] = 'home_email'; +$handler->display->display_options['fields']['home_email']['table'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['home_email']['field'] = 'home_email'; +$handler->display->display_options['fields']['home_email']['relationship'] = 'hrjc_contact_details'; +$handler->display->display_options['fields']['home_email']['label'] = 'Personal Email'; /* Field: CiviCRM Address: Full Street Address */ $handler->display->display_options['fields']['street_address']['id'] = 'street_address'; $handler->display->display_options['fields']['street_address']['table'] = 'civicrm_address'; @@ -546,11 +530,12 @@ $translatables['my_details_block'] = array( t('Emergency Contact'), t('My details'), t('HRJobContract Role entity'), + t('HRJobContract Contact Work/Home Phone and E-mail Entity'), t('Name'), t('Work Phone'), t('Work Phone Extension'), - t('[phone] ext. [phone_ext]'), - t('Work Email'), + t('[work_phone] ext. [work_phone_ext]'), + t('Work E-mail'), t('Designation'), t('Location'), t('Role title'), @@ -559,7 +544,7 @@ $translatables['my_details_block'] = array( t('My address'), t('My Address Block'), t('Personal Phone'), - t('Personal Email'), + t('Personal E-mail'), t('Address'), t('Address Line 2'), t('City / Suburb'), @@ -569,8 +554,9 @@ $translatables['my_details_block'] = array( t('My details (full)'), t('My Details'), t('Display name'), - t('Work phone'), + t('Work Email'), t('Date of birth'), + t('Personal Email'), t('Full Street Address'), t('Supplemental Street Address'), t('[street_address]
@@ -590,5 +576,3 @@ $translatables['my_details_block'] = array( t('Notes'), t('Dependant(s)'), ); - - diff --git a/civihr_hrjobcontract_entities/civihr_hrjobcontract_entities.module b/civihr_hrjobcontract_entities/civihr_hrjobcontract_entities.module index 9b446d08..e5ff7d1f 100755 --- a/civihr_hrjobcontract_entities/civihr_hrjobcontract_entities.module +++ b/civihr_hrjobcontract_entities/civihr_hrjobcontract_entities.module @@ -251,6 +251,43 @@ function civihr_hrjobcontract_entities_init() { WHERE c.deleted = 0 ORDER BY t.job_contract_id"); + + db_query('DROP VIEW IF EXISTS hrjc_contact_details'); + db_query("CREATE OR REPLACE VIEW hrjc_contact_details AS + SELECT c.id AS contact_id, + GROUP_CONCAT(DISTINCT CASE WHEN phone_location.name = 'Work' THEN c_phone.phone ELSE '' END + ORDER BY c_phone.phone DESC SEPARATOR ' ') AS work_phone, + GROUP_CONCAT(DISTINCT CASE WHEN phone_location.name = 'Work' THEN c_phone.phone_ext ELSE '' END + ORDER BY c_phone.phone_ext DESC SEPARATOR ' ') AS work_phone_ext, + GROUP_CONCAT(DISTINCT CASE WHEN email_location.name = 'Work' THEN c_email.email ELSE '' END + ORDER BY c_email.email DESC SEPARATOR ' ') AS work_email, + + GROUP_CONCAT(DISTINCT CASE WHEN phone_location.name = 'Home' THEN c_phone.phone ELSE '' END + ORDER BY c_phone.phone DESC SEPARATOR ' ') AS home_phone, + GROUP_CONCAT(DISTINCT CASE WHEN phone_location.name = 'Home' THEN c_phone.phone_ext ELSE '' END + ORDER BY c_phone.phone_ext DESC SEPARATOR ' ') AS home_phone_ext, + GROUP_CONCAT(DISTINCT CASE WHEN email_location.name = 'Home' THEN c_email.email ELSE '' END + ORDER BY c_email.email DESC SEPARATOR ' ') AS home_email + + FROM {$civi_db_name}.civicrm_contact c + LEFT JOIN {$civi_db_name}.civicrm_phone c_phone ON c_phone.contact_id = c.id + LEFT JOIN {$civi_db_name}.civicrm_location_type phone_location ON ( + c_phone.location_type_id = phone_location.id + AND (phone_location.name = 'Work' OR phone_location.name = 'Home') + ) + LEFT JOIN {$civi_db_name}.civicrm_email c_email ON c_email.contact_id = c.id + LEFT JOIN {$civi_db_name}.civicrm_location_type email_location ON ( + c_email.location_type_id = email_location.id + AND (email_location.name = 'Work' OR email_location.name = 'Home') + ) + + WHERE phone_location.name = 'Work' + OR email_location.name = 'Work' + OR phone_location.name = 'Home' + OR email_location.name = 'Home' + GROUP BY contact_id + "); + variable_set('rebuild_hrjobcontract_entities_view', 'FALSE'); } } @@ -259,7 +296,6 @@ function civihr_hrjobcontract_entities_init() { * Implements hook_schema_alter(). */ function civihr_hrjobcontract_entities_schema_alter(&$schema) { - // Revision: $schema['hrjc_revision']['description'] = 'Views data associated with Job Contract Revision'; $schema['hrjc_revision']['fields']['contact_id'] = array( @@ -893,6 +929,43 @@ function civihr_hrjobcontract_entities_schema_alter(&$schema) { ); $schema['hrjc_role']['primary key'] = array('jobcontract_id'); + // Phone Contact Details: hrjc_contact_details + $schema['hrjc_contact_details']['description'] = 'Views work/home phone and e-mail data associated with Contact'; + $schema['hrjc_contact_details']['fields']['contact_id'] = array( + 'type' => 'int', + 'not null' => TRUE, + 'description' => 'Contact ID.', + ); + $schema['hrjc_contact_details']['fields']['work_phone'] = array( + 'type' => 'varchar', + 'not null' => FALSE, + 'description' => 'Work phone number.', + ); + $schema['hrjc_contact_details']['fields']['work_phone_ext'] = array( + 'type' => 'varchar', + 'not null' => FALSE, + 'description' => 'Work phone extension.', + ); + $schema['hrjc_contact_details']['fields']['work_email'] = array( + 'type' => 'varchar', + 'not null' => FALSE, + 'description' => 'Work e-mail.', + ); + $schema['hrjc_contact_details']['fields']['home_phone'] = array( + 'type' => 'varchar', + 'not null' => FALSE, + 'description' => 'Home phone number.', + ); + $schema['hrjc_contact_details']['fields']['home_phone_ext'] = array( + 'type' => 'varchar', + 'not null' => FALSE, + 'description' => 'Home phone extension.', + ); + $schema['hrjc_contact_details']['fields']['home_email'] = array( + 'type' => 'varchar', + 'not null' => FALSE, + 'description' => 'Home e-mail.', + ); } /** @@ -1053,6 +1126,25 @@ function civihr_hrjobcontract_entities_entity_info() { 'module' => 'civicrm',// 'civihr_hrjobcontract_entities', ); + $info['hrjobcontract_contact_info'] = array( + 'label' => t('HRJobContract Contact Work/Home Phone and E-mail Entity'), + 'plural label' => t('HRJobContract Contact Work/Home Phone and E-mail Entity'), + 'description' => t('HRJobContract Contact Work/Home Phone and E-mail Entity.'), + 'entity class' => 'Entity', + 'controller class' => 'EntityAPIController', + 'views controller class' => 'EntityDefaultViewsController', + 'base table' => 'hrjc_contact_details', + 'fieldable' => TRUE, + 'entity keys' => array( + 'id' => 'id', + 'label' => 'Contact ID' + ), + 'bundles' => array(), + 'label callback' => 'entity_class_label', + 'uri callback' => 'entity_class_uri', + 'module' => 'civicrm', + ); + return $info; } @@ -1090,6 +1182,8 @@ function civihr_hrjobcontract_entities_entity_property_info_alter(&$info) { $info['civihr_absence_activity']['properties']['absence_contact_id']['type'] = 'civicrm_contact'; $info['civihr_length_of_service']['properties']['entity_id']['type'] = 'civicrm_contact'; + // Properties for phone + $info['hrjobcontract_contact_info']['properties']['contact_id']['type'] = 'civicrm_contact'; } /** @@ -1101,3 +1195,4 @@ function civihr_hrjobcontract_entities_views_api() { 'path' => drupal_get_path('module', 'civihr_hrjobcontract_entities') . '/views', ); } +