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

View File

@ -42,15 +42,15 @@ class NotificationhistoryQuery extends IdoQuery
{ {
switch ($this->ds->getDbType()) { switch ($this->ds->getDbType()) {
case 'mysql': 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; 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(c.alias), ', ')"; $concattedContacts = "ARRAY_TO_STRING(ARRAY_AGG(co.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
$concattedContacts = "LISTAGG(c.alias, ', ') WITHIN GROUP (ORDER BY c.alias)"; $concattedContacts = "LISTAGG(co.name1, ', ') WITHIN GROUP (ORDER BY co.name1)";
// Alternatives: // Alternatives:
// //
// RTRIM(XMLAGG(XMLELEMENT(e, column_name, ',').EXTRACT('//text()')), // RTRIM(XMLAGG(XMLELEMENT(e, column_name, ',').EXTRACT('//text()')),
@ -74,9 +74,13 @@ class NotificationhistoryQuery extends IdoQuery
array('cn' => $this->prefix . 'contactnotifications'), array('cn' => $this->prefix . 'contactnotifications'),
'cn.notification_id = n.notification_id', 'cn.notification_id = n.notification_id',
array() array()
)->joinLeft(
array('co' => $this->prefix . 'objects'),
'cn.contact_object_id = co.object_id',
array()
)->joinLeft( )->joinLeft(
array('c' => $this->prefix . 'contacts'), array('c' => $this->prefix . 'contacts'),
'cn.contact_object_id = c.contact_object_id', 'co.object_id = c.contact_object_id',
array() array()
)->group('cn.notification_id'); )->group('cn.notification_id');