Fix device group queries again (#10000)

This commit is contained in:
Tony Murray
2019-03-19 07:29:29 -05:00
committed by GitHub
parent edd18b4f9f
commit 05186d4b50

View File

@@ -106,9 +106,10 @@ function GenGroupSQL($pattern, $search = '', $extra = 0)
$pattern = rtrim($pattern, '&|');
if (!in_array('devices', $tables) && dbFetchCell('SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_NAME = ? && COLUMN_NAME = ?', array($tables[0],'device_id')) != 1) {
if ($tables[0] != 'devices' && dbFetchCell('SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_NAME = ? && COLUMN_NAME = ?', array($tables[0],'device_id')) != 1) {
//Our first table has no valid glue, prepend the 'devices' table to it!
array_unshift($tables, 'devices');
$tables = array_unique($tables); // remove devices from later in the array if it exists
}
$x = sizeof($tables)-1;
$i = 0;