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/controllers/IndexController.php b/application/modules/timemanagement/controllers/IndexController.php index d32a3a068..4e35faa88 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 = $yrMon[0] - 1; + $startCalWeek = strftime('%U',strtotime($prevYear.'-12-31')); + $week = 1; + } } $empDoj = $usersModel->getEmployeeDoj($data->id); @@ -627,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(); @@ -1490,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, diff --git a/application/modules/timemanagement/models/Projects.php b/application/modules/timemanagement/models/Projects.php index d6f99cda8..58a8e0c19 100644 --- a/application/modules/timemanagement/models/Projects.php +++ b/application/modules/timemanagement/models/Projects.php @@ -583,8 +583,20 @@ 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($yr_mnth.'-01')); + + if($startCalWeek == "00") { + $year = date('Y',strtotime($hidendweek_date)); + $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) @@ -826,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) { 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;