skunkie/glpi_sync

Update for glpi 9.2?

dwtz opened this issue · 5 comments

dwtz commented

Hi,

since the database structure has been changed in glpi 9.2 is there an update?

Hi @dwtz,
Are there errors while running the plugin?

dwtz commented

Hi @skunkie
(1054, "Unknown column 'c.operatingsystems_id' in 'on clause'")
The database fields have changed, I think.

dwtz commented

changed c.operatingsystems_id to c.id and the query is running
But now the assignment no longer agrees...

dwtz commented
query = """
SELECT c.id host_id,
LOWER(c.name) hostname,
LOWER(s.name) state,
ct.name type,
os.name osname
FROM glpi_computers c
LEFT JOIN glpi_states s
ON c.states_id = s.id
LEFT JOIN glpi_computertypes ct
ON c.computertypes_id = ct.id
LEFT JOIN glpi_items_operatingsystems ios
ON c.id = ios.items_id
LEFT JOIN glpi_operatingsystems os
ON ios.operatingsystems_id = os.id
WHERE c.is_deleted = 0
AND c.is_template = 0
AND LOWER(s.name) IN (%s)
ORDER BY hostname
""" % ', '.join(map(lambda x: '%s', glpi_config['states']))

good job, @dwtz. Could you make a PR? We need to find the version of GLPI. to make different queries.