forked from mirrors/easyappointments
Use the "array_values" method in both available-provider filtering conditions to avoid issues with missing keys
This commit is contained in:
parent
cfe88f8901
commit
dfacdc901a
1 changed files with 6 additions and 6 deletions
|
@ -101,16 +101,16 @@ class Calendar extends EA_Controller {
|
|||
|
||||
if ($role_slug === DB_SLUG_PROVIDER)
|
||||
{
|
||||
$available_providers = array_filter($available_providers, function ($available_provider) use ($user_id) {
|
||||
$available_providers = array_values(array_filter($available_providers, function ($available_provider) use ($user_id) {
|
||||
return (int)$available_provider['id'] === (int)$user_id;
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
if ($role_slug === DB_SLUG_SECRETARY)
|
||||
{
|
||||
$available_providers = array_filter($available_providers, function ($available_provider) use ($secretary_providers) {
|
||||
$available_providers = array_values(array_filter($available_providers, function ($available_provider) use ($secretary_providers) {
|
||||
return in_array($available_provider['id'], $secretary_providers);
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
$available_services = $this->services_model->get_available_services();
|
||||
|
@ -129,7 +129,7 @@ class Calendar extends EA_Controller {
|
|||
'timezones' => $this->timezones->to_array(),
|
||||
'privileges' => $privileges,
|
||||
'calendar_view' => $calendar_view,
|
||||
'available_providers' => array_values($available_providers), // Strip keys to prevent unintended array-to-object conversion
|
||||
'available_providers' => $available_providers,
|
||||
'available_services' => $available_services,
|
||||
'secretary_providers' => $secretary_providers,
|
||||
'edit_appointment' => $edit_appointment,
|
||||
|
|
Loading…
Reference in a new issue