From 80bb356d16f254db1413f5077d22014318643421 Mon Sep 17 00:00:00 2001 From: "alextselegidis@gmail.com" Date: Thu, 21 Nov 2013 21:58:51 +0000 Subject: [PATCH] * Fixed Issue #25 * Other minor bug fixes. --- src/application/controllers/appointments.php | 5 ++- src/application/controllers/backend_api.php | 2 ++ src/application/models/appointments_model.php | 15 ++++++++ src/application/views/backend/customers.php | 12 +++---- src/application/views/backend/services.php | 24 ++++++------- src/application/views/backend/users.php | 36 ++++++++----------- src/assets/js/backend_calendar.js | 16 ++++----- src/assets/js/backend_users_providers.js | 1 + src/assets/js/frontend_book.js | 6 +++- 9 files changed, 64 insertions(+), 53 deletions(-) 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 @@
- - -
diff --git a/src/application/views/backend/services.php b/src/application/views/backend/services.php index d3b58661..bc5d845c 100644 --- a/src/application/views/backend/services.php +++ b/src/application/views/backend/services.php @@ -36,14 +36,12 @@
- - -
@@ -113,14 +111,12 @@