addressing icon indicating copy to clipboard operation
addressing copied to clipboard

Generic Objects Plugin

Open sylvietto opened this issue 3 years ago • 11 comments

Is it possible to include items created by the Generic Objects plugin with an assigned IP address, please?

sylvietto avatar May 18 '22 14:05 sylvietto

+1

Zilber00 avatar Nov 30 '22 21:11 Zilber00

Hi,

You can add your generic object at line 41 of glpi/marketplace/addressing/inc/addressing.class.php

And an exeption near line 568 : if ($type == 'PluginFusioninventoryUnknownDevice' || $type == 'Enclosure' || $type == 'PDU'

zorkyx avatar Feb 21 '23 16:02 zorkyx

Good morning, zorkyx. Thank you for your reply. My generic object is labeled "Elettromedicali" and the external id is "elettromedicali". The itemtype shoud be PluginGenericobjectElettromedicali so I added this value near line 41 in addressing.class.php.

static $types = ['Computer', 'NetworkEquipment', 'Peripheral', 'Phone', 'Printer', 'Enclosure', 'PDU', 'Cluster', 'PluginGenericobjectElettromedicali'];

and an exception near line 568:

 if ($type == 'PluginFusioninventoryUnknownDevice'
             || $type == 'Enclosure'
             || $type == 'PDU'
             || $type == 'Cluster'
             || $type == 'Unmanaged'
             || $type == 'PluginGenericobjectElettromedicali')


Still no luck.

sylvietto avatar Feb 22 '23 08:02 sylvietto

Do you have an error or other ?

zorkyx avatar Feb 22 '23 10:02 zorkyx

No errors. Simply, there are no "Elettromedicali" in the list.

sylvietto avatar Feb 22 '23 11:02 sylvietto

Can you execute this MySQL request : SELECT * FROM glpi_plugin_genericobject_types WHERE 1;

zorkyx avatar Feb 23 '23 13:02 zorkyx

The result of the query is:

3 | 0 | PluginGenericobjectElettromedicali | 1 | elettromedicali |   | 2019-10-02 12:13:21 | 2019-09-23 16:20:32 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | NULL | 0 | 1 | 0 | 0 | 0 | NULL

sylvietto avatar Feb 24 '23 09:02 sylvietto

OK, "PluginGenericobjectElettromedicali" is the good name ;)

Can you try a search in the plugin with the "active debug mode". Click on Ajax Debug at the bottom of the page and "SQL Request" tab and search the biggest request like :

"SELECT port.id, 'NetworkEquipment' AS itemtype, dev.id AS on_device, dev.name AS dname, '' AS pname, glpi_ipaddresses.name as ip, port.mac, dev.users_id, INET_ATON(glpi_ipaddresses.name) AS ipnum FROM glpi_networkports port LEFT JOIN glpi_networkequipments dev ON (port.items_id = dev.id AND port.itemtype = 'NetworkEquipment') LEFT JOIN glpi_networknames ON (port.id = glpi_networknames.items_id) LEFT JOIN glpi_ipaddresses ON (glpi_ipaddresses.items_id = glpi_networknames.id) WHERE (glpi_ipaddresses.name IS NOT NULL AND glpi_ipaddresses.name != '') AND `g .................."

Search in the Unions, a select with : port.itemtype` = ''PluginGenericobjectElettromedicali"

If not, the request don't search in you plugin.

zorkyx avatar Feb 24 '23 10:02 zorkyx

Good morning Zorkyx.

Thank you for your interest. With the help of your advices, I think I understand what the problem is. There are several entities configured in my GLPI; the objects of the type "PluginGenericobjectElettromedicali" belongs to a subentity, while the reports of the plugin IPAddressing belong to the father entity. The reports generated by the plugin IPAddressing does not include objects belonging to subentities.

I don't know if there is a way to fix the issue...

Thank you very much.

sylvietto avatar Feb 27 '23 08:02 sylvietto

Indeed, the reports are provided by entity and there is no option to select entity and children :'( On the other hand, it is possible to make reports by entity. In my case, the entities are isolated so it's not a problem for me. I don't know if it is possible to fix this issue, sorry.

zorkyx avatar Mar 02 '23 08:03 zorkyx

Good morning, zorkyx.

Your help has been much appreciated and useful to understand the issue. I have removed all the entities, merging objects into the root one and now I can see a complete IP report. I leave this issue opened in order to see if it will be managed with future updates.

Goodbye.

sylvietto avatar Mar 02 '23 08:03 sylvietto