jbostoen / iTop-custom-extensions

Extensions for iTop . New classes (SIM cards, Monitors, IP Devices), more powerful Mail to Ticket automation, basic info on pro extensions such as geometry and ticket merge, some concepts (Check Out system), several small tweaks.
GNU General Public License v3.0
36 stars 13 forks source link

TeemIP - IPAddress object - CIs pointing to this IP - IPDevices missing #15

Open jbostoen opened 7 years ago

jbostoen commented 7 years ago

This would require changes in _ipaddress.class.inc.php. We won't do that. The tab with CI's pointing to this object, is generated in a PHP-file, not an XML.

Accomplishing it would be:

Find:

                $iNbPCs = 0;
                if  (MetaModel::IsValidClass('PC'))
                {
                    if (MetaModel::IsValidAttCode('PC', 'ipaddress_id'))
                    {
                    $oPCSearch = DBObjectSearch::FromOQL("SELECT PC WHERE ipaddress_id = $iKey");
                    $oPCSet = new CMDBObjectSet($oPCSearch);
                    $iNbPCs = $oPCSet->Count();
                    $iNbCIs += $iNbPCs;
                    }
                }

Add:

                /*JB START*/
                $iNbIPDevices = 0;
                if  (MetaModel::IsValidClass('IPDevice'))
                {
                    if (MetaModel::IsValidAttCode('IPDevice', 'managementip_id'))
                    {
                    $oIPDevicesSearch = DBObjectSearch::FromOQL("SELECT IPDevice WHERE managementip_id = $iKey");
                    $oIPDevicesSet = new CMDBObjectSet($oIPDevicesSearch);
                    $iNbIPDevices = $oIPDevicesSet->Count();
                    $iNbCIs += $iNbIPDevices;
                    }
                }
                /*JB END*/

Find:

                    if ($iNbPCs != 0)
                    {
                        $oBlock = DisplayBlock::FromObjectSet($oPCSet, 'list');
                        $oBlock->Display($oPage, 'pc_id', array('menu' => false));
                    }

Add:

                    /* JB START */
                    if ($iNbIPDevices != 0)
                    {
                        $oBlock = DisplayBlock::FromObjectSet($oIPDevicesSet, 'list');
                        $oBlock->Display($oPage, 'ipdev_id', array('menu' => false));
                    }
                    /* JB END */
jbostoen commented 7 years ago

See #16 IP Devices - IP Phones should link ConnectableCIs instead of Network Devices

Should be fixed if IPDevices become a subclass of Network Devices (and incorrectly of DataCenter Devices).