Commit 6d88b163 authored by Cédric Anne's avatar Cédric Anne Committed by Johan Cwiklinski

Fix network IP adresses list; fixes #5865 (#5866)

* Fix network IP adresses list; fixes #5865

* [fixup] Fix typo
parent b34267e5
......@@ -1162,8 +1162,10 @@ class IPAddress extends CommonDBChild {
'ON' => [
'NAME' => 'items_id',
'PORT' => 'id', [
'NOT' => [
'PORT.itemtype' => $CFG_GLPI['networkport_types']
'AND' => [
'NOT' => [
'PORT.itemtype' => $CFG_GLPI['networkport_types']
]
]
]
]
......@@ -1193,13 +1195,13 @@ class IPAddress extends CommonDBChild {
$queries[] = $criteria;
$criteria = $main_criteria;
$criteria['SELECT'] = $criteria['SELECT'] + [
$criteria['SELECT'] = array_merge($criteria['SELECT'], [
new \QueryExpression("NULL AS name_id"),
new \QueryExpression("NULL AS port_id"),
new \QueryExpression('NULL AS item_id'),
new \QueryExpression("NULL AS item_type")
];
$criteria['INNER JOIN']['glpi_ipaddresses AS ADDR']['ON'][0]['AND']['ADDR.itemtype'] = ['!', 'NetworkName'];
]);
$criteria['INNER JOIN']['glpi_ipaddresses AS ADDR']['ON'][0]['AND']['ADDR.itemtype'] = ['!=', 'NetworkName'];
$queries[] = $criteria;
$union = new \QueryUnion($queries);
......
......@@ -950,8 +950,8 @@ class DBmysqlIterator extends DbTestCase {
AND `NAME`.`itemtype` = 'NetworkPort')
INNER JOIN `glpi_networkports` AS `PORT`
ON (`NAME`.`items_id` = `PORT`.`id`
NOT `PORT`.`itemtype`
IN ('" .implode("', '", $CFG_GLPI["networkport_types"])."'))
AND NOT (`PORT`.`itemtype`
IN ('" .implode("', '", $CFG_GLPI["networkport_types"])."')))
LEFT JOIN `glpi_entities` ON (`ADDR`.`entities_id` = `glpi_entities`.`id`)
WHERE `LINK`.`ipnetworks_id` = '42')";
......@@ -1103,8 +1103,10 @@ class DBmysqlIterator extends DbTestCase {
'ON' => [
'NAME' => 'items_id',
'PORT' => 'id', [
'NOT' => [
'PORT.itemtype' => $CFG_GLPI['networkport_types']
'AND' => [
'NOT' => [
'PORT.itemtype' => $CFG_GLPI['networkport_types']
]
]
]
]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment