Patch fix sql error on gengroupsql (#9929)

* Patch fix sql error on gengroupsql

* Update device-groups.inc.php

* Update device-groups.inc.php

* Update device-groups.inc.php

* Update device-groups.inc.php
This commit is contained in:
dracmic
2019-03-18 04:12:11 +02:00
committed by Tony Murray
parent a2d378e0be
commit fffd45a7fd

View File

@@ -106,7 +106,7 @@ function GenGroupSQL($pattern, $search = '', $extra = 0)
$pattern = rtrim($pattern, '&|');
if ($tables[0] != 'devices' && dbFetchCell('SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_NAME = ? && COLUMN_NAME = ?', array($tables[0],'device_id')) != 1) {
if (!in_array('devices', $tables) && 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');
}