From 34d95b7875f4d33015d58ade72b63ec4e25975a9 Mon Sep 17 00:00:00 2001 From: go-faustino Date: Sat, 6 Jan 2018 23:34:28 +0000 Subject: [PATCH 1/7] correct unable to edit first week of the year --- .../timemanagement/controllers/IndexController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/application/modules/timemanagement/controllers/IndexController.php b/application/modules/timemanagement/controllers/IndexController.php index d32a3a068..394c5715a 100644 --- a/application/modules/timemanagement/controllers/IndexController.php +++ b/application/modules/timemanagement/controllers/IndexController.php @@ -609,8 +609,14 @@ public function weekAction() if($timeFlag == 'time' && $selYrMon == $now->format('Y-m') && ($calWeek == '' || $calWeek == '0')) { $calWeek = strftime('%U',strtotime($selYrMon.'-'.$now->format('d'))); - $startCalWeek = strftime('%U',strtotime($selYrMon.'-01')); + $startCalWeek = strftime('%U',strtotime($selYrMon.'-01')); $week = ($calWeek- $startCalWeek) +1; + + if($startCalWeek == "00") { + $prevYear = $year - 1; + $startCalWeek = strftime('%U',strtotime($prevYear.'-12-31')); + $week = 1; + } } $empDoj = $usersModel->getEmployeeDoj($data->id); From e147d2b5496b121ae0758ab9e6b43c6d6338948f Mon Sep 17 00:00:00 2001 From: go-faustino Date: Sat, 6 Jan 2018 23:51:13 +0000 Subject: [PATCH 2/7] more calweek calculation corrections --- .../controllers/IndexController.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/application/modules/timemanagement/controllers/IndexController.php b/application/modules/timemanagement/controllers/IndexController.php index 394c5715a..866458ca4 100644 --- a/application/modules/timemanagement/controllers/IndexController.php +++ b/application/modules/timemanagement/controllers/IndexController.php @@ -633,9 +633,20 @@ public function weekAction() $calWeek = strftime('%U',strtotime($selYrMon.'-'.$selDay)); $startCalWeek = strftime('%U',strtotime($selYrMon.'-01')); $week = ($calWeek- $startCalWeek) +1; + + if($startCalWeek == "00") { + $prevYear = $year - 1; + $startCalWeek = strftime('%U',strtotime($prevYear.'-12-31')); + $week = 1; + } } else { if($calWeek == '' || $calWeek == '0') $calWeek = strftime('%U',strtotime($selYrMon.'-01')); + + if($calWeek == "00") { + $prevYear = $year - 1; + $calWeek = strftime('%U',strtotime($prevYear.'-12-31')); + } } // } $myTsModel = new Timemanagement_Model_MyTimesheet(); @@ -1496,6 +1507,13 @@ public function submitAction() { $calWeek = strftime('%U',strtotime($selYrMon.'-'.$selDay)); $startCalWeek = strftime('%U',strtotime($selYrMon.'-01')); $week = ($calWeek- $startCalWeek) +1; + + if($startCalWeek == "00") { + $prevYear = $year - 1; + $startCalWeek = strftime('%U',strtotime($prevYear.'-12-31')); + $week = 1; + } + $dayName = strtolower(date('D', strtotime($selYrMon.'-'.$selDay))); } $statusData = array('emp_id'=>$sessionData->id, From 004488da978d0ba73f6699fae1d205e3829b5963 Mon Sep 17 00:00:00 2001 From: go-faustino Date: Sun, 7 Jan 2018 00:58:19 +0000 Subject: [PATCH 3/7] notifications cal week corrections --- .gitignore | 1 + .../modules/timemanagement/models/Projects.php | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index a3f11672d..927d993f2 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ demos/ extras/documentation /*.bak logs/xdebug.log +logs/application.log .DS_Store diff --git a/application/modules/timemanagement/models/Projects.php b/application/modules/timemanagement/models/Projects.php index d6f99cda8..868299b27 100644 --- a/application/modules/timemanagement/models/Projects.php +++ b/application/modules/timemanagement/models/Projects.php @@ -583,8 +583,19 @@ public function prev_weeksubmit_status($prevweeks,$emp_id,$emp_details) $resultData = array(); $savedTimeSheets = array(); - $resultData = $notificationModel->getTimesheetStatus($emp_id,$hidendweek_date); - $savedTimeSheets = $notificationModel->getSavedTimesheets($emp_id,$hidendweek_date); + + $startCalWeek = strftime('%U',strtotime($selYrMon.'-01')); + + if($startCalWeek == "00") { + $prevYear = $year - 1; + $prev_year_hidendweek_date = $prevYear.'-12-31' + + $resultData = $notificationModel->getTimesheetStatus($emp_id,$prev_year_hidendweek_date); + $savedTimeSheets = $notificationModel->getSavedTimesheets($emp_id,$prev_year_hidendweek_date); + } else { + $resultData = $notificationModel->getTimesheetStatus($emp_id,$hidendweek_date); + $savedTimeSheets = $notificationModel->getSavedTimesheets($emp_id,$hidendweek_date); + } //End if(count($resultData)>0) From 057a57669b7d76a635c15992203253933e83b2bb Mon Sep 17 00:00:00 2001 From: go-faustino Date: Sun, 7 Jan 2018 01:04:37 +0000 Subject: [PATCH 4/7] calweek corrections --- .../modules/timemanagement/controllers/IndexController.php | 2 +- application/modules/timemanagement/models/Projects.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/application/modules/timemanagement/controllers/IndexController.php b/application/modules/timemanagement/controllers/IndexController.php index 866458ca4..4e35faa88 100644 --- a/application/modules/timemanagement/controllers/IndexController.php +++ b/application/modules/timemanagement/controllers/IndexController.php @@ -613,7 +613,7 @@ public function weekAction() $week = ($calWeek- $startCalWeek) +1; if($startCalWeek == "00") { - $prevYear = $year - 1; + $prevYear = $yrMon[0] - 1; $startCalWeek = strftime('%U',strtotime($prevYear.'-12-31')); $week = 1; } diff --git a/application/modules/timemanagement/models/Projects.php b/application/modules/timemanagement/models/Projects.php index 868299b27..528b99823 100644 --- a/application/modules/timemanagement/models/Projects.php +++ b/application/modules/timemanagement/models/Projects.php @@ -588,7 +588,7 @@ public function prev_weeksubmit_status($prevweeks,$emp_id,$emp_details) if($startCalWeek == "00") { $prevYear = $year - 1; - $prev_year_hidendweek_date = $prevYear.'-12-31' + $prev_year_hidendweek_date = $prevYear.'-12-31'; $resultData = $notificationModel->getTimesheetStatus($emp_id,$prev_year_hidendweek_date); $savedTimeSheets = $notificationModel->getSavedTimesheets($emp_id,$prev_year_hidendweek_date); From ad75387948b07a5b84a4c9acee4293a7a369e1c0 Mon Sep 17 00:00:00 2001 From: go-faustino Date: Sun, 7 Jan 2018 01:09:13 +0000 Subject: [PATCH 5/7] notifications cal week corrections --- application/modules/timemanagement/models/Projects.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/application/modules/timemanagement/models/Projects.php b/application/modules/timemanagement/models/Projects.php index 528b99823..918c868c9 100644 --- a/application/modules/timemanagement/models/Projects.php +++ b/application/modules/timemanagement/models/Projects.php @@ -584,9 +584,10 @@ public function prev_weeksubmit_status($prevweeks,$emp_id,$emp_details) $resultData = array(); $savedTimeSheets = array(); - $startCalWeek = strftime('%U',strtotime($selYrMon.'-01')); + $startCalWeek = strftime('%U',strtotime($yr_mnth.'-01')); if($startCalWeek == "00") { + $year = date('Y',strtotime($hidendweek_date)); $prevYear = $year - 1; $prev_year_hidendweek_date = $prevYear.'-12-31'; From 95cd49625f69998fb7a6b202f9c5140711b16f65 Mon Sep 17 00:00:00 2001 From: go-faustino Date: Sun, 7 Jan 2018 01:16:05 +0000 Subject: [PATCH 6/7] projects.php week cal corrections --- .../modules/timemanagement/models/Projects.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/application/modules/timemanagement/models/Projects.php b/application/modules/timemanagement/models/Projects.php index 918c868c9..58a8e0c19 100644 --- a/application/modules/timemanagement/models/Projects.php +++ b/application/modules/timemanagement/models/Projects.php @@ -838,8 +838,20 @@ public function getPreviousDaysTSStatus($prevweeks,$emp_id,$emp_details) $emp_dept_id = $emp_details['department_id']; $join_date=new DateTime($emp_details['date_of_joining']); $join_date=$join_date->format('Y-m-d'); - $resultData = $notificationModel->getpreviousTimesheetStatus($emp_id,$hidendweek_date,$mnth,$year); - $savedTimeSheets = $notificationModel->getpreviousSavedTimesheets($emp_id,$hidendweek_date,$mnth,$year); + + $startCalWeek = strftime('%U',strtotime($yr_mnth.'-01')); + + if($startCalWeek == "00") { + $prevYear = $year - 1; + $prev_year_hidendweek_date = $prevYear.'-12-31'; + + $resultData = $notificationModel->getpreviousTimesheetStatus($emp_id,$prev_year_hidendweek_date,$mnth,$year); + $savedTimeSheets = $notificationModel->getpreviousSavedTimesheets($emp_id,$prev_year_hidendweek_date,$mnth,$year); + } else { + $resultData = $notificationModel->getpreviousTimesheetStatus($emp_id,$hidendweek_date,$mnth,$year); + $savedTimeSheets = $notificationModel->getpreviousSavedTimesheets($emp_id,$hidendweek_date,$mnth,$year); + } + //End if(count($resultData)>0) { From 0293e94757dea3e69b157138fbba92f0757d1313 Mon Sep 17 00:00:00 2001 From: go-faustino Date: Sun, 7 Jan 2018 01:50:19 +0000 Subject: [PATCH 7/7] cronjob calweek corrections --- application/modules/timemanagement/models/Users.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/application/modules/timemanagement/models/Users.php b/application/modules/timemanagement/models/Users.php index d5a697477..93a5334ce 100644 --- a/application/modules/timemanagement/models/Users.php +++ b/application/modules/timemanagement/models/Users.php @@ -141,6 +141,12 @@ public function checkweekdaysdatacron($hidstartweek_date,$hidendweek_date,$hidem $calWeekVal = strftime('%U',strtotime($loopDate)); $dateYearVal = strftime('%Y',strtotime($loopDate)); + + if($calWeekVal == "00") { + $prevYear = $dateYearVal - 1; + $calWeekVal = strftime('%U',strtotime($prevYear.'-12-31')); + } + if(!in_array($calWeekVal,$cal_weekArray)){ $cal_weekArray[] = $calWeekVal; $yearCalWeekArray[$calWeekVal][] = $dateYearVal;