diff --git a/civihr_employee_portal/civihr_employee_portal.module b/civihr_employee_portal/civihr_employee_portal.module
index 5b3a04bc..772fcdbb 100644
--- a/civihr_employee_portal/civihr_employee_portal.module
+++ b/civihr_employee_portal/civihr_employee_portal.module
@@ -5356,5 +5356,8 @@ function _getManagerContacts($contact_id) {
* @return boolean
*/
function relationActiveAndCurrent($relation){
- return $relation['is_active'] == 1 && (strtotime($relation['end_date']) >= time() || empty($relation['end_date']));
+ $endDate = empty($relation['end_date']) ? NULL : $relation['end_date'] . " 23:59:59";
+
+ return $relation['is_active'] == 1 && (strtotime($endDate) >= time() || empty($endDate))
+ && (empty($relation['start_date']) || strtotime($relation['start_date']) <= time());
}
diff --git a/civihr_employee_portal/features/civihr_employee_portal_features/civihr_employee_portal_features.features.menu_custom.inc b/civihr_employee_portal/features/civihr_employee_portal_features/civihr_employee_portal_features.features.menu_custom.inc
new file mode 100644
index 00000000..e5e0db07
--- /dev/null
+++ b/civihr_employee_portal/features/civihr_employee_portal_features/civihr_employee_portal_features.features.menu_custom.inc
@@ -0,0 +1,26 @@
+ 'main-menu',
+ 'title' => 'Main menu',
+ 'description' => 'The Main menu is used on many sites to show the major sections of the site, often in a top navigation bar.',
+ );
+ // Translatables
+ // Included for use with string extractors like potx.
+ t('Main menu');
+ t('The Main menu is used on many sites to show the major sections of the site, often in a top navigation bar.');
+
+
+ return $menus;
+}
diff --git a/civihr_employee_portal/features/civihr_employee_portal_features/civihr_employee_portal_features.features.menu_links.inc b/civihr_employee_portal/features/civihr_employee_portal_features/civihr_employee_portal_features.features.menu_links.inc
new file mode 100644
index 00000000..7b77a8a4
--- /dev/null
+++ b/civihr_employee_portal/features/civihr_employee_portal_features/civihr_employee_portal_features.features.menu_links.inc
@@ -0,0 +1,39 @@
+ 'main-menu',
+ 'link_path' => 'dashboard',
+ 'router_path' => 'dashboard',
+ 'link_title' => 'Home',
+ 'options' => array(
+ 'attributes' => array(
+ 'title' => '',
+ ),
+ 'identifier' => 'main-menu_home:dashboard',
+ ),
+ 'module' => 'menu',
+ 'hidden' => 0,
+ 'external' => 0,
+ 'has_children' => 0,
+ 'expanded' => 0,
+ 'weight' => 0,
+ 'customized' => 1,
+ );
+ // Translatables
+ // Included for use with string extractors like potx.
+ t('Home');
+
+
+ return $menu_links;
+}
diff --git a/civihr_employee_portal/features/civihr_employee_portal_features/civihr_employee_portal_features.info b/civihr_employee_portal/features/civihr_employee_portal_features/civihr_employee_portal_features.info
index e33d4c40..f4975869 100644
--- a/civihr_employee_portal/features/civihr_employee_portal_features/civihr_employee_portal_features.info
+++ b/civihr_employee_portal/features/civihr_employee_portal_features/civihr_employee_portal_features.info
@@ -10,6 +10,7 @@ dependencies[] = download
dependencies[] = entity
dependencies[] = features
dependencies[] = file
+dependencies[] = menu
dependencies[] = mimemail
dependencies[] = mimemail_action
dependencies[] = mimemail_compress
@@ -37,6 +38,7 @@ features[field_instance][] = node-hr_documents-field_attachment
features[field_instance][] = node-hr_documents-field_download
features[field_instance][] = node-hr_documents-field_resource_type
features[field_instance][] = node-hr_documents-field_short_description
+features[menu_links][] = main-menu_home:dashboard
features[node][] = hr_documents
features[page_manager_pages][] = dashboard
features[page_manager_pages][] = welcome_page
@@ -148,3 +150,4 @@ features[variable][] = node_submitted_hr_documents
features[variable][] = node_submitted_webform
features[variable][] = site_frontpage
features_exclude[node][webform] = webform
+features_exclude[menu_custom][main-menu] = main-menu
diff --git a/civihr_employee_portal/src/Blocks/ManagerCalendar.php b/civihr_employee_portal/src/Blocks/ManagerCalendar.php
index aee2494d..5bf42780 100644
--- a/civihr_employee_portal/src/Blocks/ManagerCalendar.php
+++ b/civihr_employee_portal/src/Blocks/ManagerCalendar.php
@@ -18,12 +18,19 @@ public function generateBlock() {
$months_data = array();
$uid = $user->uid;
- $result = db_query('SELECT aal.employee_id, aal.id, aal.activity_type_id, aal.absence_title, aal.duration, aal.absence_start_date_timestamp, aal.absence_end_date_timestamp, absence_status
- FROM {absence_approval_list} aal');
+
+ $managerData = get_civihr_uf_match_data($uid);
+ $managerId = $managerData['contact_id'];
+
+ $result = db_query('SELECT aal.employee_id, aal.id, aal.activity_type_id, aal.absence_title, aal.duration, aal.absence_start_date_timestamp, aal.absence_end_date_timestamp, absence_status,
+ manager_id FROM {absence_approval_list} aal WHERE absence_status != :cancelled AND YEAR(absence_end_date) = YEAR(CURDATE())', array('cancelled' => 3));
// Result is returned as a iterable object that returns a stdClass object on each iteration
foreach ($result as $record) {
-
+ $managers = _getManagerContacts($record->employee_id);
+ if(!in_array($managerId, $managers)){
+ continue;
+ }
$check_start_month = intval(date('n', $record->absence_start_date_timestamp + 3600)); // 1-12
$check_end_month = intval(date('n', $record->absence_end_date_timestamp + 3600)); // 1-12
$check_start_day = intval(date('d', $record->absence_start_date_timestamp + 3600));
diff --git a/civihr_employee_portal/views/views_export/views_calendar_absence_list.inc b/civihr_employee_portal/views/views_export/views_calendar_absence_list.inc
index 280b4c1a..f3bd8205 100644
--- a/civihr_employee_portal/views/views_export/views_calendar_absence_list.inc
+++ b/civihr_employee_portal/views/views_export/views_calendar_absence_list.inc
@@ -95,13 +95,13 @@ $handler->display->display_options['row_options']['inline'] = array(
);
$handler->display->display_options['row_options']['colors']['legend'] = 'absence_type';
$handler->display->display_options['row_options']['colors']['calendar_colors_absence_type'] = array(
- 52 => '#E48282', // sick
- 53 => '#4D6C81', // vacation
- 54 => '#EBA782', // maternity
- 55 => '#91C68E', // paternity
- 57 => '#1606c3', // TOIL (CREDIT)
- 56 => '#977CA9', // TOIL
- 58 => '#C198AC', // Other
+ 52 => '#E48282',
+ 53 => '#4D6C81',
+ 54 => '#EBA782',
+ 55 => '#91C68E',
+ 57 => '#1606c3',
+ 56 => '#977CA9',
+ 58 => '#C198AC',
);
$handler->display->display_options['defaults']['row_options'] = FALSE;
$handler->display->display_options['defaults']['footer'] = FALSE;
@@ -177,6 +177,14 @@ $handler->display->display_options['arguments']['drupal_uid']['default_argument_
$handler->display->display_options['arguments']['drupal_uid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['drupal_uid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['drupal_uid']['summary_options']['items_per_page'] = '25';
+$handler->display->display_options['defaults']['filter_groups'] = FALSE;
+$handler->display->display_options['defaults']['filters'] = FALSE;
+/* Filter criterion: Absence entity: Absence status */
+$handler->display->display_options['filters']['absence_status']['id'] = 'absence_status';
+$handler->display->display_options['filters']['absence_status']['table'] = 'absence_list';
+$handler->display->display_options['filters']['absence_status']['field'] = 'absence_status';
+$handler->display->display_options['filters']['absence_status']['operator'] = '!=';
+$handler->display->display_options['filters']['absence_status']['value'] = '3';
$handler->display->display_options['path'] = 'calendar-absence-list';
$handler->display->display_options['menu']['type'] = 'default tab';
$handler->display->display_options['menu']['title'] = 'Month';