Redirect clients which are tying to update an appointment during the book advance timeout to a warning page.

This commit is contained in:
Sébastien 2020-06-05 18:24:05 +02:00
parent 8704413c0f
commit 950738f2fe
4 changed files with 28 additions and 0 deletions

View file

@ -95,6 +95,7 @@ class Appointments extends CI_Controller {
$available_services = $this->services_model->get_available_services();
$available_providers = $this->providers_model->get_available_providers();
$company_name = $this->settings_model->get_setting('company_name');
$book_advance_timeout = $this->settings_model->get_setting('book_advance_timeout');
$date_format = $this->settings_model->get_setting('date_format');
$time_format = $this->settings_model->get_setting('time_format');
$first_weekday = $this->settings_model->get_setting('first_weekday');
@ -144,6 +145,27 @@ class Appointments extends CI_Controller {
return;
}
// If the requested apppointment begin date is lower than book_advance_timeout. Display
// a message to the customer.
$startDate = strtotime($results[0]['start_datetime']);
$limit = strtotime('+' . $book_advance_timeout . ' minutes', strtotime('now'));
if ($startDate < $limit)
{
$hours = floor($book_advance_timeout / 60);
$minutes = ($book_advance_timeout % 60);
$view = [
'message_title' => $this->lang->line('appointment_locked'),
'message_text' => strtr($this->lang->line('appointment_locked_message'), [
'{$limit}' => sprintf('%02d:%02d', $hours, $minutes)
]),
'message_icon' => base_url('assets/img/error.png')
];
$this->load->view('appointments/message', $view);
return;
}
$appointment = $results[0];
$provider = $this->providers_model->get_row($appointment['id_users_provider']);
$customer = $this->customers_model->get_row($appointment['id_users_customer']);

View file

@ -50,6 +50,8 @@ $lang['appointment_added_to_google_calendar'] = 'Your appointment has been added
$lang['view_appointment_in_google_calendar'] = 'Click here to view your appointment on Google Calendar.';
$lang['appointment_added_to_your_plan'] = 'A new appointment has been added to your plan.';
$lang['appointment_link_description'] = 'You can make changes by clicking the appointment link below.';
$lang['appointment_locked'] = 'Modification impossible!';
$lang['appointment_locked_message'] = 'The appointment cannot be changed less than {$limit} hours in advance.';
$lang['appointment_not_found'] = 'Appointment Not Found!';
$lang['appointment_does_not_exist_in_db'] = 'The appointment you requested does not exist in the system database anymore.';
$lang['display_calendar'] = 'Display Calendar';

View file

@ -50,6 +50,8 @@ $lang['appointment_added_to_google_calendar'] = 'Votre rendez-vous a été ajout
$lang['view_appointment_in_google_calendar'] = 'Cliquez ici pour voir votre rendez-vous dans le calendrier Google.';
$lang['appointment_added_to_your_plan'] = 'Un nouveau rendez-vous a été ajouté à votre planning.';
$lang['appointment_link_description'] = 'Vous pouvez faires des modifications en cliquant sur le lien suivant.';
$lang['appointment_locked'] = 'Modification impossible !';
$lang['appointment_locked_message'] = 'Le rendez-vous ne peut pas être modifié moins de {$limit} heures avant.';
$lang['appointment_not_found'] = 'Rendez-vous introuvable !';
$lang['appointment_does_not_exist_in_db'] = 'Le rendez-vous demandé n\'existe plus dans la base de données système.';
$lang['display_calendar'] = 'Afficher le calendrier.';

View file

@ -50,6 +50,8 @@ $lang['appointment_added_to_google_calendar'] = 'Ihr Termin ist zu Ihrem Google
$lang['view_appointment_in_google_calendar'] = 'Bitte klicken Sie hier, um Ihren Termin im Google Kalender zu sehen.';
$lang['appointment_added_to_your_plan'] = 'Ein neuer Termin ist zu Ihrer Planung hinzugefügt worden.';
$lang['appointment_link_description'] = 'Sie können Änderungen durch Klicken auf den Termin-Link durchführen.';
$lang['appointment_locked'] = 'Änderungen unmöglich!';
$lang['appointment_locked_message'] = 'Der Termin kann nicht weniger als {$limit} Stunden im Voraus geändert werden.';
$lang['appointment_not_found'] = 'Termin nicht gefunden!';
$lang['appointment_does_not_exist_in_db'] = 'Der von Ihnen angeforderte Termin existiert nicht in der Systemdatenbank.';
$lang['display_calendar'] = 'Kalender anzeigen';