diff --git a/application/libraries/Availability.php b/application/libraries/Availability.php index 0372e380..fef7300e 100644 --- a/application/libraries/Availability.php +++ b/application/libraries/Availability.php @@ -127,11 +127,16 @@ class Availability { $date_working_plan = $working_plan[$working_day] ?? NULL; // Search if the $date is a custom availability period added outside the normal working plan. - if (isset($working_plan_exceptions[$date])) + if (array_key_exists($date, $working_plan_exceptions)) { $date_working_plan = $working_plan_exceptions[$date]; } + if ( ! $date_working_plan) + { + return []; + } + $periods = []; if (isset($date_working_plan['breaks'])) @@ -374,7 +379,7 @@ class Availability { $date_working_plan = $working_plan[$working_day] ?? NULL; // Search if the $date is a custom availability period added outside the normal working plan. - if (isset($working_plan_exceptions[$date])) + if (array_key_exists($date, $working_plan_exceptions)) { $date_working_plan = $working_plan_exceptions[$date]; } diff --git a/application/models/Providers_model.php b/application/models/Providers_model.php index 21c3438b..583f8120 100755 --- a/application/models/Providers_model.php +++ b/application/models/Providers_model.php @@ -636,7 +636,7 @@ class Providers_model extends EA_Model { $working_plan_exceptions = json_decode($provider['settings']['working_plan_exceptions'], TRUE); - if ( ! isset($working_plan_exceptions[$date])) + if ( ! array_key_exists($date, $working_plan_exceptions)) { return; // The selected date does not exist in provider's settings. }