parent
14bbd793bf
commit
af296cf147
1 changed files with 13 additions and 12 deletions
|
@ -402,18 +402,19 @@ class Appointments extends CI_Controller {
|
|||
// If the selected date is today, remove past hours. It is important include the timeout before
|
||||
// booking that is set in the back-office 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('Y-m-d', strtotime($this->input->post('selected_date'))) === date('Y-m-d'))
|
||||
{
|
||||
$book_advance_timeout = $this->settings_model->get_setting('book_advance_timeout');
|
||||
$selected_date = $this->input->post('selected_date');
|
||||
|
||||
foreach ($available_hours as $index => $value)
|
||||
$book_advance_timeout = $this->settings_model->get_setting('book_advance_timeout');
|
||||
|
||||
$threshold = new DateTime('+' . $book_advance_timeout . ' minutes');
|
||||
|
||||
foreach ($available_hours as $index => $value)
|
||||
{
|
||||
$available_hour = new DateTime($selected_date . ' ' . $value);
|
||||
|
||||
if ($available_hour->getTimestamp() <= $threshold->getTimestamp())
|
||||
{
|
||||
$available_hour = strtotime($value);
|
||||
$current_hour = strtotime('+' . $book_advance_timeout . ' minutes', strtotime('now'));
|
||||
if ($available_hour <= $current_hour)
|
||||
{
|
||||
unset($available_hours[$index]);
|
||||
}
|
||||
unset($available_hours[$index]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue