Update the working plan exception checks in Availability.php for non-working days

This commit is contained in:
Alex Tselegidis 2023-07-17 07:56:51 +02:00
parent 0bb02ae2bf
commit 90c5c0282d
2 changed files with 8 additions and 3 deletions

View File

@ -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];
}

View File

@ -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.
}