30. 09. 2020 Gabriele Cecco NetEye, Service Management

GLPI – SIM Card Data Migration from Plugin to Core

Beginning with GLPI version 0.83 a very useful plugin to record SIM card data was available.

The plugin was created by Walid Nouh and then updated by Anthony Piesset and Thierry Bugier Pineau, and was very convenient for keeping track of company SIM card data.

In addition to the specific data of the SIM like number, serial, PIN, PUK, size and so on, it was also possible to add relationships to connected assets (phone / PC / wireless router), documents and many other things.

This plugin was regularly updated and remained compatible until GLPI version 9.1.

Starting with GLPI 9.2 version, SIM cards were introduced as “components” in GLPI, and thus the plugin was no longer useful and therefore has not been updated any longer.

However, managing the SIM cards as “components” in GLPI was inconvenient, and Kaya84 created a fork that currently allows you to use the plugin up to GLPI 9.4.4

SIM cards management in GLPI version 9.5 (where it was always managed in “components”) has been improved and even if it is not as easy to use as in the Walid Nouh plugin, we might want to use it and trust that its usability will be further improved in the future.

For those who have updated GLPI to version 9.5, that plugin is no longer available. If you have a lot of data in the plugin unfortunately there is no migration script that transfers the SIM data from the plugin to the core.

However, don’t worry! It’s not necessary to re-enter them manually!

With a little familiarity with MySQL, you can easily migrate the data from the GLPI plugin to the core.

Follow the queries below and you will find your SIM card data transferred from the old plugin to the core. Most likely you will have to make some additions if you use other fields, but you will already have the bulk of the work done.

Query that inserts the SIMs in the new GLPI component table

insert into glpi_devicesimcards (id,designation,entities_id) 
select id, name, entities_id, from glpi_plugin_simcard_simcards;

Query that inserts the comments of the SIMs in the new GLPI component table

update glpi_devicesimcards gd
join glpi_plugin_simcard_simcards gpss on gpss.id=gd.id 
set gd.comment=gpss.comment;

Query that inserts the SIM data into the GLPI item-device relationship table

insert into glpi_items_devicesimcards (items_id, itemtype, devicesimcards_id, serial, otherserial, states_id, locations_id, pin, pin2, puk, puk2) 
select gpssi.items_id, gpssi.itemtype, gpss.id, gpss.users_id, gpss.serial, gpss.otherserial, gpss.states_id, gpss.locations_id, gpss.pin, gpss.pin2, gpss.puk, gpss.puk2 from glpi_plugin_simcard_simcards_items gpssi join glpi_plugin_simcard_simcards gpss on gpss.id=gpssi.plugin_simcard_simcards_id;

Query that inserts the data of SIMs not associated with a device in the GLPI item-device relationship table

insert into glpi_items_devicesimcards (items_id, itemtype, devicesimcards_id, serial, otherserial, states_id, locations_id, pin, pin2, puk, puk2)
select '0', '', gpss.id, gpss.serial, gpss.otherserial, gpss.states_id, gpss.locations_id, gpss.pin, gpss.pin2, gpss.puk, gpss.puk2 from glpi_plugin_simcard_simcards gpss where gpss.id in (select gd.id from glpi_devicesimcards gd left join glpi_items_devicesimcards gpid on gd.id=gpid.devicesimcards_id where devicesimcards_id is null);

Query that adds to the SIM those documents that were attached in the plugin

update glpi_documents_items set itemtype='DeviceSimcard' where itemtype='PluginSimcardSimcard';


Query that fixes the SIM history

update glpi_logs set itemtype='DeviceSimcard' where itemtype='PluginSimcardSimcard';
Gabriele Cecco

Gabriele Cecco

EriZone Consultant at Würth Phoenix
For several years I have been managing processes with trouble ticket systems. After having worked with some of those, EriZone impressed me for its features and flexibility, so I moved with my wife from Piedmont to South Tyrol to become part of the Würth Phoenix System Integration team as EriZone Consultant. I spend my free time travelling, exploring my new neighborhood, or if I have to stay at home I binge-watch tv series.

Author

Gabriele Cecco

For several years I have been managing processes with trouble ticket systems. After having worked with some of those, EriZone impressed me for its features and flexibility, so I moved with my wife from Piedmont to South Tyrol to become part of the Würth Phoenix System Integration team as EriZone Consultant. I spend my free time travelling, exploring my new neighborhood, or if I have to stay at home I binge-watch tv series.

Leave a Reply

Your email address will not be published. Required fields are marked *

Archive