Fix inventory page hostname/sysname and default generate_device_link behaviour (#11114)

* Fix inventory page hostname and default behaviour on generate_device_link
* force test re-run
* space
* simplify

Co-authored-by: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com>
This commit is contained in:
Mathieu Poussin
2020-02-10 12:07:27 +01:00
committed by GitHub
parent c2dfe7b21c
commit 19a82e1500
2 changed files with 4 additions and 6 deletions

View File

@@ -18,7 +18,8 @@ use LibreNMS\Config;
* Compare $t with the value of $vars[$v], if that exists
* @param string $v Name of the var to test
* @param string $t Value to compare $vars[$v] to
* @return boolean true, if values are the same, false if $vars[$v] is unset or values differ
* @return boolean true, if values are the same, false if $vars[$v]
* is unset or values differ
*/
function var_eq($v, $t)
{
@@ -174,9 +175,6 @@ function generate_device_link($device, $text = null, $vars = array(), $start = 0
}
$class = devclass($device);
if (!$text) {
$text = $device['hostname'];
}
$text = format_hostname($device, $text);

View File

@@ -61,11 +61,11 @@ if ($rowCount != -1) {
$sql .= " LIMIT $limit_low,$limit_high";
}
$sql = "SELECT `D`.`device_id` AS `device_id`, `D`.`hostname` AS `hostname`,`entPhysicalDescr` AS `description`, `entPhysicalName` AS `name`, `entPhysicalModelName` AS `model`, `entPhysicalSerialNum` AS `serial` $sql";
$sql = "SELECT `D`.`device_id` AS `device_id`, `D`.`hostname` AS `hostname`, `D`.`sysName` AS `sysName`,`entPhysicalDescr` AS `description`, `entPhysicalName` AS `name`, `entPhysicalModelName` AS `model`, `entPhysicalSerialNum` AS `serial` $sql";
foreach (dbFetchRows($sql, $param) as $invent) {
$response[] = array(
'hostname' => generate_device_link($invent, shortHost($invent['hostname'])),
'hostname' => generate_device_link($invent),
'description' => $invent['description'],
'name' => $invent['name'],
'model' => $invent['model'],