Automatic Transfer For Computer

See #2075

Goal : Improve "Rules for assigning a computer to an entity" to perform automatic transfer when a "RuleOCS criteria" used is changing.
  • For RuleOCS criterias see RuleOcs::getCriterias method
  • in glpi_configs add option transfers_id_auto int (11) default 0
  • Create new section in Setup > General > Inventory called Automatic transfer of computer with :
    • Dropdown "Model for the automatic transfer from computer to another entity" (get from glpi_transfers table)
      • No automatic transfer
      • Transfer Template 1
      • Transfer Template 2
      • ...
  • Adding new field in table glpi_ocslinks called : tag varchar 255
  • Change the OCS/GLPI sync
  • Adding TAG OCSNG information in tab OCSNG on Computer view
  • Adding TAG OCSNG in searchOptions for Computer
  • Adding force option on transferComputer method for force computer to use rules engine when linkComputer is in used

Workflow OCS/GLPI

1 If TAG==null in glpi_ocslinks (migration) : set tag value fro OCS.

2 IF Automatic Transfer is ON

  1. Get all criterias used in RuleOCS
  2. IF one criteria changed OR force is true : run the rules engine again
  3. Compute the new possible entity by using the Rules engine
  4. IF compute-entity != current-entity
  5. THEN doing the transfer with selected template in the config

3 Continue the classical sync of the computer


Files to edit
  • AJAX
    • ajax/computer.tabs.php
    • inc/config.class.php
    • inc/computer.class.php
    • inc/ocsserver.class.php
    • inc/ocslink.class.php
    • locales/fr_FR.php
  • SQL
    • mysql/glpi-*target_version_of_ticket*-empty.sql
    • install/update_*previous_version*_*target_version_of_ticket*.php
  • EDIT OcsServer::updateComputer function : call new OcsServer::transferComputer
  • NEW OcsServer::transferComputer for make automatic transfer of current updateComputer
  • NEW OcsServer::uptadeTag for updating TAG information in glpi_ocslinks table (according to be equal to OcsDatabase)
  • NEW OcsLink::showForItem for showing OcsLink informations of an item
  • EDIT OcsServer::linkComputer function : call new OcsServer::transferComputer (with force = true)


  • Config Template Transfer : ALTER TABLE `glpi_configs` ADD COLUMN `transfers_id_auto` int(11) DEFAULT NULL;
    • MoYo : mauvais nom de champ : suivant la convention de nommage c'est transfers_id_auto
    • Yeti : ok, done.
  • Link Tag : ALTER TABLE `glpi_ocslinks` ADD COLUMN `tag` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL;
  • CONFIG $LANG['setup'][290] = "Transfert automatique d'ordinateur";
  • CONFIG $LANG['setup'][291] = "Modèle pour le transfert automatique d'ordinateur dans une autre entité";
  • CONFIG $LANG['setup'][292] = "Pas de transfert automatique";


automatic_transfer.png (70.8 KB) yeti, 12/13/2010 11:22 AM