pluginsGLPI / addressing

Plugin addressing for GLPI
GNU General Public License v2.0
36 stars 19 forks source link

Generic Objects Plugin #55

Open sylvietto opened 2 years ago

sylvietto commented 2 years ago

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

Zilber00 commented 1 year ago

+1

zorkyx commented 1 year ago

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'

sylvietto commented 1 year ago

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.

zorkyx commented 1 year ago

Do you have an error or other ?

sylvietto commented 1 year ago

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

zorkyx commented 1 year ago

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

sylvietto commented 1 year ago

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

zorkyx commented 1 year ago

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.

sylvietto commented 1 year ago

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.

zorkyx commented 1 year ago

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.

sylvietto commented 1 year ago

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.