From 76509bb7c81b43613c3f00a7ee1bd3829e19c8aa Mon Sep 17 00:00:00 2001 From: raviks789 <33730024+raviks789@users.noreply.github.com> Date: Fri, 22 Sep 2023 13:44:09 +0200 Subject: [PATCH] IcingaServiceSetServiceTable: Change table alias for director branches --- library/Director/Web/Table/IcingaServiceSetServiceTable.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/Director/Web/Table/IcingaServiceSetServiceTable.php b/library/Director/Web/Table/IcingaServiceSetServiceTable.php index 981cd538..0f0c4d54 100644 --- a/library/Director/Web/Table/IcingaServiceSetServiceTable.php +++ b/library/Director/Web/Table/IcingaServiceSetServiceTable.php @@ -199,11 +199,13 @@ class IcingaServiceSetServiceTable extends ZfQueryBasedTable assert($connection instanceof Db); $builder = new ServiceSetQueryBuilder($connection, $this->branchUuid); $query = $builder->selectServicesForSet($this->set); + $alias = $this->branchUuid ? 'u' : 'o'; + if ($this->affectedHost) { if ($hostId = $this->affectedHost->get('id')) { $query->joinLeft( ['hsb' => 'icinga_host_service_blacklist'], - $this->db()->quoteInto('o.id = hsb.service_id AND hsb.host_id = ?', $hostId), + $this->db()->quoteInto("$alias.id = hsb.service_id AND hsb.host_id = ?", $hostId), [] )->columns([ 'blacklisted' => "CASE WHEN hsb.service_id IS NULL THEN 'n' ELSE 'y' END"