HostnotificationQuery: Fix grouping when *all* tables are being joined

refs #9009
This commit is contained in:
Johannes Meyer 2015-06-10 17:01:46 +02:00
parent 51a3213fca
commit 0ccb765954
1 changed files with 4 additions and 4 deletions

View File

@ -73,12 +73,12 @@ class HostnotificationQuery extends IdoQuery
switch ($this->ds->getDbType()) { switch ($this->ds->getDbType()) {
case 'mysql': case 'mysql':
$concattedContacts = "GROUP_CONCAT(" $concattedContacts = "GROUP_CONCAT("
. "cno.name1 ORDER BY cno.name1 SEPARATOR ', '" . "DISTINCT cno.name1 ORDER BY cno.name1 SEPARATOR ', '"
. ") COLLATE latin1_general_ci"; . ") COLLATE latin1_general_ci";
break; break;
case 'pgsql': case 'pgsql':
// TODO: Find a way to order the contact alias list: // TODO: Find a way to order the contact alias list:
$concattedContacts = "ARRAY_TO_STRING(ARRAY_AGG(cno.name1), ', ')"; $concattedContacts = "ARRAY_TO_STRING(ARRAY_AGG(DISTINCT cno.name1), ', ')";
break; break;
case 'oracle': case 'oracle':
// TODO: This is only valid for Oracle >= 11g Release 2 // TODO: This is only valid for Oracle >= 11g Release 2
@ -177,7 +177,7 @@ class HostnotificationQuery extends IdoQuery
3 3
); );
if (! $this->hasJoinedVirtualTable('contactnotifications')) { if (! $this->hasJoinedVirtualTable('contactnotifications') && !$this->hasJoinedVirtualTable('history')) {
$this->group(array('hn.notification_id', 'ho.name1')); $this->group(array('hn.notification_id', 'ho.name1'));
} }
} }
@ -244,7 +244,7 @@ class HostnotificationQuery extends IdoQuery
2 2
); );
if (! $this->hasJoinedVirtualTable('contactnotifications')) { if (! $this->hasJoinedVirtualTable('contactnotifications') && !$this->hasJoinedVirtualTable('history')) {
$this->group(array('hn.notification_id', 'ho.name1')); $this->group(array('hn.notification_id', 'ho.name1'));
} }
} }