From 7ab65252ec3d6c3efcbebaaf3b1f5004df723a62 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 26 Jan 2016 15:19:39 +0530 Subject: [PATCH 1/7] PCHR-817: Removed cancelled leaves from Manager Absence Approval block --- civihr_employee_portal/src/Blocks/ManagerCalendar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/civihr_employee_portal/src/Blocks/ManagerCalendar.php b/civihr_employee_portal/src/Blocks/ManagerCalendar.php index aee2494d..a83ac46f 100644 --- a/civihr_employee_portal/src/Blocks/ManagerCalendar.php +++ b/civihr_employee_portal/src/Blocks/ManagerCalendar.php @@ -19,7 +19,7 @@ public function generateBlock() { $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'); + FROM {absence_approval_list} aal WHERE absence_status != :cancelled', array('cancelled' => 3)); // Result is returned as a iterable object that returns a stdClass object on each iteration foreach ($result as $record) { From 1fdf4841aa23da2a1c8be1394ce8673d8eb9a05d Mon Sep 17 00:00:00 2001 From: root Date: Tue, 26 Jan 2016 15:49:06 +0530 Subject: [PATCH 2/7] PCHR-817: Removed cancelled leaves from My Leave block --- .../views_calendar_absence_list.inc | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) 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'; From 1aac8589e10f53a307813b9ca49c676db1bbeafc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20=C5=81uczkiewicz?= Date: Tue, 26 Jan 2016 12:23:13 +0000 Subject: [PATCH 3/7] PCHR-343: Changed "home" link on SSP to point to dashboard --- ...e_portal_features.features.menu_custom.inc | 26 +++++++++++++ ...ee_portal_features.features.menu_links.inc | 39 +++++++++++++++++++ .../civihr_employee_portal_features.info | 3 ++ 3 files changed, 68 insertions(+) create mode 100644 civihr_employee_portal/features/civihr_employee_portal_features/civihr_employee_portal_features.features.menu_custom.inc create mode 100644 civihr_employee_portal/features/civihr_employee_portal_features/civihr_employee_portal_features.features.menu_links.inc 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 From bbf315fdc56aa8586dad6453632555a15ee1248d Mon Sep 17 00:00:00 2001 From: root Date: Fri, 5 Feb 2016 13:18:16 +0530 Subject: [PATCH 4/7] PCHR-818: Fetch absences only for current year --- civihr_employee_portal/src/Blocks/ManagerCalendar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/civihr_employee_portal/src/Blocks/ManagerCalendar.php b/civihr_employee_portal/src/Blocks/ManagerCalendar.php index a83ac46f..e813a1ff 100644 --- a/civihr_employee_portal/src/Blocks/ManagerCalendar.php +++ b/civihr_employee_portal/src/Blocks/ManagerCalendar.php @@ -19,7 +19,7 @@ public function generateBlock() { $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 WHERE absence_status != :cancelled', array('cancelled' => 3)); + 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) { From 4280a848ff7b52b60a1c4a171f0f45a4f8975b1d Mon Sep 17 00:00:00 2001 From: root Date: Mon, 8 Feb 2016 15:41:04 +0530 Subject: [PATCH 5/7] PCHR-830: Donot show leave requests for future manager --- civihr_employee_portal/civihr_employee_portal.module | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/civihr_employee_portal/civihr_employee_portal.module b/civihr_employee_portal/civihr_employee_portal.module index 5b3a04bc..01e5b0d6 100644 --- a/civihr_employee_portal/civihr_employee_portal.module +++ b/civihr_employee_portal/civihr_employee_portal.module @@ -5356,5 +5356,6 @@ function _getManagerContacts($contact_id) { * @return boolean */ function relationActiveAndCurrent($relation){ - return $relation['is_active'] == 1 && (strtotime($relation['end_date']) >= time() || empty($relation['end_date'])); + return $relation['is_active'] == 1 && (strtotime($relation['end_date']) >= time() || empty($relation['end_date'])) + && (empty($relation['start_date']) || strtotime($relation['start_date']) <= time()); } From 6077fbe4d8ff9aa8d8e56b1f3a1589d92926d718 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 9 Feb 2016 13:36:45 +0530 Subject: [PATCH 6/7] PCHR-831: Show leave requests in current managers calendar only --- .../civihr_employee_portal.module | 4 +++- .../src/Blocks/ManagerCalendar.php | 13 ++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/civihr_employee_portal/civihr_employee_portal.module b/civihr_employee_portal/civihr_employee_portal.module index 01e5b0d6..86f03550 100644 --- a/civihr_employee_portal/civihr_employee_portal.module +++ b/civihr_employee_portal/civihr_employee_portal.module @@ -5356,6 +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']) ? $relation['end_date'] : $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/src/Blocks/ManagerCalendar.php b/civihr_employee_portal/src/Blocks/ManagerCalendar.php index e813a1ff..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 WHERE absence_status != :cancelled AND YEAR(absence_end_date) = YEAR(CURDATE())', array('cancelled' => 3)); + + $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)); From e684493341a68767dafca80c6dfdb90d59babf84 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 9 Feb 2016 13:47:31 +0530 Subject: [PATCH 7/7] PCHR-831: Use of NULL for better readability --- civihr_employee_portal/civihr_employee_portal.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/civihr_employee_portal/civihr_employee_portal.module b/civihr_employee_portal/civihr_employee_portal.module index 86f03550..772fcdbb 100644 --- a/civihr_employee_portal/civihr_employee_portal.module +++ b/civihr_employee_portal/civihr_employee_portal.module @@ -5356,7 +5356,7 @@ function _getManagerContacts($contact_id) { * @return boolean */ function relationActiveAndCurrent($relation){ - $endDate = empty($relation['end_date']) ? $relation['end_date'] : $relation['end_date'] . " 23:59:59"; + $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());