Fix devices filter os (#11443)

It would log a device type change whenever someone filtered by os
This commit is contained in:
Tony Murray
2020-04-20 10:51:51 -05:00
committed by GitHub
parent fa1254e114
commit c0763e8fb1

View File

@@ -1395,7 +1395,7 @@ function load_os(&$device)
// Set type to a predefined type for the OS if it's not already set
$loaded_os_type = Config::get("os.{$device['os']}.type");
if ((!isset($device['attribs']['override_device_type']) && $device['attribs']['override_device_type'] != 1) && $loaded_os_type != $device['type']) {
if ((!isset($device['attribs']['override_device_type']) && $device['attribs']['override_device_type'] != 1) && array_key_exists('type', $device) && $loaded_os_type != $device['type']) {
log_event('Device type changed ' . $device['type'] . ' => ' . $loaded_os_type, $device, 'system', 3);
$device['type'] = $loaded_os_type;
dbUpdate(['type' => $loaded_os_type], 'devices', 'device_id=?', [$device['device_id']]);