The Appointments API endpoint must only return appointment records and no unavailabilities.

This commit is contained in:
alext 2018-04-13 14:54:50 +02:00
parent 7ee9f24f5a
commit baa2e58951
1 changed files with 10 additions and 2 deletions

View File

@ -50,8 +50,16 @@ class Appointments extends API_V1_Controller {
{
try
{
$condition = $id !== NULL ? 'id = ' . $id : NULL;
$appointments = $this->appointments_model->get_batch($condition, array_key_exists('aggregates', $_GET));
$conditions = [
'is_unavailable' => FALSE
];
if ($id !== NULL)
{
$conditions['id'] = $id;
}
$appointments = $this->appointments_model->get_batch($conditions, array_key_exists('aggregates', $_GET));
if ($id !== NULL && count($appointments) === 0)
{