diff options
Diffstat (limited to 'h-source/Application/Controllers/SearchController.php')
-rw-r--r-- | h-source/Application/Controllers/SearchController.php | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/h-source/Application/Controllers/SearchController.php b/h-source/Application/Controllers/SearchController.php index e5a873c..50e8284 100644 --- a/h-source/Application/Controllers/SearchController.php +++ b/h-source/Application/Controllers/SearchController.php @@ -244,26 +244,29 @@ class SearchController extends BaseController $lspciFiltered[] = $device; } } - $whereString = "'".implode("','",$vendorIDProductIDArray)."'"; - $data['table'] = $this->m['HardwareModel']->select()->where(array('pci_id'=>"in($whereString)"))->send(); + if (count($vendorIDProductIDArray) > 0) + { + $whereString = "'".implode("','",$vendorIDProductIDArray)."'"; + $data['table'] = $this->m['HardwareModel']->select()->where(array('pci_id'=>"in($whereString)"))->send(); - $foundPciidArray = $this->m['HardwareModel'] - ->select('pci_id') - ->where(array('pci_id'=>"in($whereString)")) - ->toList('pci_id') - ->send(); + $foundPciidArray = $this->m['HardwareModel'] + ->select('pci_id') + ->where(array('pci_id'=>"in($whereString)")) + ->toList('pci_id') + ->send(); - $notFoundDevices = array(); - - foreach ($lspciFiltered as $device) - { - if (!in_array($device['vendorId'].":".$device['deviceId'],$foundPciidArray)) + $notFoundDevices = array(); + + foreach ($lspciFiltered as $device) { - $notFoundDevices[] = $device; + if (!in_array($device['vendorId'].":".$device['deviceId'],$foundPciidArray)) + { + $notFoundDevices[] = $device; + } } - } - $data['notFoundDevices'] = $notFoundDevices; + $data['notFoundDevices'] = $notFoundDevices; + } } $this->append($data); |