From 9ea377fd45828ba05a425ef05de7c1aaab0d9061 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 5 Sep 2014 18:11:54 +0200 Subject: [PATCH] NotificationHistoryQuery: names instead of aliases refs #7104 --- .../Backend/Ido/Query/NotificationhistoryQuery.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationhistoryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationhistoryQuery.php index 64c7e69b8..4bf712f4c 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationhistoryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationhistoryQuery.php @@ -42,15 +42,15 @@ class NotificationhistoryQuery extends IdoQuery { switch ($this->ds->getDbType()) { case 'mysql': - $concattedContacts = "GROUP_CONCAT(c.alias ORDER BY c.alias SEPARATOR ', ')"; + $concattedContacts = "GROUP_CONCAT(co.name1 ORDER BY co.name1 SEPARATOR ', ') COLLATE latin1_general_ci"; break; case 'pgsql': // TODO: Find a way to order the contact alias list: - $concattedContacts = "ARRAY_TO_STRING(ARRAY_AGG(c.alias), ', ')"; + $concattedContacts = "ARRAY_TO_STRING(ARRAY_AGG(co.name1), ', ')"; break; case 'oracle': // TODO: This is only valid for Oracle >= 11g Release 2 - $concattedContacts = "LISTAGG(c.alias, ', ') WITHIN GROUP (ORDER BY c.alias)"; + $concattedContacts = "LISTAGG(co.name1, ', ') WITHIN GROUP (ORDER BY co.name1)"; // Alternatives: // // RTRIM(XMLAGG(XMLELEMENT(e, column_name, ',').EXTRACT('//text()')), @@ -74,9 +74,13 @@ class NotificationhistoryQuery extends IdoQuery array('cn' => $this->prefix . 'contactnotifications'), 'cn.notification_id = n.notification_id', array() + )->joinLeft( + array('co' => $this->prefix . 'objects'), + 'cn.contact_object_id = co.object_id', + array() )->joinLeft( array('c' => $this->prefix . 'contacts'), - 'cn.contact_object_id = c.contact_object_id', + 'co.object_id = c.contact_object_id', array() )->group('cn.notification_id');