NotificationHistoryQuery: names instead of aliases

refs #7104
This commit is contained in:
Thomas Gelf 2014-09-05 18:11:54 +02:00
parent 48f49c56b2
commit 9ea377fd45
1 changed files with 8 additions and 4 deletions

View File

@ -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');