diff options
author | Antonio Gallo <tonicucoz@gmail.com> | 2012-10-30 22:02:05 +0000 |
---|---|---|
committer | Antonio Gallo <tonicucoz@gmail.com> | 2012-10-30 22:02:05 +0000 |
commit | e84158192eab00fc19e58ee86368add675b1c7c2 (patch) | |
tree | b348b877d78c9081a7341e34c77edbf4a7473589 /h-source/Application | |
parent | 9b96fa37488e755f8256f83ef76f3b2631bef618 (diff) |
fixed a bug in the SearchController
Diffstat (limited to 'h-source/Application')
-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); |