diff --git a/src/OpenSkedge/AppBundle/Controller/AvailabilityScheduleController.php b/src/OpenSkedge/AppBundle/Controller/AvailabilityScheduleController.php index 82e4db5..3ad0c79 100644 --- a/src/OpenSkedge/AppBundle/Controller/AvailabilityScheduleController.php +++ b/src/OpenSkedge/AppBundle/Controller/AvailabilityScheduleController.php @@ -104,6 +104,10 @@ public function viewAction(Request $request, $uid, $spid) $startIndex = $dtUtils->getIndexFromTime($appSettings->getStartHour()); $endIndex = $dtUtils->getIndexFromTime($appSettings->getEndHour())-1; + if ($endIndex === -1) { // Midnight end hour + $endIndex = 95; + } + $hoursAvailable = 0; for ($day = 0; $day < 7; $day++) { $timeRec = $entity->getDay($day); @@ -223,6 +227,10 @@ public function newAction(Request $request, $spid) $startIndex = $dtUtils->getIndexFromTime($appSettings->getStartHour()); $endIndex = $dtUtils->getIndexFromTime($appSettings->getEndHour())-1; + if ($endIndex === -1) { // Midnight end hour + $endIndex = 95; + } + return $this->render('OpenSkedgeBundle:AvailabilitySchedule:new.html.twig', array( 'avail' => $entity, 'htime' => $dtUtils->timeStrToDateTime($appSettings->getStartHour()), @@ -298,6 +306,10 @@ public function editAction(Request $request, $spid) $startIndex = $dtUtils->getIndexFromTime($appSettings->getStartHour()); $endIndex = $dtUtils->getIndexFromTime($appSettings->getEndHour())-1; + if ($endIndex === -1) { // Midnight end hour + $endIndex = 95; + } + $hoursAvailable = 0; for ($day = 0; $day < 7; $day++) { $timeRec = $entity->getDay($day); diff --git a/src/OpenSkedge/AppBundle/Controller/DashboardController.php b/src/OpenSkedge/AppBundle/Controller/DashboardController.php index fe8f751..78d179a 100644 --- a/src/OpenSkedge/AppBundle/Controller/DashboardController.php +++ b/src/OpenSkedge/AppBundle/Controller/DashboardController.php @@ -74,6 +74,10 @@ public function indexAction(Request $request) $startIndex = $dtUtils->getIndexFromTime($appSettings->getStartHour()); $endIndex = $dtUtils->getIndexFromTime($appSettings->getEndHour())-1; + if ($endIndex === -1) { // Midnight end hour + $endIndex = 95; + } + return $this->render('OpenSkedgeBundle:Dashboard:index.html.twig', array( 'htime' => $dtUtils->timeStrToDateTime($appSettings->getStartHour()), 'resolution' => $resolution, diff --git a/src/OpenSkedge/AppBundle/Controller/ScheduleController.php b/src/OpenSkedge/AppBundle/Controller/ScheduleController.php index af2d838..d756211 100644 --- a/src/OpenSkedge/AppBundle/Controller/ScheduleController.php +++ b/src/OpenSkedge/AppBundle/Controller/ScheduleController.php @@ -81,6 +81,10 @@ public function viewAction(Request $request, $pid, $spid) $startIndex = $dtUtils->getIndexFromTime($appSettings->getStartHour()); $endIndex = $dtUtils->getIndexFromTime($appSettings->getEndHour())-1; + if ($endIndex === -1) { // Midnight end hour + $endIndex = 95; + } + return $this->render('OpenSkedgeBundle:Schedule:view.html.twig', array( 'htime' => $dtUtils->timeStrToDateTime($appSettings->getStartHour()), 'resolution' => $resolution, @@ -271,6 +275,10 @@ public function editAction(Request $request, $pid, $spid) $startIndex = $dtUtils->getIndexFromTime($appSettings->getStartHour()); $endIndex = $dtUtils->getIndexFromTime($appSettings->getEndHour())-1; + if ($endIndex === -1) { // Midnight end hour + $endIndex = 95; + } + return $this->render('OpenSkedgeBundle:Schedule:edit.html.twig', array( 'htime' => $dtUtils->timeStrToDateTime($appSettings->getStartHour()), 'resolution' => $resolution, diff --git a/src/OpenSkedge/AppBundle/Services/StatsService.php b/src/OpenSkedge/AppBundle/Services/StatsService.php index 9179cac..c03ebaa 100644 --- a/src/OpenSkedge/AppBundle/Services/StatsService.php +++ b/src/OpenSkedge/AppBundle/Services/StatsService.php @@ -70,6 +70,10 @@ public function weekClockReport($uid, $week) foreach ($shifts as $shift) { $startIndex = $this->dtUtils->getIndexFromTime($shift->getStartTime()); $endIndex = $this->dtUtils->getIndexFromTime($shift->getEndTime()); + + if ($endIndex === -1) { // Midnight end hour + $endIndex = 96; + } // Update the schedule composite to mark shifts they had picked up. if ($shift->getStartTime()->format('w') === $shift->getEndTime()->format('w')) { $day = $shift->getStartTime()->format('w');