diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f532805..3e50ecc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ This file contains the code changes that were introduced into each release (starting from v1.1.0) so that is easy for developers to maintain and readjust their custom modifications on the main project codebase. +### Version 1.1.1 +- Issue #116: Book advance timeout not taken into account for proposed appointments. +- Issue #118: Google Calendar and notification mail problem bug. +- Issue #120: Invalid appointment date set after editing an existing appointment. + ### Version 1.1.0 - Issue #4: Raising more useful exceptions and enable error logging by default. - Issue #6: Business Logic created is not getting assigned to service provider. diff --git a/src/application/config/config.php b/src/application/config/config.php index 10d9c160..25b3fa44 100644 --- a/src/application/config/config.php +++ b/src/application/config/config.php @@ -9,7 +9,7 @@ | the global "config" variable. | */ -$config['ea_version'] = '1.1.0'; // This must be changed manually. +$config['ea_version'] = '1.1.1'; // This must be changed manually. $config['ea_release_title'] = ''; // Leave empty for no title or add BETA, TEST etc ... $config['ea_google_sync_feature'] = Config::GOOGLE_SYNC_FEATURE; diff --git a/src/application/controllers/appointments.php b/src/application/controllers/appointments.php index aee276f1..717c941a 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. @@ -174,7 +174,8 @@ class Appointments extends CI_Controller { // :: SYNC APPOINTMENT REMOVAL WITH GOOGLE CALENDAR if ($appointment['id_google_calendar'] != NULL) { try { - $google_sync = $this->providers_model->get_setting('google_sync',$appointment['id_users_provider']); + $google_sync = filter_var($this->providers_model + ->get_setting('google_sync',$appointment['id_users_provider']), FILTER_VALIDATE_BOOLEAN); if ($google_sync == TRUE) { $google_token = json_decode($this->providers_model @@ -192,8 +193,8 @@ class Appointments extends CI_Controller { try { $this->load->library('Notifications'); - $send_provider = $this->providers_model - ->get_setting('notifications', $provider['id']); + $send_provider = filter_var($this->providers_model + ->get_setting('notifications', $provider['id']), FILTER_VALIDATE_BOOLEAN); if ($send_provider == TRUE) { $this->notifications->send_delete_appointment($appointment, $provider, @@ -201,9 +202,10 @@ class Appointments extends CI_Controller { $_POST['cancel_reason']); } - $send_customer = $this->settings_model->get_setting('customer_notifications'); + $send_customer = filter_var($this->settings_model->get_setting('customer_notifications'), + FILTER_VALIDATE_BOOLEAN); - if ((bool)$send_customer === TRUE) { + if ($send_customer === TRUE) { $this->notifications->send_delete_appointment($appointment, $provider, $service, $customer, $company_settings, $customer['email'], $_POST['cancel_reason']); @@ -310,7 +312,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); @@ -329,6 +331,7 @@ class Appointments extends CI_Controller { public function ajax_register_appointment() { try { $post_data = $_POST['post_data']; // alias + $post_data['manage_mode'] = filter_var($post_data['manage_mode'], FILTER_VALIDATE_BOOLEAN); $this->load->model('appointments_model'); $this->load->model('providers_model'); @@ -377,8 +380,8 @@ class Appointments extends CI_Controller { // The provider must have previously granted access to his google calendar account // in order to sync the appointment. try { - $google_sync = $this->providers_model->get_setting('google_sync', - $appointment['id_users_provider']); + $google_sync = filter_var($this->providers_model->get_setting('google_sync', + $appointment['id_users_provider']), FILTER_VALIDATE_BOOLEAN); if ($google_sync == TRUE) { $google_token = json_decode($this->providers_model @@ -411,10 +414,7 @@ class Appointments extends CI_Controller { try { $this->load->library('Notifications'); - $send_provider = $this->providers_model - ->get_setting('notifications', $provider['id']); - - if (!$post_data['manage_mode']) { + if ($post_data['manage_mode'] == FALSE) { $customer_title = $this->lang->line('appointment_booked'); $customer_message = $this->lang->line('thank_you_for_appointment'); $customer_link = $this->config->item('base_url') . '/index.php/appointments/index/' @@ -436,14 +436,18 @@ class Appointments extends CI_Controller { . $appointment['hash']; } - $send_customer = $this->settings_model->get_setting('customer_notifications'); + $send_customer = filter_var($this->settings_model->get_setting('customer_notifications'), + FILTER_VALIDATE_BOOLEAN); - if ((bool)$send_customer === TRUE) { + if ($send_customer == TRUE) { $this->notifications->send_appointment_details($appointment, $provider, $service, $customer,$company_settings, $customer_title, $customer_message, $customer_link, $customer['email']); } + $send_provider = filter_var($this->providers_model ->get_setting('notifications', $provider['id']), + FILTER_VALIDATE_BOOLEAN); + if ($send_provider == TRUE) { $this->notifications->send_appointment_details($appointment, $provider, $service, $customer, $company_settings, $provider_title, @@ -539,7 +543,7 @@ class Appointments extends CI_Controller { $this->load->model('providers_model'); // Get the provider's working plan and reserved appointments. - $working_plan = json_decode($this->providers_model->get_setting('working_plan', $provider_id), true); + $working_plan = json_decode($this->providers_model->get_setting('working_plan', $provider_id), TRUE); $where_clause = array( 'id_users_provider' => $provider_id @@ -756,11 +760,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); diff --git a/src/assets/js/backend_calendar.js b/src/assets/js/backend_calendar.js index 20e529b9..a042c97d 100644 --- a/src/assets/js/backend_calendar.js +++ b/src/assets/js/backend_calendar.js @@ -291,7 +291,7 @@ var BackendCalendar = { $('#enable-sync span:eq(1)').text(EALang['disable_sync']); $('#google-sync').prop('disabled', false); } else { - $('#enable-sync').removeClass('btn-success enabled'); + $('#enable-sync').removeClass('btn-danger enabled'); $('#enable-sync span:eq(1)').text(EALang['enable_sync']); $('#google-sync').prop('disabled', true); } @@ -382,11 +382,13 @@ var BackendCalendar = { // Set the start and end datetime of the appointment. var startDatetime = Date.parseExact(appointment['start_datetime'], 'yyyy-MM-dd HH:mm:ss'); - $dialog.find('#start-datetime').val(GeneralFunctions.formatDate(startDatetime, GlobalVariables.dateFormat, true)); + // $dialog.find('#start-datetime').val(GeneralFunctions.formatDate(startDatetime, GlobalVariables.dateFormat, true)); + $dialog.find('#start-datetime').datetimepicker('setDate', startDatetime); var endDatetime = Date.parseExact(appointment['end_datetime'], 'yyyy-MM-dd HH:mm:ss'); - $dialog.find('#end-datetime').val(GeneralFunctions.formatDate(endDatetime, GlobalVariables.dateFormat, true)); + // $dialog.find('#end-datetime').val(GeneralFunctions.formatDate(endDatetime, GlobalVariables.dateFormat, true)); + $dialog.find('#end-datetime').datetimepicker('setDate', endDatetime); var customer = appointment['customer']; $dialog.find('#customer-id').val(appointment['id_users_customer']); @@ -411,9 +413,9 @@ var BackendCalendar = { // :: APPLY UNAVAILABLE DATA TO DIALOG $dialog.find('.modal-header h3').text('Edit Unavailable Period'); + $dialog.find('#unavailable-start').datetimepicker('setDate', unavailable.start_datetime); $dialog.find('#unavailable-id').val(unavailable.id); - $dialog.find('#unavailable-start').val(unavailable.start_datetime.toString('dd/MM/yyyy HH:mm')); - $dialog.find('#unavailable-end').val(unavailable.end_datetime.toString('dd/MM/yyyy HH:mm')); + $dialog.find('#unavailable-end').datetimepicker('setDate', unavailable.end_datetime); $dialog.find('#unavailable-notes').val(unavailable.notes); } @@ -774,7 +776,7 @@ var BackendCalendar = { BackendCalendar.disableProviderSync(provider['id']); - $('#enable-sync').removeClass('btn-success enabled'); + $('#enable-sync').removeClass('btn-danger enabled'); $('#enable-sync span:eq(1)').text(EALang['enable_sync']); $('#google-sync').prop('disabled', true); $('#select-filter-item option:selected').attr('google-sync', 'false'); @@ -1952,7 +1954,6 @@ var BackendCalendar = { minuteText: EALang['minutes'], firstDay: 1 }); - // $dialog.find('#start-datetime').val(formattedStartDatetime); $dialog.find('#start-datetime').datepicker('setDate', startDatetime); $dialog.find('#end-datetime').datetimepicker({ @@ -1982,7 +1983,6 @@ var BackendCalendar = { minuteText: EALang['minutes'], firstDay: 1 }); - // $dialog.find('#end-datetime').val(formattedEndDatetime); $dialog.find('#end-datetime').datepicker('setDate', endDatetime); },