diff --git a/src/application/controllers/appointments.php b/src/application/controllers/appointments.php index a7ed1e32..e59d6395 100644 --- a/src/application/controllers/appointments.php +++ b/src/application/controllers/appointments.php @@ -409,8 +409,11 @@ class Appointments extends CI_Controller { $service_duration = $this->services_model->get_value('duration', $_POST['id_services']); + $exclude_appointments = (isset($_POST['exclude_appointment_id'])) + ? array($_POST['exclude_appointment_id']) : array(); + $available_periods = $this->get_provider_available_time_periods( - $_POST['id_users_provider'], $_POST['start_datetime']); + $_POST['id_users_provider'], $_POST['start_datetime'], $exclude_appointments); $is_still_available = FALSE; diff --git a/src/application/controllers/backend_api.php b/src/application/controllers/backend_api.php index 44361d07..95084a7d 100644 --- a/src/application/controllers/backend_api.php +++ b/src/application/controllers/backend_api.php @@ -342,8 +342,10 @@ class Backend_api extends CI_Controller { } $this->load->model('providers_model'); + $this->load->model('appointments_model'); $this->providers_model->set_setting('google_sync', FALSE, $_POST['provider_id']); $this->providers_model->set_setting('google_token', NULL, $_POST['provider_id']); + $this->appointments_model->clear_google_sync_ids($_POST['provider_id']); echo json_encode(AJAX_SUCCESS); diff --git a/src/application/models/appointments_model.php b/src/application/models/appointments_model.php index 98f14837..adee7318 100644 --- a/src/application/models/appointments_model.php +++ b/src/application/models/appointments_model.php @@ -369,6 +369,21 @@ class Appointments_Model extends CI_Model { $this->db->where('id', $unavailable_id); return $this->db->delete('ea_appointments'); } + + /** + * Clear google sync IDs from appointment record. + * + * @param numeric $provider_id The appointment provider record id. + */ + public function clear_google_sync_ids($provider_id) { + if (!is_numeric($provider_id)) { + throw new Exception('Invalid argument type $provider_id (value: "' + . $provider_id . '")'); + } + + $this->db->update('ea_appointments', array('id_google_calendar' => NULL), + array('id_users_provider' => $provider_id)); + } } /* End of file appointments_model.php */ diff --git a/src/application/views/backend/customers.php b/src/application/views/backend/customers.php index 2d8912b2..55e13610 100644 --- a/src/application/views/backend/customers.php +++ b/src/application/views/backend/customers.php @@ -26,14 +26,12 @@