From 1027bbc8f7930fc07380eab114cf10628670af82 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Sun, 31 Jan 2016 13:01:37 +0100 Subject: [PATCH] Fixes #116: the book timeout would not be taken into account in the available appointment hours calculation. --- src/application/controllers/appointments.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/application/controllers/appointments.php b/src/application/controllers/appointments.php index aee276f1..b976f29b 100755 --- a/src/application/controllers/appointments.php +++ b/src/application/controllers/appointments.php @@ -104,10 +104,10 @@ class Appointments extends CI_Controller { } else { // The customer is going to book a new appointment so there is no // need for the manage functionality to be initialized. - $manage_mode = FALSE; - $appointment = array(); - $provider = array(); - $customer = array(); + $manage_mode = FALSE; + $appointment = array(); + $provider = array(); + $customer = array(); } // Load the book appointment view. @@ -310,7 +310,7 @@ class Appointments extends CI_Controller { $_POST['selected_date'], $exclude_appointments); $available_hours = $this->calculate_available_hours($empty_periods, $_POST['selected_date'], - $_POST['service_duration'], (bool)$_POST['manage_mode']); + $_POST['service_duration'], filter_var($_POST['manage_mode'], FILTER_VALIDATE_BOOLEAN)); echo json_encode($available_hours); @@ -756,11 +756,7 @@ class Appointments extends CI_Controller { // booking that is set in the backoffice the system. Normally we might want the customer to book // an appointment that is at least half or one hour from now. The setting is stored in minutes. if (date('m/d/Y', strtotime($selected_date)) === date('m/d/Y')) { - if ($manage_mode) { - $book_advance_timeout = 0; - } else { - $book_advance_timeout = $this->settings_model->get_setting('book_advance_timeout'); - } + $book_advance_timeout = $this->settings_model->get_setting('book_advance_timeout'); foreach($available_hours as $index => $value) { $available_hour = strtotime($value);