function addGroupsToTargets($entity)
{
global $DB;
// Filter groups which can be notified and have members (as notifications are sent to members)
$query = "SELECT `id`, `name`\n FROM `glpi_groups`" . getEntitiesRestrictRequest(" WHERE", 'glpi_groups', 'entities_id', $entity, true) . "\n AND `is_usergroup`\n AND `is_notify`\n ORDER BY `name`";
foreach ($DB->request($query) as $data) {
//Add group
$this->addTarget($data["id"], sprintf(__('%1$s: %2$s'), __('Group'), $data["name"]), Notification::GROUP_TYPE);
//Add group supervisor
$this->addTarget($data["id"], sprintf(__('%1$s: %2$s'), __('Manager of group'), $data["name"]), Notification::SUPERVISOR_GROUP_TYPE);
//Add group without supervisor
$this->addTarget($data["id"], sprintf(__('%1$s: %2$s'), __("Group except manager users"), $data["name"]), Notification::GROUP_WITHOUT_SUPERVISOR_TYPE);
}
}