From 68c67af57b737dc30d565d89f8933d06ebdf7d4b Mon Sep 17 00:00:00 2001 From: alext Date: Mon, 30 Apr 2018 13:49:16 +0200 Subject: [PATCH 01/15] Removed class from non working event. --- src/assets/js/backend_calendar_default_view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/js/backend_calendar_default_view.js b/src/assets/js/backend_calendar_default_view.js index c1d5ba40..1c19f8d5 100755 --- a/src/assets/js/backend_calendar_default_view.js +++ b/src/assets/js/backend_calendar_default_view.js @@ -1002,7 +1002,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {}; allDay: false, color: '#BEBEBE', editable: false, - className: 'fc-unavailable fc-break' + className: 'fc-unavailable' }; $calendar.fullCalendar('renderEvent', unavailablePeriod, false); From a2d72c068cf1baaf8322a7710756db2f4a351b1c Mon Sep 17 00:00:00 2001 From: alext Date: Mon, 30 Apr 2018 14:10:25 +0200 Subject: [PATCH 02/15] Corrected migration classes for v1.3.1. --- .../migrations/009_change_column_types.php | 60 +++++++------------ ...11_remove_prefix_from_fkey_constraints.php | 60 +++++++------------ 2 files changed, 40 insertions(+), 80 deletions(-) diff --git a/src/application/migrations/009_change_column_types.php b/src/application/migrations/009_change_column_types.php index 1110d838..8c881b93 100644 --- a/src/application/migrations/009_change_column_types.php +++ b/src/application/migrations/009_change_column_types.php @@ -198,61 +198,41 @@ class Migration_Change_column_types extends CI_Migration { // Add table constraints again. $this->db->query('ALTER TABLE `ea_appointments` - ADD CONSTRAINT `ea_appointments_ea_users_customer` FOREIGN KEY (`id_users_customer`) REFERENCES `ea_users` (`id`) - ON DELETE CASCADE - ON UPDATE CASCADE, - ADD CONSTRAINT `ea_appointments_ea_services` FOREIGN KEY (`id_services`) REFERENCES `ea_services` (`id`) - ON DELETE CASCADE - ON UPDATE CASCADE, - ADD CONSTRAINT `ea_appointments_ea_users_provider` FOREIGN KEY (`id_users_provider`) REFERENCES `ea_users` (`id`) - ON DELETE CASCADE - ON UPDATE CASCADE'); + ADD CONSTRAINT `ea_appointments_ibfk_2` FOREIGN KEY (`id_users_customer`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `ea_appointments_ibfk_3` FOREIGN KEY (`id_services`) REFERENCES `ea_services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `ea_appointments_ibfk_4` FOREIGN KEY (`id_users_provider`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE'); $this->db->query('ALTER TABLE `ea_secretaries_providers` - ADD CONSTRAINT `ea_secretaries_ea_users_secretary` FOREIGN KEY (`id_users_secretary`) REFERENCES `ea_users` (`id`) - ON DELETE CASCADE - ON UPDATE CASCADE, - ADD CONSTRAINT `ea_secretaries_ea_users_provider` FOREIGN KEY (`id_users_provider`) REFERENCES `ea_users` (`id`) - ON DELETE CASCADE - ON UPDATE CASCADE'); + ADD CONSTRAINT `fk_ea_secretaries_providers_1` FOREIGN KEY (`id_users_secretary`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `fk_ea_secretaries_providers_2` FOREIGN KEY (`id_users_provider`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE'); $this->db->query('ALTER TABLE `ea_services` - ADD CONSTRAINT `ea_services_ea_service_categories` FOREIGN KEY (`id_service_categories`) REFERENCES `ea_service_categories` (`id`) - ON DELETE SET NULL - ON UPDATE CASCADE'); + ADD CONSTRAINT `ea_services_ibfk_1` FOREIGN KEY (`id_service_categories`) REFERENCES `ea_service_categories` (`id`) ON DELETE SET NULL ON UPDATE CASCADE'); $this->db->query('ALTER TABLE `ea_services_providers` - ADD CONSTRAINT `ea_services_providers_ea_users_provider` FOREIGN KEY (`id_users`) REFERENCES `ea_users` (`id`) - ON DELETE CASCADE - ON UPDATE CASCADE, - ADD CONSTRAINT `ea_services_providers_ea_services` FOREIGN KEY (`id_services`) REFERENCES `ea_services` (`id`) - ON DELETE CASCADE - ON UPDATE CASCADE'); + ADD CONSTRAINT `ea_services_providers_ibfk_1` FOREIGN KEY (`id_users`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `ea_services_providers_ibfk_2` FOREIGN KEY (`id_services`) REFERENCES `ea_services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE'); $this->db->query('ALTER TABLE `ea_users` - ADD CONSTRAINT `ea_users_ea_roles` FOREIGN KEY (`id_roles`) REFERENCES `ea_roles` (`id`) - ON DELETE CASCADE - ON UPDATE CASCADE'); + ADD CONSTRAINT `ea_users_ibfk_1` FOREIGN KEY (`id_roles`) REFERENCES `ea_roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE'); $this->db->query('ALTER TABLE `ea_user_settings` - ADD CONSTRAINT `ea_user_settings_ea_users` FOREIGN KEY (`id_users`) REFERENCES `ea_users` (`id`) - ON DELETE CASCADE - ON UPDATE CASCADE'); + ADD CONSTRAINT `ea_user_settings_ibfk_1` FOREIGN KEY (`id_users`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE'); } public function down() { // Drop table constraints. - $this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY ea_appointments_ea_services'); - $this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY ea_appointments_ea_users_customer'); - $this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY ea_appointments_ea_users_provider'); - $this->db->query('ALTER TABLE ea_secretaries_providers DROP FOREIGN KEY ea_secretaries_ea_users_secretary'); - $this->db->query('ALTER TABLE ea_secretaries_providers DROP FOREIGN KEY ea_secretaries_ea_users_provider'); - $this->db->query('ALTER TABLE ea_services_providers DROP FOREIGN KEY ea_services_providers_ea_users_provider'); - $this->db->query('ALTER TABLE ea_services_providers DROP FOREIGN KEY ea_services_providers_ea_services'); - $this->db->query('ALTER TABLE ea_services DROP FOREIGN KEY ea_services_ea_service_categories'); - $this->db->query('ALTER TABLE ea_users DROP FOREIGN KEY ea_users_ea_roles'); - $this->db->query('ALTER TABLE ea_user_settings DROP FOREIGN KEY ea_user_settings_ea_users'); + $this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY ea_appointments_ibfk_2'); + $this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY ea_appointments_ibfk_3'); + $this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY ea_appointments_ibfk_4'); + $this->db->query('ALTER TABLE ea_secretaries_providers DROP FOREIGN KEY fk_ea_secretaries_providers_1'); + $this->db->query('ALTER TABLE ea_secretaries_providers DROP FOREIGN KEY fk_ea_secretaries_providers_2'); + $this->db->query('ALTER TABLE ea_services_providers DROP FOREIGN KEY ea_services_providers_ibfk_1'); + $this->db->query('ALTER TABLE ea_services_providers DROP FOREIGN KEY ea_services_providers_ibfk_2'); + $this->db->query('ALTER TABLE ea_services DROP FOREIGN KEY ea_services_ibfk_1'); + $this->db->query('ALTER TABLE ea_users DROP FOREIGN KEY ea_users_ibfk_1'); + $this->db->query('ALTER TABLE ea_user_settings DROP FOREIGN KEY ea_user_settings_ibfk_1'); // Appointments $fields = [ diff --git a/src/application/migrations/011_remove_prefix_from_fkey_constraints.php b/src/application/migrations/011_remove_prefix_from_fkey_constraints.php index 0adc878e..cfbd2805 100644 --- a/src/application/migrations/011_remove_prefix_from_fkey_constraints.php +++ b/src/application/migrations/011_remove_prefix_from_fkey_constraints.php @@ -15,16 +15,16 @@ class Migration_Remove_prefix_from_fkey_constraints extends CI_Migration { public function up() { // Drop table constraints. - $this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY ea_appointments_ea_services'); - $this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY ea_appointments_ea_users_customer'); - $this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY ea_appointments_ea_users_provider'); - $this->db->query('ALTER TABLE ea_secretaries_providers DROP FOREIGN KEY ea_secretaries_ea_users_secretary'); - $this->db->query('ALTER TABLE ea_secretaries_providers DROP FOREIGN KEY ea_secretaries_ea_users_provider'); - $this->db->query('ALTER TABLE ea_services_providers DROP FOREIGN KEY ea_services_providers_ea_users_provider'); - $this->db->query('ALTER TABLE ea_services_providers DROP FOREIGN KEY ea_services_providers_ea_services'); - $this->db->query('ALTER TABLE ea_services DROP FOREIGN KEY ea_services_ea_service_categories'); - $this->db->query('ALTER TABLE ea_users DROP FOREIGN KEY ea_users_ea_roles'); - $this->db->query('ALTER TABLE ea_user_settings DROP FOREIGN KEY ea_user_settings_ea_users'); + $this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY ea_appointments_ibfk_2'); + $this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY ea_appointments_ibfk_3'); + $this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY ea_appointments_ibfk_4'); + $this->db->query('ALTER TABLE ea_secretaries_providers DROP FOREIGN KEY fk_ea_secretaries_providers_1'); + $this->db->query('ALTER TABLE ea_secretaries_providers DROP FOREIGN KEY fk_ea_secretaries_providers_2'); + $this->db->query('ALTER TABLE ea_services_providers DROP FOREIGN KEY ea_services_providers_ibfk_1'); + $this->db->query('ALTER TABLE ea_services_providers DROP FOREIGN KEY ea_services_providers_ibfk_2'); + $this->db->query('ALTER TABLE ea_services DROP FOREIGN KEY ea_services_ibfk_1'); + $this->db->query('ALTER TABLE ea_users DROP FOREIGN KEY ea_users_ibfk_1'); + $this->db->query('ALTER TABLE ea_user_settings DROP FOREIGN KEY ea_user_settings_ibfk_1'); // Add table constraints again without the "ea" prefix. $this->db->query('ALTER TABLE `ea_appointments` @@ -86,45 +86,25 @@ class Migration_Remove_prefix_from_fkey_constraints extends CI_Migration { // Add table constraints again. $this->db->query('ALTER TABLE `ea_appointments` - ADD CONSTRAINT `ea_appointments_ea_users_customer` FOREIGN KEY (`id_users_customer`) REFERENCES `ea_users` (`id`) - ON DELETE CASCADE - ON UPDATE CASCADE, - ADD CONSTRAINT `ea_appointments_ea_services` FOREIGN KEY (`id_services`) REFERENCES `ea_services` (`id`) - ON DELETE CASCADE - ON UPDATE CASCADE, - ADD CONSTRAINT `ea_appointments_ea_users_provider` FOREIGN KEY (`id_users_provider`) REFERENCES `ea_users` (`id`) - ON DELETE CASCADE - ON UPDATE CASCADE'); + ADD CONSTRAINT `ea_appointments_ibfk_2` FOREIGN KEY (`id_users_customer`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `ea_appointments_ibfk_3` FOREIGN KEY (`id_services`) REFERENCES `ea_services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `ea_appointments_ibfk_4` FOREIGN KEY (`id_users_provider`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE'); $this->db->query('ALTER TABLE `ea_secretaries_providers` - ADD CONSTRAINT `ea_secretaries_ea_users_secretary` FOREIGN KEY (`id_users_secretary`) REFERENCES `ea_users` (`id`) - ON DELETE CASCADE - ON UPDATE CASCADE, - ADD CONSTRAINT `ea_secretaries_ea_users_provider` FOREIGN KEY (`id_users_provider`) REFERENCES `ea_users` (`id`) - ON DELETE CASCADE - ON UPDATE CASCADE'); + ADD CONSTRAINT `fk_ea_secretaries_providers_1` FOREIGN KEY (`id_users_secretary`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `fk_ea_secretaries_providers_2` FOREIGN KEY (`id_users_provider`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE'); $this->db->query('ALTER TABLE `ea_services` - ADD CONSTRAINT `ea_services_ea_service_categories` FOREIGN KEY (`id_service_categories`) REFERENCES `ea_service_categories` (`id`) - ON DELETE SET NULL - ON UPDATE CASCADE'); + ADD CONSTRAINT `ea_services_ibfk_1` FOREIGN KEY (`id_service_categories`) REFERENCES `ea_service_categories` (`id`) ON DELETE SET NULL ON UPDATE CASCADE'); $this->db->query('ALTER TABLE `ea_services_providers` - ADD CONSTRAINT `ea_services_providers_ea_users_provider` FOREIGN KEY (`id_users`) REFERENCES `ea_users` (`id`) - ON DELETE CASCADE - ON UPDATE CASCADE, - ADD CONSTRAINT `ea_services_providers_ea_services` FOREIGN KEY (`id_services`) REFERENCES `ea_services` (`id`) - ON DELETE CASCADE - ON UPDATE CASCADE'); + ADD CONSTRAINT `ea_services_providers_ibfk_1` FOREIGN KEY (`id_users`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `ea_services_providers_ibfk_2` FOREIGN KEY (`id_services`) REFERENCES `ea_services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE'); $this->db->query('ALTER TABLE `ea_users` - ADD CONSTRAINT `ea_users_ea_roles` FOREIGN KEY (`id_roles`) REFERENCES `ea_roles` (`id`) - ON DELETE CASCADE - ON UPDATE CASCADE'); + ADD CONSTRAINT `ea_users_ibfk_1` FOREIGN KEY (`id_roles`) REFERENCES `ea_roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE'); $this->db->query('ALTER TABLE `ea_user_settings` - ADD CONSTRAINT `ea_user_settings_ea_users` FOREIGN KEY (`id_users`) REFERENCES `ea_users` (`id`) - ON DELETE CASCADE - ON UPDATE CASCADE'); + ADD CONSTRAINT `ea_user_settings_ibfk_1` FOREIGN KEY (`id_users`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE'); } } From 3d27d05b58c40b551d3436e9325987d22166957c Mon Sep 17 00:00:00 2001 From: oxteam <38721222+oxteam@users.noreply.github.com> Date: Sun, 27 May 2018 17:38:34 +0200 Subject: [PATCH 03/15] Update French translation --- .../language/french/translations_lang.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/application/language/french/translations_lang.php b/src/application/language/french/translations_lang.php index e01e9da0..3b908a97 100755 --- a/src/application/language/french/translations_lang.php +++ b/src/application/language/french/translations_lang.php @@ -56,7 +56,7 @@ $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.'; $lang['calendar'] = 'Calendrier'; -$lang['users'] = 'Utilisateur'; +$lang['users'] = 'Utilisateurs'; $lang['settings'] = 'Paramètres'; $lang['log_out'] = 'Déconnexion'; $lang['synchronize'] = 'Synchronisation'; @@ -251,7 +251,7 @@ $lang['december'] = 'Décembre'; $lang['previous'] = 'Précédent'; // @TODO check -e form $lang['next'] = 'Suivant'; // @TODO check -e form $lang['now'] = 'Maintenant'; -$lang['select_time'] = 'Choisir l\'heure'; +$lang['select_time'] = 'Choisir l\'Heure'; $lang['time'] = 'Heure du RDV'; // @TODO to check ; was 'Temps' $lang['hour'] = 'Heure'; $lang['minute'] = 'Minute'; @@ -272,11 +272,11 @@ $lang['customer_notifications'] = 'Notifications aux clients'; $lang['customer_notifications_hint'] = 'Définit si les clients reçoivent des notifications par email chaque fois qu\'il y a un changement d\'horaire de l\'un de leurs rendez-vous.'; $lang['date_format'] = 'Format des Dates'; $lang['date_format_hint'] = 'Change le format d\'affichage des dates (D - Jour, M - Mois, Y - Année).'; -$lang['time_format'] = 'Time Format'; -$lang['time_format_hint'] = 'Change the time display format (H - Hours, M - Minutes).'; +$lang['time_format'] = 'Format de l\'Heure'; +$lang['time_format_hint'] = 'Change le format d\'affichage de l\'Heure (H - Heures, M - Minutes).'; $lang['google_analytics_code_hint'] = 'Renseignez l\'ID Google Analytics à utiliser dans la page des réservations.'; -$lang['availabilities_type'] = 'Availabilities Type'; +$lang['availabilities_type'] = 'Type de disponibilités'; $lang['flexible'] = 'Flexible'; -$lang['fixed'] = 'Fixed'; -$lang['attendants_number'] = 'Attendants Number'; -$lang['reset_working_plan'] = 'Reset the working plan back to the default values.'; +$lang['fixed'] = 'Fixe'; +$lang['attendants_number'] = 'Nombre de participants'; +$lang['reset_working_plan'] = 'Restaurer les valeurs d\'origine du planning de travail.'; From 4311a6205da44e1a404979e0af38685c5991f0dd Mon Sep 17 00:00:00 2001 From: alext Date: Sun, 3 Jun 2018 14:59:40 +0200 Subject: [PATCH 04/15] Updated CHANGELOG.md for 1.3.1 --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e5209043..2bb716be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - #455: French Spelling - #459: Aggregate Appointment API crashes when a break was added - #461: Invalid working plan parsing for foreign languages on day view of the default calendar view. +- #475: Booking page date selection is broken with any_provider option selected. +- #483: In backend, calendar for providers become unselectable if switched to calendar for service. +- #491: Replace hardcoded string with translation in appointment details email template. ## [1.3.0] From 3d1ec7c22e7458a819f16ac674945bcf397c34cd Mon Sep 17 00:00:00 2001 From: alext Date: Sun, 3 Jun 2018 15:05:18 +0200 Subject: [PATCH 05/15] Replaced hardcoded string with translated value on appointment removal email notification (#491). --- src/engine/Notifications/Email.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/Notifications/Email.php b/src/engine/Notifications/Email.php index be5263e9..edb1ea3e 100755 --- a/src/engine/Notifications/Email.php +++ b/src/engine/Notifications/Email.php @@ -242,7 +242,7 @@ class Email { '$appointment_service' => $service['name'], '$appointment_provider' => $provider['first_name'] . ' ' . $provider['last_name'], '$appointment_date' => date($date_format . ' ' . $timeFormat, strtotime($appointment['start_datetime'])), - '$appointment_duration' => $service['duration'] . ' minutes', + '$appointment_duration' => $service['duration'] . ' ' . $this->framework->lang->line('minutes'), '$company_link' => $company['company_link'], '$company_name' => $company['company_name'], '$customer_name' => $customer['first_name'] . ' ' . $customer['last_name'], From 39677ffe91ed1b7e0b7abac553cd72b64939962a Mon Sep 17 00:00:00 2001 From: oxteam Date: Fri, 11 May 2018 14:08:55 +0200 Subject: [PATCH 06/15] Fix date format when calling _search_any_provider (#469) (cherry picked from commit b8e1fc3) --- src/application/controllers/Appointments.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/application/controllers/Appointments.php b/src/application/controllers/Appointments.php index 76f0ce6f..a292804a 100755 --- a/src/application/controllers/Appointments.php +++ b/src/application/controllers/Appointments.php @@ -626,7 +626,7 @@ class Appointments extends CI_Controller { do { - $provider_id = $this->_search_any_provider($service_id, $current_date->format('Y-m-d H:i:s')); + $provider_id = $this->_search_any_provider($service_id, $current_date->format('Y-m-d')); if ($provider_id) { From b99d8c49f50e0879ff128238aba482453014176a Mon Sep 17 00:00:00 2001 From: oxteam Date: Fri, 11 May 2018 19:54:12 +0200 Subject: [PATCH 07/15] Use $selected_date instead of its equivalent coming from the POST (#469). (cherry picked from commit 36dbde8) --- src/application/controllers/Appointments.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/application/controllers/Appointments.php b/src/application/controllers/Appointments.php index a292804a..08d71836 100755 --- a/src/application/controllers/Appointments.php +++ b/src/application/controllers/Appointments.php @@ -1016,7 +1016,7 @@ class Appointments extends CI_Controller { if ($service['attendants_number'] > 1) { - $available_hours = $this->_get_multiple_attendants_hours($this->input->post('selected_date'), $service, + $available_hours = $this->_get_multiple_attendants_hours($selected_date, $service, $provider); } From 8fa38aa139ebc4727071349a862c967ac356a9b5 Mon Sep 17 00:00:00 2001 From: oxteam Date: Sun, 13 May 2018 22:08:58 +0200 Subject: [PATCH 08/15] Fix computation of unavailable dates for ANY_PROVIDER option (#475). (cherry picked from commit 523e260) --- src/application/controllers/Appointments.php | 101 ++++++++++--------- 1 file changed, 51 insertions(+), 50 deletions(-) diff --git a/src/application/controllers/Appointments.php b/src/application/controllers/Appointments.php index 08d71836..2fffbf9f 100755 --- a/src/application/controllers/Appointments.php +++ b/src/application/controllers/Appointments.php @@ -615,48 +615,9 @@ class Appointments extends CI_Controller { ? [$_REQUEST['appointment_id']] : []; - // Handle the "Any Provider" case. - if ($provider_id === ANY_PROVIDER) - { - $provider_id = $this->_search_any_provider($service_id, $selected_date_string); + $provider_list = ($provider_id === ANY_PROVIDER) ? $this->_search_providers_by_service($service_id) : [$provider_id] ; - if ($provider_id === null) { - $current_date = new DateTime($selected_date_string); - $current_date->add(new DateInterval('P1D')); - - do - { - $provider_id = $this->_search_any_provider($service_id, $current_date->format('Y-m-d')); - - if ($provider_id) - { - break; - } - - $current_date->add(new DateInterval('P1D')); - } while ((int)$current_date->format('d') <= $number_of_days_in_month); - } - - if ($provider_id === NULL) - { - // No provider is available in the selected date. - for ($i = 1; $i <= $number_of_days_in_month; $i++) - { - $current_date = new DateTime($selected_date->format('Y-m') . '-' . $i); - $unavailable_dates[] = $current_date->format('Y-m-d'); - } - - $this->output - ->set_content_type('application/json') - ->set_output(json_encode($unavailable_dates)); - - return; - } - } - - // Get the provider record. $this->load->model('providers_model'); - $provider = $this->providers_model->get_row($provider_id); // Get the service record. $this->load->model('services_model'); @@ -673,19 +634,29 @@ class Appointments extends CI_Controller { continue; } - $empty_periods = $this->_get_provider_available_time_periods($provider_id, - $service_id, - $current_date->format('Y-m-d'), $exclude_appointments); - - $available_hours = $this->_calculate_available_hours($empty_periods, $current_date->format('Y-m-d'), - $service['duration'], $manage_mode, $service['availabilities_type']); - - if ($service['attendants_number'] > 1) + // Finding at least one slot of availablity + foreach ($provider_list as $curr_provider_id) { - $available_hours = $this->_get_multiple_attendants_hours($current_date->format('Y-m-d'), $service, - $provider); + // Get the provider record. + $curr_provider = $this->providers_model->get_row($curr_provider_id); + + $empty_periods = $this->_get_provider_available_time_periods($curr_provider_id, + $service_id, + $current_date->format('Y-m-d'), $exclude_appointments); + + $available_hours = $this->_calculate_available_hours($empty_periods, $current_date->format('Y-m-d'), + $service['duration'], $manage_mode, $service['availabilities_type']); + if (! empty($available_hours)) break; + + if ($service['attendants_number'] > 1) + { + $available_hours = $this->_get_multiple_attendants_hours($current_date->format('Y-m-d'), $service, + $curr_provider); + if (! empty($available_hours)) break; + } } + // No availability amongst all the provider if (empty($available_hours)) { $unavailable_dates[] = $current_date->format('Y-m-d'); @@ -1032,6 +1003,36 @@ class Appointments extends CI_Controller { return $provider_id; } + /** + * Search for any provider that can handle the requested service. + * + * This method will return the database ID of the providers affected to the requested service. + * + * @param numeric $service_id The requested service ID. + * + * @return array Returns the ID of the provider that can provide the requested service. + */ + protected function _search_providers_by_service($service_id) + { + $this->load->model('providers_model'); + $available_providers = $this->providers_model->get_available_providers(); + $provider_list = array(); + + foreach ($available_providers as $provider) + { + foreach ($provider['services'] as $provider_service_id) + { + if ($provider_service_id === $service_id) + { + // Check if the provider is affected to the selected service. + $provider_list[] = $provider['id']; + } + } + } + + return $provider_list; + } + /** * Calculate the available appointment hours. * From 3428c6552aa803bd4f8e1092f0bacf5e8d5a6502 Mon Sep 17 00:00:00 2001 From: oxteam Date: Tue, 22 May 2018 23:33:34 +0200 Subject: [PATCH 09/15] Fix for unselectable calendar when switching from service to provider view (#483). (cherry picked from commit 9c2de28) --- src/assets/js/backend_calendar_default_view.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/assets/js/backend_calendar_default_view.js b/src/assets/js/backend_calendar_default_view.js index 1c19f8d5..9053b9b6 100755 --- a/src/assets/js/backend_calendar_default_view.js +++ b/src/assets/js/backend_calendar_default_view.js @@ -218,6 +218,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {}; $('#calendar').fullCalendar('option', 'editable', false); } else { $('#google-sync, #enable-sync, #insert-appointment, #insert-unavailable').prop('disabled', false); + $('#calendar').fullCalendar('option', 'selectable', true); $('#calendar').fullCalendar('option', 'editable', true); // If the user has already the sync enabled then apply the proper style changes. From a8fa3cc95993a3396c170664eaa0ba0ad31c878d Mon Sep 17 00:00:00 2001 From: alext Date: Sun, 3 Jun 2018 15:32:03 +0200 Subject: [PATCH 10/15] Updated CHANGELOG.md for 1.3.1 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bb716be..c0d4378e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - #441: Added time format selection - #452: Provide more information when errors occur during the installation. +## Changed + +- #494: French translation corrections/improvements. + ## Fixed - #433: Selected date when editing an appointment From 7508790f3166e5dc134354acd1b4e73596f741be Mon Sep 17 00:00:00 2001 From: alext Date: Sun, 3 Jun 2018 15:42:29 +0200 Subject: [PATCH 11/15] Database migration fixes (from 1.2.1 to 1.3.x) (#495). (cherry picked from commit 40e13cb7d8f5e6f8c481c253b04f1e0fb02197ef) --- .../migrations/009_change_column_types.php | 3 ++ src/assets/sql/structure.sql | 42 +++++++++---------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/application/migrations/009_change_column_types.php b/src/application/migrations/009_change_column_types.php index 8c881b93..185a40ef 100644 --- a/src/application/migrations/009_change_column_types.php +++ b/src/application/migrations/009_change_column_types.php @@ -218,6 +218,9 @@ class Migration_Change_column_types extends CI_Migration { $this->db->query('ALTER TABLE `ea_user_settings` ADD CONSTRAINT `ea_user_settings_ibfk_1` FOREIGN KEY (`id_users`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE'); + + // Change charset of ea_secretaries_providers table for databases created with EA! 1.2.1 version + $this->db->query('ALTER TABLE ea_secretaries_providers CONVERT TO CHARACTER SET utf8'); } public function down() diff --git a/src/assets/sql/structure.sql b/src/assets/sql/structure.sql index dbaab393..9b17ae25 100644 --- a/src/assets/sql/structure.sql +++ b/src/assets/sql/structure.sql @@ -2,16 +2,16 @@ SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; CREATE TABLE IF NOT EXISTS `ea_appointments` ( - `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `id` INT(11) NOT NULL AUTO_INCREMENT, `book_datetime` DATETIME, `start_datetime` DATETIME, `end_datetime` DATETIME, `notes` TEXT, `hash` TEXT, `is_unavailable` TINYINT(4) DEFAULT '0', - `id_users_provider` BIGINT(20) UNSIGNED, - `id_users_customer` BIGINT(20) UNSIGNED, - `id_services` BIGINT(20) UNSIGNED, + `id_users_provider` INT(11) + `id_users_customer` INT(11) + `id_services` INT(11) `id_google_calendar` TEXT, PRIMARY KEY (`id`), KEY `id_users_customer` (`id_users_customer`), @@ -29,15 +29,15 @@ CREATE TABLE `ea_migrations` ( DEFAULT CHARSET = utf8; CREATE TABLE IF NOT EXISTS `ea_roles` ( - `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(256), `slug` VARCHAR(256), `is_admin` TINYINT(4), - `appointments` INT(4), - `customers` INT(4), - `services` INT(4), - `users` INT(4), - `system_settings` INT(4), + `appointments` INT(11), + `customers` INT(11), + `services` INT(11), + `users` INT(11), + `system_settings` INT(11), `user_settings` INT(11), PRIMARY KEY (`id`) ) @@ -46,8 +46,8 @@ CREATE TABLE IF NOT EXISTS `ea_roles` ( CREATE TABLE IF NOT EXISTS `ea_secretaries_providers` ( - `id_users_secretary` BIGINT(20) UNSIGNED NOT NULL, - `id_users_provider` BIGINT(20) UNSIGNED NOT NULL, + `id_users_secretary` INT(11) NOT NULL, + `id_users_provider` INT(11) NOT NULL, PRIMARY KEY (`id_users_secretary`, `id_users_provider`), KEY `id_users_secretary` (`id_users_secretary`), KEY `id_users_provider` (`id_users_provider`) @@ -57,7 +57,7 @@ CREATE TABLE IF NOT EXISTS `ea_secretaries_providers` ( CREATE TABLE IF NOT EXISTS `ea_services` ( - `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(256), `duration` INT(11), `price` DECIMAL(10, 2), @@ -65,7 +65,7 @@ CREATE TABLE IF NOT EXISTS `ea_services` ( `description` TEXT, `availabilities_type` VARCHAR(32) DEFAULT 'flexible', `attendants_number` INT(11) DEFAULT '1', - `id_service_categories` BIGINT(20) UNSIGNED, + `id_service_categories` INT(11) PRIMARY KEY (`id`), KEY `id_service_categories` (`id_service_categories`) ) @@ -74,8 +74,8 @@ CREATE TABLE IF NOT EXISTS `ea_services` ( CREATE TABLE IF NOT EXISTS `ea_services_providers` ( - `id_users` BIGINT(20) UNSIGNED NOT NULL, - `id_services` BIGINT(20) UNSIGNED NOT NULL, + `id_users` INT(11) NOT NULL, + `id_services` INT(11) NOT NULL, PRIMARY KEY (`id_users`, `id_services`), KEY `id_services` (`id_services`) ) @@ -84,7 +84,7 @@ CREATE TABLE IF NOT EXISTS `ea_services_providers` ( CREATE TABLE IF NOT EXISTS `ea_service_categories` ( - `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(256), `description` TEXT, PRIMARY KEY (`id`) @@ -94,7 +94,7 @@ CREATE TABLE IF NOT EXISTS `ea_service_categories` ( CREATE TABLE IF NOT EXISTS `ea_settings` ( - `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(512), `value` LONGTEXT, PRIMARY KEY (`id`) @@ -104,7 +104,7 @@ CREATE TABLE IF NOT EXISTS `ea_settings` ( CREATE TABLE IF NOT EXISTS `ea_users` ( - `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `id` INT(11) NOT NULL AUTO_INCREMENT, `first_name` VARCHAR(256), `last_name` VARCHAR(512), `email` VARCHAR(512), @@ -115,7 +115,7 @@ CREATE TABLE IF NOT EXISTS `ea_users` ( `state` VARCHAR(128), `zip_code` VARCHAR(64), `notes` TEXT, - `id_roles` BIGINT(20) UNSIGNED NOT NULL, + `id_roles` INT(11) NOT NULL, PRIMARY KEY (`id`), KEY `id_roles` (`id_roles`) ) @@ -124,7 +124,7 @@ CREATE TABLE IF NOT EXISTS `ea_users` ( CREATE TABLE IF NOT EXISTS `ea_user_settings` ( - `id_users` BIGINT(20) UNSIGNED NOT NULL, + `id_users` INT(11) NOT NULL, `username` VARCHAR(256), `password` VARCHAR(512), `salt` VARCHAR(512), From 55d8c1e1fe755602778650897957faa794533932 Mon Sep 17 00:00:00 2001 From: alext Date: Sun, 3 Jun 2018 15:47:57 +0200 Subject: [PATCH 12/15] Updated CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0d4378e..0c5ecd4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - #475: Booking page date selection is broken with any_provider option selected. - #483: In backend, calendar for providers become unselectable if switched to calendar for service. - #491: Replace hardcoded string with translation in appointment details email template. +- #495: Database migration fixes (from 1.2.1 to 1.3.x). ## [1.3.0] From 0e3ff2493ec604e764093426208abf2e6680125b Mon Sep 17 00:00:00 2001 From: alext Date: Sun, 3 Jun 2018 15:58:44 +0200 Subject: [PATCH 13/15] Backend settings are not being displayed on page load when the user is not an admin (#497). --- CHANGELOG.md | 1 + src/assets/js/backend_settings.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c5ecd4f..9b315ae4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - #483: In backend, calendar for providers become unselectable if switched to calendar for service. - #491: Replace hardcoded string with translation in appointment details email template. - #495: Database migration fixes (from 1.2.1 to 1.3.x). +- #497: Backend settings are not being displayed on page load when the user is not an admin. ## [1.3.0] diff --git a/src/assets/js/backend_settings.js b/src/assets/js/backend_settings.js index 9d8f250a..d66b6c10 100644 --- a/src/assets/js/backend_settings.js +++ b/src/assets/js/backend_settings.js @@ -102,8 +102,8 @@ window.BackendSettings = window.BackendSettings || {}; if (bindEventHandlers) { _bindEventHandlers(); - $('#settings-page .nav li').first().addClass('active'); - $('#settings-page .nav li').first().find('a').trigger('click'); + var $link = $('#settings-page .nav li').not('.hidden').first().find('a'); + $link.tab('show'); } // Apply Privileges From 212f4e0d4ea30413a637fac10f8f5cf04a94768c Mon Sep 17 00:00:00 2001 From: alext Date: Sun, 3 Jun 2018 16:23:45 +0200 Subject: [PATCH 14/15] Typo corrections in the structure.sql --- src/assets/sql/structure.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/assets/sql/structure.sql b/src/assets/sql/structure.sql index 9b17ae25..78ccf943 100644 --- a/src/assets/sql/structure.sql +++ b/src/assets/sql/structure.sql @@ -9,9 +9,9 @@ CREATE TABLE IF NOT EXISTS `ea_appointments` ( `notes` TEXT, `hash` TEXT, `is_unavailable` TINYINT(4) DEFAULT '0', - `id_users_provider` INT(11) - `id_users_customer` INT(11) - `id_services` INT(11) + `id_users_provider` INT(11), + `id_users_customer` INT(11), + `id_services` INT(11), `id_google_calendar` TEXT, PRIMARY KEY (`id`), KEY `id_users_customer` (`id_users_customer`), @@ -65,7 +65,7 @@ CREATE TABLE IF NOT EXISTS `ea_services` ( `description` TEXT, `availabilities_type` VARCHAR(32) DEFAULT 'flexible', `attendants_number` INT(11) DEFAULT '1', - `id_service_categories` INT(11) + `id_service_categories` INT(11), PRIMARY KEY (`id`), KEY `id_service_categories` (`id_service_categories`) ) From 9ef42e7343b6bab9e2bd8c4a22e1134ece3ba024 Mon Sep 17 00:00:00 2001 From: alext Date: Sun, 3 Jun 2018 16:25:37 +0200 Subject: [PATCH 15/15] Disable search buttons when editing admin record in backend --- src/assets/js/backend_users_admins.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/assets/js/backend_users_admins.js b/src/assets/js/backend_users_admins.js index 8d9f49a0..95ed5967 100644 --- a/src/assets/js/backend_users_admins.js +++ b/src/assets/js/backend_users_admins.js @@ -102,8 +102,7 @@ $('#admins .record-details').find('select').prop('disabled', false); $('#admin-password, #admin-password-confirm').removeClass('required'); $('#admin-notifications').prop('disabled', false); - - $('#filter-admins .filter').prop('disabled', true); + $('#filter-admins button').prop('disabled', true); $('#filter-admins .results').css('color', '#AAA'); });