cover comments too in IPv4 search (Mantis#1773)
authorFred Stuck <fstuck@gmail.com>
Fri, 16 Jun 2017 14:17:46 +0000 (15:17 +0100)
committerDenis Ovsienko <denis@ovsienko.info>
Fri, 16 Jun 2017 14:43:09 +0000 (15:43 +0100)
* getIPv4PrefixSearchResult()

wwwroot/inc/database.php

index 8dd4342464dfdc8c7ff420a8ee7ef86198cf20b7..ea99844e02f967305b0843b5cd19a203b67ae28b 100644 (file)
@@ -2764,17 +2764,22 @@ function unbindIPv6FromObject ($ip_bin, $object_id)
 
 function getIPv4PrefixSearchResult ($terms)
 {
-       $byname = getSearchResultByField
-       (
-               'IPv4Network',
-               array ('id'),
-               'name',
-               $terms,
-               'ip'
-       );
        $ret = array();
-       foreach ($byname as $row)
-               $ret[$row['id']] = spotEntity ('ipv4net', $row['id']);
+       foreach (array ('name', 'comment') as $column)
+       {
+               $tmp = getSearchResultByField
+               (
+                       'IPv4Network',
+                       array ('id'),
+                       $column,
+                       $terms,
+                       'ip'
+               );
+               foreach ($tmp as $row)
+               {
+                       $ret[$row['id']] = spotEntity ('ipv4net', $row['id']);
+               }
+       }
        return $ret;
 }