diff --git a/LibreNMS/Alert/AlertUtil.php b/LibreNMS/Alert/AlertUtil.php
index aec41b03d..e0dc47944 100644
--- a/LibreNMS/Alert/AlertUtil.php
+++ b/LibreNMS/Alert/AlertUtil.php
@@ -25,7 +25,7 @@ <?php
namespace LibreNMS\Alert;
class AlertUtil
*/
AlertUtil
{
/**
*
* Get the rule_id for a specific alert
*
* @param $alert_id
* @return mixed|null
*/
private static function getRuleId($alert_id)
{
$query = "SELECT `rule_id` FROM `alerts` WHERE `id`=?";
return dbFetchCell($query, [$alert_id]);
}
/**
*
* Get the transport for a given alert_id
*
* @param $alert_id
* @return array
*/
public static function getAlertTransports($alert_id)
{
- getAlertTransports($alert_id)
{
$query = "SELECT b.transport_id, b.transport_type transport_type, b.transport_name FROM alert_transport_map AS a LEFT JOIN alert_transports AS b ON b.transport_id=a.transport_or_group_id WHERE a.target_type='single' AND a.rule_id=? UNION DISTINCT SELECT d.transport_id, d.transport_type transport_type, d.transport_name FROM alert_transport_map AS a LEFT JOIN alert_transport_groups AS b ON a.transport_or_group_id=b.transport_group_id LEFT JOIN transport_group_transport AS c ON b.transport_group_id=c.transport_group_id LEFT JOIN alert_transports AS d ON c.transport_id=d.transport_id WHERE a.target_type='group' AND a.rule_id=?";
+ $query = "SELECT b.transport_id, b.transport_type, b.transport_name FROM alert_transport_map AS a LEFT JOIN alert_transports AS b ON b.transport_id=a.transport_or_group_id WHERE a.target_type='single' AND a.rule_id=? UNION DISTINCT SELECT d.transport_id, d.transport_type FROM alert_transport_map AS a LEFT JOIN alert_transport_groups AS b ON a.transport_or_group_id=b.transport_group_id LEFT JOIN transport_group_transport AS c ON b.transport_group_id=c.transport_group_id LEFT JOIN alert_transports AS d ON c.transport_id=d.transport_id WHERE a.target_type='group' AND a.rule_id=?";
$rule_id = self::getRuleId($alert_id);
self::getRuleId($alert_id);
return dbFetchRows($query, [$rule_id, $rule_id]);
}
diff --git a/includes/alerts.inc.php b/includes/alerts.inc.php
index 0a61d9c77..5a0402bee 100644
--- a/includes/alerts.inc.php
+++ b/includes/alerts.inc.php
@@ -864,6 +864,7 @@ $rule_id]);
}
/**
*
* Returns the default transports
*
* @return array
*/
public static function ExtTransports($obj)
if (class_exists($class)) {
$transport_title getDefaultAlertTransports()
{
$query = ($item['legacy'] === true) ? "{$item['transport_type']} (legacy)" : $item['transport_type'];
$obj['transport'] = $item['transport_type'];
+ $obj['transport_name'] = $item['transport_name'];
$obj['alert'] = new AlertData($obj);
$obj['title'] = $type->getTitle($obj);
$obj['alert']['title'] = $obj['title'];
"SELECT transport_id, transport_type FROM alert_transports WHERE is_default=true";
return dbFetchRows($query);
}
}