Cleaning links between GLPI and OCSNG

Goal : improve the cleaning management by using search engine.

Possibles cases for return an ERROR on computer

Present in GLPI Present in LINKS Present in OCS Comment
1 0 0 0 Nothing to do, because information == NULL
2 0 0 1 Computer to import in GLPI
3 0 1 0 ERROR : to be cleaning
4 0 1 1 ERROR : to be cleaning
5 1 0 0 Computer has been added manualy
6 1 0 1 Computer to be linked
7 1 1 0 ERROR : to be cleaning
8 1 1 1 OK
Features
  • Show a list of computers on ERROR :
    • presents in the glpi_ocslinks table and not present in the glpi_computers and DBOcs.hardware tables
    • presents in the glpi_ocslinks and DBOcs.hardware tables and not present in the glpi_computers table
    • presents in the glpi_ocslinks and glpi_computers tables and not present in the DBOcs.hardware table
  • Select in this list the computer(s) to be cleaned
  • Cleans the links in the glpi_ocslinks table for computers who have been selected
  • Filtered by entity : if we want to implement this feature, we must add the information belonging to an entity in the glpi_ocslinks table (a new column), and synchronize this new information with glpi_computers. Currently, when selecting the computers in this table (glpi_ocslinks), if they are not present in glpi_computers, it is impossible to know which entity they belonged at their import in GLPI.
Rights
  • Goal : A subentity local administrator can clean a computer with the new engine, without a global administrator action.
  • Interface : New right in "Inventory > Tools" called : Clean Links = No access / Write / Read
    • If Write : user can show list, and clean computer
    • If Read : user can show list
    • If No access : user can't show the link for cleaning computers

Implementation

Files to edit
  • FRONT
    • front/ocsng.clean.php
  • LANGS
    • locales/fr_FR.php
    • locales/en_GB.php
  • CLASS
    • inc/profile.class.php
    • inc/computer.class.php
    • inc/ocsserver.class.php
  • SQL
    • mysql/glpi-*target_version_of_ticket*-empty.sql
    • install/update_*previous_version*_*target_version_of_ticket*.php
Methods
  • NEW showComputersToClean function IN OcsServer CLASS : for showing list of computer on error
  • NEW cleanLinksFromList function IN OcsServer CLASS : for clean the computers who have been selected
  • DEPRECATED cleanLinks function IN OcsServer CLASS : delete method ?
  • NEW dropdownNoneReadWrite function IN Profile CLASS : for selecting the rules right of profile
  • NEW check if $_POST["clean_ok"] is present when call front/ocsng.clean.php
    • call showComputersToClean if NOT OK
    • call cleanLinksFromList if OK
  • ADD new forward_entity_to in Computer CLASS : for sync the new entities_id value in glpi_ocslinks and value in glpi_computer
Interface
  • If multientitiesmode is not in used, we don't show the column "Entity".

Read Mode AND multientitiesmode OFF

Write Mode AND multientitiesmode ON

New Langs FR/EN
  • $LANG['ocsng'][59] = "Présent dans GLPI" / "Present in GLPI"
  • $LANG['ocsng'][60] = "Présent dans OCS" / "Present in OCS"
  • $LANG['ocsng'][61] = "Aucun objet à nettoyer" / "No object to be cleaned"
BDD
  • Rights : ALTER TABLE `glpi_profiles` ADD `clean_ocsng` char(1) COLLATE utf8_unicode_ci DEFAULT NULL;
  • Filtered by entity : ALTER TABLE `glpi_ocslinks` ADD `entities_id` int(11) NOT NULL DEFAULT '0';

Documentation

  • Files to edit : fr/glpi/tool_ocsng.dita
  • Section to edit : <title>Nettoyer les liens GLPI / OCS</title>

ocsng_clean_links.png (66.5 KB) yeti, 11/08/2010 04:55 PM

ocsng_clean_links_read_mode.png (31.9 KB) yeti, 11/08/2010 07:28 PM

ocsng_clean_links.png (39.4 KB) yeti, 11/08/2010 07:34 PM