Correct exclude appointment condition

This commit is contained in:
Alex Tselegidis 2022-05-26 14:32:23 +02:00
parent d6e913edd8
commit 15cf1cf2bf
1 changed files with 4 additions and 1 deletions

View File

@ -51,6 +51,8 @@ class Availability {
* @param int|null $exclude_appointment_id Exclude an appointment from the availability generation. * @param int|null $exclude_appointment_id Exclude an appointment from the availability generation.
* *
* @return array * @return array
*
* @throws Exception
*/ */
public function get_available_hours(string $date, array $service, array $provider, int $exclude_appointment_id = NULL): array public function get_available_hours(string $date, array $service, array $provider, int $exclude_appointment_id = NULL): array
{ {
@ -104,7 +106,8 @@ class Availability {
// existing appointment). // existing appointment).
if ($exclude_appointment_id) if ($exclude_appointment_id)
{ {
$where['id !='] = $exclude_appointment_id; $escaped_exclude_appointment_id = $this->CI->db->escape($exclude_appointment_id);
$where .= ' AND id != ' . $escaped_exclude_appointment_id;
} }
$appointments = $this->CI->appointments_model->get($where); $appointments = $this->CI->appointments_model->get($where);