diff options
author | Simon Rettberg | 2021-03-04 14:59:22 +0100 |
---|---|---|
committer | Simon Rettberg | 2021-03-04 14:59:22 +0100 |
commit | 6bdd81d83379f080029865de8507e076cc95a846 (patch) | |
tree | f757f8dde7c6c0b0fae12c3cbd1e85acfda9b916 | |
parent | [serversetup-bwlp-ipxe] Location-override: Show default, label for="" (diff) | |
download | slx-admin-6bdd81d83379f080029865de8507e076cc95a846.tar.gz slx-admin-6bdd81d83379f080029865de8507e076cc95a846.tar.xz slx-admin-6bdd81d83379f080029865de8507e076cc95a846.zip |
[locationinfo] Ignore position of machines with mismatching location
If locationid != fixedlocationid, something must be off, and we better
ignore that machine's position in the room.
-rw-r--r-- | modules-available/locationinfo/inc/infopanel.inc.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/modules-available/locationinfo/inc/infopanel.inc.php b/modules-available/locationinfo/inc/infopanel.inc.php index af32c1ed..6deb9db5 100644 --- a/modules-available/locationinfo/inc/infopanel.inc.php +++ b/modules-available/locationinfo/inc/infopanel.inc.php @@ -108,7 +108,9 @@ class InfoPanel if ($withHostname) { $extraCols .= 'm.hostname,'; } - $query = "SELECT m.locationid, m.machineuuid, $extraCols m.logintime, m.lastseen, m.lastboot, m.state, m.currentrunmode FROM machine m + $query = "SELECT m.locationid, m.fixedlocationid, m.machineuuid, $extraCols m.logintime, + m.lastseen, m.lastboot, m.state, m.currentrunmode + FROM machine m WHERE m.locationid IN (:idlist)"; $dbquery = Database::simpleQuery($query, array('idlist' => $idList)); @@ -125,7 +127,8 @@ class InfoPanel } // Compact the pc data in one array. $pc = array('id' => $row['machineuuid']); - if ($withPosition && !empty($row['position'])) { + if ($withPosition && $row['locationid'] == $row['fixedlocationid'] && !empty($row['position'])) { + // check fixed* == locationid to ignore stale position data in relocated clients $position = json_decode($row['position'], true); if (isset($position['gridCol']) && isset($position['gridRow'])) { $pc['x'] = $position['gridCol']; |