ContactQuery: PostgreSQL grouping..

refs #9009
This commit is contained in:
Johannes Meyer 2015-06-18 09:39:23 +02:00
parent 1169793213
commit 9cfca36f46
1 changed files with 17 additions and 2 deletions

View File

@ -140,7 +140,6 @@ class ContactQuery extends IdoQuery
'ho.object_id = h.host_object_id AND ho.is_active = 1',
array()
);
$this->group(array('c.contact_id'));
}
/**
@ -182,6 +181,22 @@ class ContactQuery extends IdoQuery
'so.object_id = s.service_object_id AND so.is_active = 1 AND so.objecttype_id = 2',
array()
);
$this->group(array('c.contact_id'));
}
/**
* {@inheritdoc}
*/
public function getGroup()
{
$group = array();
if ($this->hasJoinedVirtualTable('hosts') || $this->hasJoinedVirtualTable('services')) {
$group = array('c.contact_id', 'co.object_id');
if ($this->hasJoinedVirtualTable('timeperiods')) {
$group[] = 'ht.timeperiod_id';
$group[] = 'st.timeperiod_id';
}
}
return $group;
}
}