diff --git a/src/application/controllers/Appointments.php b/src/application/controllers/Appointments.php index d4419bbc..e41103cc 100755 --- a/src/application/controllers/Appointments.php +++ b/src/application/controllers/Appointments.php @@ -903,7 +903,7 @@ class Appointments extends CI_Controller { } else { - if ($appointment_start >= $period_start && $appointment_end <= $period_end) + if ($appointment_start >= $period_start && $appointment_end < $period_end) { // The appointment is inside the time period, so we will split the period into two new // others. @@ -919,6 +919,10 @@ class Appointments extends CI_Controller { 'end' => $appointment_end->format('H:i') ]; } + else if ($appointment_start == $period_start && $appointment_end == $period_end) + { + unset($periods[$index]); // The whole period is blocked so remove it from the available periods array. + } else { if ($appointment_start >= $period_start && $appointment_end >= $period_start && $appointment_start <= $period_end)