diff --git a/application/controllers/Appointments.php b/application/controllers/Appointments.php
index 3adbb9f6..2276cf05 100755
--- a/application/controllers/Appointments.php
+++ b/application/controllers/Appointments.php
@@ -156,7 +156,7 @@ class Appointments extends CI_Controller {
{
$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'), [
@@ -577,8 +577,8 @@ class Appointments extends CI_Controller {
// Get the service, provider's working plan and provider appointments.
$working_plan = json_decode($this->providers_model->get_setting('working_plan', $provider_id), TRUE);
- // Get the provider's custom availability periods.
- $custom_availability_periods = json_decode($this->providers_model->get_setting('custom_availability_periods', $provider_id), TRUE);
+ // Get the provider's working plan exceptions.
+ $working_plan_exceptions = json_decode($this->providers_model->get_setting('working_plan_exceptions', $provider_id), TRUE);
$provider_appointments = $this->appointments_model->get_batch([
'id_users_provider' => $provider_id,
@@ -602,12 +602,9 @@ class Appointments extends CI_Controller {
$selected_date_working_plan = $working_plan[strtolower(date('l', strtotime($selected_date)))];
// Search if the $selected_date is an custom availability period added outside the normal working plan.
- if ($selected_date_working_plan == NULL)
+ if (isset($working_plan_exceptions[$selected_date]))
{
- if (isset($custom_availability_periods[strtolower(date('Y-m-d', strtotime($selected_date)))]))
- {
- $selected_date_working_plan = $custom_availability_periods[strtolower(date('Y-m-d', strtotime($selected_date)))];
- }
+ $selected_date_working_plan = $working_plan_exceptions[$selected_date];
}
$periods = [];
diff --git a/application/controllers/Backend.php b/application/controllers/Backend.php
index 5227d3d9..10036304 100755
--- a/application/controllers/Backend.php
+++ b/application/controllers/Backend.php
@@ -97,6 +97,7 @@ class Backend extends CI_Controller {
$user = $this->user_model->get_user($user_id);
$view['base_url'] = $this->config->item('base_url');
+ $view['page_title'] = lang('calendar');
$view['user_display_name'] = $this->user_model->get_user_display_name($this->session->userdata('user_id'));
$view['active_menu'] = PRIV_APPOINTMENTS;
$view['date_format'] = $this->settings_model->get_setting('date_format');
@@ -228,6 +229,7 @@ class Backend extends CI_Controller {
$this->load->library('timezones');
$view['base_url'] = $this->config->item('base_url');
+ $view['page_title'] = lang('customers');
$view['user_display_name'] = $this->user_model->get_user_display_name($this->session->userdata('user_id'));
$view['active_menu'] = PRIV_CUSTOMERS;
$view['company_name'] = $this->settings_model->get_setting('company_name');
@@ -281,6 +283,7 @@ class Backend extends CI_Controller {
$this->load->library('timezones');
$view['base_url'] = $this->config->item('base_url');
+ $view['page_title'] = lang('services');
$view['user_display_name'] = $this->user_model->get_user_display_name($this->session->userdata('user_id'));
$view['active_menu'] = PRIV_SERVICES;
$view['company_name'] = $this->settings_model->get_setting('company_name');
@@ -321,6 +324,7 @@ class Backend extends CI_Controller {
$this->load->library('timezones');
$view['base_url'] = $this->config->item('base_url');
+ $view['page_title'] = lang('users');
$view['user_display_name'] = $this->user_model->get_user_display_name($this->session->userdata('user_id'));
$view['active_menu'] = PRIV_USERS;
$view['company_name'] = $this->settings_model->get_setting('company_name');
@@ -333,7 +337,7 @@ class Backend extends CI_Controller {
$view['services'] = $this->services_model->get_batch();
$view['working_plan'] = $this->settings_model->get_setting('company_working_plan');
$view['timezones'] = $this->timezones->to_array();
- $view['custom_availability_periods'] = '{}';
+ $view['working_plan_exceptions'] = '{}';
$this->set_user_data($view);
$this->load->view('backend/header', $view);
@@ -365,6 +369,7 @@ class Backend extends CI_Controller {
$user_id = $this->session->userdata('user_id');
$view['base_url'] = $this->config->item('base_url');
+ $view['page_title'] = lang('settings');
$view['user_display_name'] = $this->user_model->get_user_display_name($user_id);
$view['active_menu'] = PRIV_SYSTEM_SETTINGS;
$view['company_name'] = $this->settings_model->get_setting('company_name');
diff --git a/application/controllers/Backend_api.php b/application/controllers/Backend_api.php
index 1ef33d60..eb34d50f 100755
--- a/application/controllers/Backend_api.php
+++ b/application/controllers/Backend_api.php
@@ -930,26 +930,27 @@ class Backend_api extends CI_Controller {
}
/**
- * Insert of update custom availability periods to database.
+ * Insert of update working plan exceptions to database.
*/
- public function ajax_save_custom_availability_period()
+ public function ajax_save_working_plan_exception()
{
try
{
// Check privileges
- $custom_availability_period = json_decode($this->input->post('custom_availability_period'), TRUE);
+ $required_privileges = $this->privileges[PRIV_USERS]['edit'];
- $required_privileges = ( ! isset($custom_availability_period['id']))
- ? $this->privileges[PRIV_APPOINTMENTS]['add']
- : $this->privileges[PRIV_APPOINTMENTS]['edit'];
if ($required_privileges == FALSE)
{
throw new Exception('You do not have the required privileges for this task.');
}
+ $date = $this->input->post('date');
+ $working_plan_exception = $this->input->post('working_plan_exception');
+ $provider_id = $this->input->post('provider_id');
+
$this->load->model('providers_model');
- $success = $this->providers_model->set_custom_availability_period($custom_availability_period, $custom_availability_period['id_users_provider']);
+ $success = $this->providers_model->save_working_plan_exception($date, $working_plan_exception, $provider_id);
if ($success)
{
@@ -957,7 +958,7 @@ class Backend_api extends CI_Controller {
}
else
{
- $response = ['warnings' => 'Error on saving custom availability period.'];
+ $response = ['warnings' => 'Error on saving working plan exception.'];
}
}
catch (Exception $exception)
@@ -976,25 +977,26 @@ class Backend_api extends CI_Controller {
}
/**
- * Delete an custom availability periods time period to database.
+ * Delete an working plan exceptions time period to database.
*/
- public function ajax_delete_custom_availability_period()
+ public function ajax_delete_working_plan_exception()
{
try
{
- if ($this->privileges[PRIV_APPOINTMENTS]['delete'] == FALSE)
+ // Check privileges
+ $required_privileges = $this->privileges[PRIV_USERS]['edit'];
+
+ if ($required_privileges == FALSE)
{
throw new Exception('You do not have the required privileges for this task.');
}
- // Check privileges
- $custom_availability_period = $this->input->post('custom_availability_period');
+ $date = $this->input->post('date');
$provider_id = $this->input->post('provider_id');
$this->load->model('providers_model');
- // Delete unavailable
- $success = $this->providers_model->delete_custom_availability_period($custom_availability_period, $provider_id);
+ $success = $this->providers_model->delete_working_plan_exception($date, $provider_id);
if ($success)
{
@@ -1002,7 +1004,7 @@ class Backend_api extends CI_Controller {
}
else
{
- $response = ['warnings' => 'Error on deleting custom availability period.'];
+ $response = ['warnings' => 'Error on deleting working plan exception.'];
}
}
catch (Exception $exception)
diff --git a/application/controllers/api/v1/Availabilities.php b/application/controllers/api/v1/Availabilities.php
index 48aec473..a3501637 100644
--- a/application/controllers/api/v1/Availabilities.php
+++ b/application/controllers/api/v1/Availabilities.php
@@ -151,6 +151,9 @@ class Availabilities extends API_V1_Controller {
// Get the provider's working plan and reserved appointments.
$working_plan = json_decode($this->providers_model->get_setting('working_plan', $provider_id), TRUE);
+ // Get the provider's working plan exceptions.
+ $working_plan_exceptions = json_decode($this->providers_model->get_setting('working_plan_exceptions', $provider_id), TRUE);
+
$where_clause = [
'id_users_provider' => $provider_id
];
@@ -170,10 +173,15 @@ class Availabilities extends API_V1_Controller {
}
}
- // Find the empty spaces on the plan. The first split between the plan is due to
- // a break (if exist). After that every reserved appointment is considered to be
- // a taken space in the plan.
+ // Find the empty spaces on the plan. The first split between the plan is due to a break (if exist). After that
+ // every reserved appointment is considered to be a taken space in the plan.
$selected_date_working_plan = $working_plan[strtolower(date('l', strtotime($selected_date)))];
+
+ if (isset($working_plan_exceptions[$selected_date]))
+ {
+ $selected_date_working_plan = $working_plan_exceptions[$selected_date];
+ }
+
$available_periods_with_breaks = [];
if (isset($selected_date_working_plan['breaks']))
@@ -219,8 +227,8 @@ class Availabilities extends API_V1_Controller {
$open_start = $s;
$open_end = $break_start;
$available_periods_with_breaks[] = [
- 'start' => $open_start->format("H:i"),
- 'end' => $open_end->format("H:i")
+ 'start' => $open_start->format('H:i'),
+ 'end' => $open_end->format('H:i')
];
$changed = TRUE;
}
@@ -230,8 +238,8 @@ class Availabilities extends API_V1_Controller {
$open_start = $break_end;
$open_end = $e;
$available_periods_with_breaks[] = [
- 'start' => $open_start->format("H:i"),
- 'end' => $open_end->format("H:i")
+ 'start' => $open_start->format('H:i'),
+ 'end' => $open_end->format('H:i')
];
$changed = TRUE;
}
diff --git a/application/language/arabic/translations_lang.php b/application/language/arabic/translations_lang.php
index 27b5c200..b450c97e 100755
--- a/application/language/arabic/translations_lang.php
+++ b/application/language/arabic/translations_lang.php
@@ -298,13 +298,14 @@ $lang['delete_personal_information_hint'] = 'Delete all personal information fro
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/bulgarian/translations_lang.php b/application/language/bulgarian/translations_lang.php
index 3fb59bc5..494284f0 100755
--- a/application/language/bulgarian/translations_lang.php
+++ b/application/language/bulgarian/translations_lang.php
@@ -298,13 +298,14 @@ $lang['delete_personal_information_hint'] = 'Delete all personal information fro
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/catalan/translations_lang.php b/application/language/catalan/translations_lang.php
index 827b12b6..d29ad4d3 100644
--- a/application/language/catalan/translations_lang.php
+++ b/application/language/catalan/translations_lang.php
@@ -298,13 +298,14 @@ $lang['delete_personal_information_hint'] = 'Elimineu les vostres dades del sist
$lang['delete_personal_information'] = 'Eliminació de dades personals';
$lang['delete_personal_information_prompt'] = 'Esteu segur que voleu eliminar la vostra informació personal? Aquesta acció no es pot desfer.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/chinese/translations_lang.php b/application/language/chinese/translations_lang.php
index bf7247c1..a0eb86e4 100755
--- a/application/language/chinese/translations_lang.php
+++ b/application/language/chinese/translations_lang.php
@@ -298,13 +298,14 @@ $lang['delete_personal_information_hint'] = 'Delete all personal information fro
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/czech/translations_lang.php b/application/language/czech/translations_lang.php
index 4406dacb..f236a06f 100644
--- a/application/language/czech/translations_lang.php
+++ b/application/language/czech/translations_lang.php
@@ -298,13 +298,14 @@ $lang['delete_personal_information_hint'] = 'Odstranit ze systému všechny osob
$lang['delete_personal_information'] = 'Odstranit osobní údaje';
$lang['delete_personal_information_prompt'] = 'Jste si jisti, že chcete odstranit vaše osobní údaje? Tuto akci nelze vzít zpět.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/danish/translations_lang.php b/application/language/danish/translations_lang.php
index f9611b3a..2760519f 100755
--- a/application/language/danish/translations_lang.php
+++ b/application/language/danish/translations_lang.php
@@ -298,13 +298,14 @@ $lang['delete_personal_information_hint'] = 'Slet alle dine personlige oplysning
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/dutch/translations_lang.php b/application/language/dutch/translations_lang.php
index 730a9bb0..48b2a2d5 100755
--- a/application/language/dutch/translations_lang.php
+++ b/application/language/dutch/translations_lang.php
@@ -298,13 +298,14 @@ $lang['delete_personal_information_hint'] = 'Delete all personal information fro
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/english/translations_lang.php b/application/language/english/translations_lang.php
index c4bbede3..1c586c84 100755
--- a/application/language/english/translations_lang.php
+++ b/application/language/english/translations_lang.php
@@ -304,13 +304,14 @@ $lang['delete_personal_information_hint'] = 'Remove all your appointments and pe
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/finnish/translations_lang.php b/application/language/finnish/translations_lang.php
index 20ec2d49..318cda46 100755
--- a/application/language/finnish/translations_lang.php
+++ b/application/language/finnish/translations_lang.php
@@ -298,13 +298,14 @@ $lang['delete_personal_information_hint'] = 'Delete all personal information fro
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/french/translations_lang.php b/application/language/french/translations_lang.php
index 8708cb18..7aaf3d1a 100755
--- a/application/language/french/translations_lang.php
+++ b/application/language/french/translations_lang.php
@@ -302,13 +302,14 @@ $lang['delete_personal_information_hint'] = 'Effacer toutes vos données personn
$lang['delete_personal_information'] = 'Effacer toutes mes données personnelles';
$lang['delete_personal_information_prompt'] = 'Etes-vous sûr(e) de vouloir effacer toutes vos données personnelles ? Cette action est irréversible.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/german/translations_lang.php b/application/language/german/translations_lang.php
index 75e231e1..2e366490 100755
--- a/application/language/german/translations_lang.php
+++ b/application/language/german/translations_lang.php
@@ -301,13 +301,14 @@ $lang['delete_personal_information_hint'] = 'Entfernen Sie alle Ihre Termine und
$lang['delete_personal_information'] = 'Persönlichen Informationen löschen';
$lang['delete_personal_information_prompt'] = 'Sind Sie sicher, dass Sie Ihre persönlichen Daten löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden.';
$lang['location'] = 'Ort';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/greek/translations_lang.php b/application/language/greek/translations_lang.php
index 69788a1c..540b91e5 100755
--- a/application/language/greek/translations_lang.php
+++ b/application/language/greek/translations_lang.php
@@ -298,13 +298,14 @@ $lang['delete_personal_information_hint'] = 'Κατάργηση όλων των
$lang['delete_personal_information'] = 'Διαγραφή Προσωπικών Πληροφοριών';
$lang['delete_personal_information_prompt'] = 'Είστε σίγουρος ότι θέλετε να διαγράψετε τις προσωπικές σας πληροφορίες; Αυτή η ενέργεια δεν μπορεί να αναιρεθεί.';
$lang['location'] = 'Τοποθεσία';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/hindi/translations_lang.php b/application/language/hindi/translations_lang.php
index 767952ac..dc820d96 100755
--- a/application/language/hindi/translations_lang.php
+++ b/application/language/hindi/translations_lang.php
@@ -298,13 +298,14 @@ $lang['delete_personal_information_hint'] = 'Delete all personal information fro
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/hungarian/translations_lang.php b/application/language/hungarian/translations_lang.php
index 86675cb0..0a3b5e27 100755
--- a/application/language/hungarian/translations_lang.php
+++ b/application/language/hungarian/translations_lang.php
@@ -298,13 +298,14 @@ $lang['delete_personal_information_hint'] = 'Delete all personal information fro
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/italian/translations_lang.php b/application/language/italian/translations_lang.php
index 41e791a6..f236ce22 100755
--- a/application/language/italian/translations_lang.php
+++ b/application/language/italian/translations_lang.php
@@ -298,25 +298,25 @@ $lang['delete_personal_information_hint'] = 'Cancella tutti i dati personali dal
$lang['delete_personal_information'] = 'Cancella dati personali';
$lang['delete_personal_information_prompt'] = 'Sicuro di voler cancellare i tuoi dati personali? Questa operazione è irreversibile.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Giorno extra';
-$lang['custom_availability_periods'] = 'Giorni Extra';
-$lang['custom_availability_periods_hint'] = 'Aggiungi una giornata lavorativa al di fuori del piano di lavoro.';
-$lang['new_custom_availability_period_title'] = 'Nuova giornata lavorativa';
-$lang['custom_availability_period_saved'] = 'Giornata lavorativa salvata con successo.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Aggiungi giornate lavorative al di fuori del piano di lavoro.';
-$lang['add_custom_availability_period'] = 'Aggiungi giornata lavorativa';
-$lang['require_phone_number'] = 'Richiedi il numero di telefono';
-$lang['require_phone_number_hint'] = 'Quando è abilitato, i clienti e gli utenti dovranno inserire il numero di telefono del cliente al momento della prenotazione di un appuntamento';
-$lang['check_spam_folder'] = 'Se l\'e-mail non arriva entro pochi minuti per favore controlla la cartella spam.';
-$lang['api_token_hint'] = 'Impostare un token segreto per abilitare l\'autenticazione basata su token dell\'API Easy!Appointments.';
-$lang['timezone'] = 'Fuso orario';
-$lang['overwrite_existing_working_plans'] = 'Questo sovrascriverà i piani di lavoro del fornitore esistente, siete sicuri di voler continuare?';
-$lang['working_plans_got_updated'] = 'Tutti i piani di lavoro sono stati aggiornati.';
-$lang['apply_to_all_providers'] = 'Applicare a tutti i fornitori';
-$lang['display_any_provider'] = 'Visualizzare qualsiasi opzione del fornitore';
-$lang['display_any_provider_hint'] = 'La pagina di prenotazione otterrà un\'opzione aggiuntiva che permette ai clienti di prenotare senza specificare un fornitore.';
-$lang['load_more'] = 'Carica di più';
-$lang['list'] = 'Elenco';
+$lang['working_plan_exception'] = 'Giorno extra';
+$lang['working_plan_exceptions'] = 'Giorni Extra';
+$lang['working_plan_exceptions_hint'] = 'Aggiungi una giornata lavorativa al di fuori del piano di lavoro.';
+$lang['new_working_plan_exception_title'] = 'Nuova giornata lavorativa';
+$lang['working_plan_exception_saved'] = 'Giornata lavorativa salvata con successo.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Aggiungi giornate lavorative al di fuori del piano di lavoro.';
+$lang['add_working_plan_exception'] = 'Aggiungi giornata lavorativa';
+$lang['require_phone_number'] = 'Require phone number';
+$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
+$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
+$lang['api_token_hint'] = 'Set a secret token in order to enable the token based authentication of the Easy!Appointments API.';
+$lang['timezone'] = 'Timezone';
+$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
+$lang['working_plans_got_updated'] = 'All the working plans got updated.';
+$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['display_any_provider'] = 'Display Any Provider Option';
+$lang['display_any_provider_hint'] = 'The booking page will get an additional option that allows customers to book without specifying a provider.';
+$lang['load_more'] = 'Load More';
+$lang['list'] = 'List';
$lang['default'] = 'Default';
$lang['table'] = 'Tabella';
$lang['date'] = 'Date';
diff --git a/application/language/japanese/translations_lang.php b/application/language/japanese/translations_lang.php
index 1916b4ec..f0ebf752 100755
--- a/application/language/japanese/translations_lang.php
+++ b/application/language/japanese/translations_lang.php
@@ -298,13 +298,14 @@ $lang['delete_personal_information_hint'] = 'Delete all personal information fro
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/luxembourgish/translations_lang.php b/application/language/luxembourgish/translations_lang.php
index 4dab9024..21775245 100755
--- a/application/language/luxembourgish/translations_lang.php
+++ b/application/language/luxembourgish/translations_lang.php
@@ -298,13 +298,14 @@ $lang['delete_personal_information_hint'] = 'Delete all personal information fro
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/marathi/translations_lang.php b/application/language/marathi/translations_lang.php
index c6606040..86726e86 100644
--- a/application/language/marathi/translations_lang.php
+++ b/application/language/marathi/translations_lang.php
@@ -298,13 +298,14 @@ $lang['delete_personal_information_hint'] = 'सिस्टमवरून स
$lang['delete_personal_information'] = 'वैयक्तिक माहिती हटवा';
$lang['delete_personal_information_prompt'] = 'आपली खात्री आहे की आपण आपली वैयक्तिक माहिती हटवू इच्छिता? ही क्रिया पूर्ववत करणे शक्य नाही.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/polish/translations_lang.php b/application/language/polish/translations_lang.php
index f6302250..b4e43dd8 100755
--- a/application/language/polish/translations_lang.php
+++ b/application/language/polish/translations_lang.php
@@ -298,13 +298,14 @@ $lang['delete_personal_information_hint'] = 'Delete all personal information fro
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/portuguese-br/translations_lang.php b/application/language/portuguese-br/translations_lang.php
index 5940dc86..c19a8a20 100755
--- a/application/language/portuguese-br/translations_lang.php
+++ b/application/language/portuguese-br/translations_lang.php
@@ -298,13 +298,14 @@ $lang['delete_personal_information_hint'] = 'Deletar toda informação pessoal d
$lang['delete_personal_information'] = 'Deletar Informação Pessoal';
$lang['delete_personal_information_prompt'] = 'Tem certeza que deja deletar suas informações pessoais? Essa ação não pode ser desfeita.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/portuguese/translations_lang.php b/application/language/portuguese/translations_lang.php
index 2e4f3ffe..4b15e315 100755
--- a/application/language/portuguese/translations_lang.php
+++ b/application/language/portuguese/translations_lang.php
@@ -298,13 +298,14 @@ $lang['delete_personal_information_hint'] = 'Delete all personal information fro
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/romanian/translations_lang.php b/application/language/romanian/translations_lang.php
index fa0130c6..a6cede5e 100755
--- a/application/language/romanian/translations_lang.php
+++ b/application/language/romanian/translations_lang.php
@@ -298,13 +298,14 @@ $lang['delete_personal_information_hint'] = 'Delete all personal information fro
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/russian/translations_lang.php b/application/language/russian/translations_lang.php
index 39a973f8..79f71563 100755
--- a/application/language/russian/translations_lang.php
+++ b/application/language/russian/translations_lang.php
@@ -298,13 +298,14 @@ $lang['delete_personal_information_hint'] = 'Delete all personal information fro
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/slovak/translations_lang.php b/application/language/slovak/translations_lang.php
index 28fa8fbf..387f10c9 100755
--- a/application/language/slovak/translations_lang.php
+++ b/application/language/slovak/translations_lang.php
@@ -298,13 +298,14 @@ $lang['delete_personal_information_hint'] = 'Delete all personal information fro
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/spanish/translations_lang.php b/application/language/spanish/translations_lang.php
index ce844acc..5c2ac1f6 100755
--- a/application/language/spanish/translations_lang.php
+++ b/application/language/spanish/translations_lang.php
@@ -298,13 +298,14 @@ $lang['delete_personal_information_hint'] = 'Borrar toda la información persona
$lang['delete_personal_information'] = 'Borrar información personal';
$lang['delete_personal_information_prompt'] = '¿Estás seguro que quieres borrar tu información personal? Esta acción no se puede deshacer.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/language/swedish/translations_lang.php b/application/language/swedish/translations_lang.php
index 9fb783c3..6240ae40 100755
--- a/application/language/swedish/translations_lang.php
+++ b/application/language/swedish/translations_lang.php
@@ -298,13 +298,13 @@ $lang['delete_personal_information_hint'] = 'Ta bort all dina personliga uppgift
$lang['delete_personal_information'] = 'Ta bort Personlig Information';
$lang['delete_personal_information_prompt'] = 'Är du säker på att du vill ta bort all information om dig från systemet? Det går inte att återställa informationen om du ångrar dig.';
$lang['location'] = 'Plats';
-$lang['custom_availability_period'] = 'Extra arbetsdag';
-$lang['custom_availability_periods'] = 'Extra arbetsdagar';
-$lang['custom_availability_periods_hint'] = 'Lägg till en arbetsdag utanför schemat.';
-$lang['new_custom_availability_period_title'] = 'Ny arbetsdag';
-$lang['custom_availability_period_saved'] = 'Den nya arbetsdagen är sparad.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Lägg till arbetsdagar utanför schemat.';
-$lang['add_custom_availability_period'] = 'Lägg till en arbetsdag.';
+$lang['working_plan_exception'] = 'Extra arbetsdag';
+$lang['working_plan_exceptions'] = 'Extra arbetsdagar';
+$lang['working_plan_exceptions_hint'] = 'Lägg till en arbetsdag utanför schemat.';
+$lang['new_working_plan_exception_title'] = 'Ny arbetsdag';
+$lang['working_plan_exception_saved'] = 'Den nya arbetsdagen är sparad.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Lägg till arbetsdagar utanför schemat.';
+$lang['add_working_plan_exception'] = 'Lägg till en arbetsdag.';
$lang['require_phone_number'] = 'Kräv telefonnummer.';
$lang['require_phone_number_hint'] = 'När denna är aktiv måste kunderna ange ett telefonnummer för att kunna göra en bokning.';
$lang['check_spam_folder'] = 'Om eposten inte kommit fram inom några minuter; kolla skräpposten.';
diff --git a/application/language/turkish/translations_lang.php b/application/language/turkish/translations_lang.php
index 7ef0713d..6aa811d6 100755
--- a/application/language/turkish/translations_lang.php
+++ b/application/language/turkish/translations_lang.php
@@ -298,13 +298,14 @@ $lang['delete_personal_information_hint'] = 'Delete all personal information fro
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';
-$lang['custom_availability_period'] = 'Custom availability period';
-$lang['custom_availability_periods'] = 'Custom availability periods';
-$lang['custom_availability_periods_hint'] = 'Add a custom availability period day, outside the working plan.';
-$lang['new_custom_availability_period_title'] = 'New Custom Availability Period';
-$lang['custom_availability_period_saved'] = 'Custom availability period saved successfully.';
-$lang['add_custom_availability_periods_during_each_day'] = 'Add custom availability periods, outside the working plan.';
-$lang['add_custom_availability_period'] = 'Add Custom Availability Period';
+$lang['working_plan_exception'] = 'Working Plan Exception';
+$lang['working_plan_exceptions'] = 'Working Plan Exceptions';
+$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.';
+$lang['new_working_plan_exception_title'] = 'New Working Plan Exception';
+$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.';
+$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.';
+$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.';
+$lang['add_working_plan_exception'] = 'Add Working Plan Exception';
$lang['require_phone_number'] = 'Require phone number';
$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment';
$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.';
diff --git a/application/migrations/015_add_custom_availability_periods_to_user_settings.php b/application/migrations/015_add_working_plan_exceptions_to_user_settings.php
similarity index 69%
rename from application/migrations/015_add_custom_availability_periods_to_user_settings.php
rename to application/migrations/015_add_working_plan_exceptions_to_user_settings.php
index a9721c85..0039ee43 100644
--- a/application/migrations/015_add_custom_availability_periods_to_user_settings.php
+++ b/application/migrations/015_add_working_plan_exceptions_to_user_settings.php
@@ -12,21 +12,21 @@
* ---------------------------------------------------------------------------- */
/**
- * Class Migration_Add_custom_availability_periods_to_user_settings
+ * Class Migration_Add_working_plan_exceptions_to_user_settings
*
* @property CI_DB_query_builder $db
* @property CI_DB_forge dbforge
*/
-class Migration_Add_custom_availability_periods_to_user_settings extends CI_Migration {
+class Migration_Add_working_plan_exceptions_to_user_settings extends CI_Migration {
/**
* Upgrade method.
*/
public function up()
{
- if ( ! $this->db->field_exists('custom_availability_periods', 'user_settings'))
+ if ( ! $this->db->field_exists('working_plan_exceptions', 'user_settings'))
{
$fields = [
- 'custom_availability_periods' => [
+ 'working_plan_exceptions' => [
'type' => 'TEXT',
'null' => TRUE,
'after' => 'working_plan'
@@ -42,9 +42,9 @@ class Migration_Add_custom_availability_periods_to_user_settings extends CI_Migr
*/
public function down()
{
- if ( ! $this->db->field_exists('custom_availability_periods', 'user_settings'))
+ if ( ! $this->db->field_exists('working_plan_exceptions', 'user_settings'))
{
- $this->dbforge->drop_column('user_settings', 'custom_availability_periods');
+ $this->dbforge->drop_column('user_settings', 'working_plan_exceptions');
}
}
}
diff --git a/application/models/Providers_model.php b/application/models/Providers_model.php
index 63f55a2d..cf354cd8 100755
--- a/application/models/Providers_model.php
+++ b/application/models/Providers_model.php
@@ -314,22 +314,22 @@ class Providers_Model extends CI_Model {
}
// Check if the setting record exists in db.
- if ($this->db->get_where('user_settings', ['id_users' => $provider_id])
- ->num_rows() == 0)
+ if ($this->db->get_where('user_settings', ['id_users' => $provider_id])->num_rows() === 0)
{
$this->db->insert('user_settings', ['id_users' => $provider_id]);
}
foreach ($settings as $name => $value)
{
- // Sort in descending order the custom availability periods
- if ($name == 'custom_availability_periods')
+ // Sort in descending order the working plan exceptions in a reverse order (makes it easier to edit them
+ // later on).
+ if ($name === 'working_plan_exceptions')
{
$value = json_decode($value, TRUE);
- // Sort the array and put in reverse order
krsort($value);
$value = json_encode($value);
}
+
$this->set_setting($name, $value, $provider_id);
}
}
@@ -473,7 +473,6 @@ class Providers_Model extends CI_Model {
// Get provider data.
$provider = $this->db->get_where('users', ['id' => $provider_id])->row_array();
-
// Include provider services.
$services = $this->db->get_where('services_providers',
['id_users' => $provider_id])->result_array();
@@ -484,8 +483,7 @@ class Providers_Model extends CI_Model {
}
// Include provider settings.
- $provider['settings'] = $this->db->get_where('user_settings',
- ['id_users' => $provider_id])->row_array();
+ $provider['settings'] = $this->db->get_where('user_settings', ['id_users' => $provider_id])->row_array();
unset($provider['settings']['id_users']);
// Return provider data array.
@@ -633,51 +631,6 @@ class Providers_Model extends CI_Model {
return $providers;
}
- /**
- * Save the provider custom availability period.
- *
- * @param array $custom_availability_period Contains the date and the hours of the Custom availability period.
- * @param int $provider_id The selected provider record id.
- *
- * @return bool Return if the new custom availability periods is correctly saved to DB.
- *
- * @throws Exception If start time is after the end time.
- * @throws Exception If $provider_id argument is invalid.
- */
- public function set_custom_availability_period($custom_availability_period, $provider_id)
- {
- // Validate period
- $dateStart = date('Y-m-d', strtotime($custom_availability_period['start_datetime']));
- $start = date('H:i', strtotime($custom_availability_period['start_datetime']));
- $end = date('H:i', strtotime($custom_availability_period['end_datetime']));
- if ($start > $end)
- {
- throw new Exception('Unavailable period start must be prior to end.');
- }
-
- // Validate provider record
- $where_clause = [
- 'id' => $provider_id,
- 'id_roles' => $this->db->get_where('roles', ['slug' => DB_SLUG_PROVIDER])->row()->id
- ];
-
- if ($this->db->get_where('users', $where_clause)->num_rows() == 0)
- {
- throw new Exception('Provider id was not found in database.');
- }
-
- // Add record to database.
- $custom_availability_periods = json_decode($this->get_setting('custom_availability_periods', $provider_id), TRUE);
-
- $custom_availability_periods[$dateStart] = [
- 'start' => $start,
- 'end' => $end,
- 'breaks' => []
- ];
-
- return $this->set_setting('custom_availability_periods', json_encode($custom_availability_periods), $provider_id);
- }
-
/**
* Get a providers setting from the database.
*
@@ -689,37 +642,89 @@ class Providers_Model extends CI_Model {
public function get_setting($setting_name, $provider_id)
{
$provider_settings = $this->db->get_where('user_settings', ['id_users' => $provider_id])->row_array();
+
return $provider_settings[$setting_name];
}
/**
- * Delete a provider custom availability period.
+ * Save the provider working plan exception.
*
- * @param string $custom_availability_period Contains the date to be deleted from the custom availability periods.
+ * @param string $date The working plan exception date (in YYYY-MM-DD format).
+ * @param array $working_plan_exception Contains the working plan exception information ("start", "end" and "breaks"
+ * properties).
* @param int $provider_id The selected provider record id.
*
- * @return bool Return if the new custom availability periods is correctly deleted from DB.
+ * @return bool Return if the new working plan exceptions is correctly saved to DB.
*
+ * @throws Exception If start time is after the end time.
* @throws Exception If $provider_id argument is invalid.
*/
- public function delete_custom_availability_period($custom_availability_period, $provider_id)
+ public function save_working_plan_exception($date, $working_plan_exception, $provider_id)
{
- // Validate provider record
- $where_clause = [
+ // Validate the working plan exception data.
+ $start = date('H:i', strtotime($working_plan_exception['start']));
+ $end = date('H:i', strtotime($working_plan_exception['end']));
+
+ if ($start > $end)
+ {
+ throw new Exception('Working plan exception "start" must be prior to "end".');
+ }
+
+ // Make sure the provider record exists.
+ $conditions = [
'id' => $provider_id,
'id_roles' => $this->db->get_where('roles', ['slug' => DB_SLUG_PROVIDER])->row()->id
];
- if ($this->db->get_where('users', $where_clause)->num_rows() == 0)
+ if ($this->db->get_where('users', $conditions)->num_rows() === 0)
{
- throw new Exception('Provider id was not found in database.');
+ throw new Exception('Provider record was not found in database: ' . $provider_id);
}
// Add record to database.
- $custom_availability_periods = json_decode($this->get_setting('custom_availability_periods', $provider_id), TRUE);
+ $working_plan_exceptions = json_decode($this->get_setting('working_plan_exceptions', $provider_id), TRUE);
- unset($custom_availability_periods[$custom_availability_period]);
+ if (!isset($working_plan_exception['breaks']))
+ {
+ $working_plan_exception['breaks'] = [];
+ }
- return $this->set_setting('custom_availability_periods', json_encode($custom_availability_periods), $provider_id);
+ $working_plan_exceptions[$date] = $working_plan_exception;
+
+ return $this->set_setting(
+ 'working_plan_exceptions',
+ json_encode($working_plan_exceptions),
+ $provider_id
+ );
+ }
+
+ /**
+ * Delete a provider working plan exception.
+ *
+ * @param string $date The working plan exception date (in YYYY-MM-DD format).
+ * @param int $provider_id The selected provider record id.
+ *
+ * @return bool Return if the new working plan exceptions is correctly deleted from DB.
+ *
+ * @throws Exception If $provider_id argument is invalid.
+ */
+ public function delete_working_plan_exception($date, $provider_id)
+ {
+ $provider = $this->get_row($provider_id);
+
+ $working_plan_exceptions = json_decode($provider['settings']['working_plan_exceptions'], TRUE);
+
+ if ( ! isset($working_plan_exceptions[$date]))
+ {
+ return TRUE; // The selected date does not exist in provider's settings.
+ }
+
+ unset($working_plan_exceptions[$date]);
+
+ return $this->set_setting(
+ 'working_plan_exceptions',
+ json_encode(empty($working_plan_exceptions) ? new stdClass() : $working_plan_exceptions),
+ $provider_id
+ );
}
}
diff --git a/application/views/backend/calendar.php b/application/views/backend/calendar.php
index e63e78c8..6e886e11 100755
--- a/application/views/backend/calendar.php
+++ b/application/views/backend/calendar.php
@@ -1,15 +1,15 @@
-
+
+
-
-
+
+
diff --git a/application/views/backend/users.php b/application/views/backend/users.php
index 02502604..0bf0b5e4 100755
--- a/application/views/backend/users.php
+++ b/application/views/backend/users.php
@@ -3,6 +3,7 @@
+