Hello, I found a little problem in GLPI 0.83 RC3 and created a patch for it.
This problem was also reported here: http://www.glpi-project.org/forum/viewtopic.php?pid=140215#p140215, but I'm copying it here too... Ce problème se produit lorsque l'utilisateur de définir des données administratives dans OCS comme une liste. Lors de l'importation des données administratives de GLPI 0.83 RC3, GLPI obtient les informations administratives de "infocomptes" table, mais en fait, ce tableau ne stocke que l'indice des éléments de la liste, les valeurs sont stockées dans le répertoire "config" de table, il ya aussi une référence à des valeurs sur la table de "accountinfo_config" qui détermine le type de données (texte, sélectionner, etc.)Donc, GLPI devrait: 1. Vérifiez si les données administratives dans OCS de la table "accountinfo_config" n'est pas un texte 2. Vérifiez les valeurs numériques de "infocomptes" et de faire une relation entre l'index et "config" pour obtenir la valeur réelle 3. Retour de la valeur réelle de l'inventaire importésFrench translated by Google This issue occurs when the user set administrative data in OCS as a list. When importing administrative data from GLPI 0.83 RC3, GLPI gets the administrative info from "accountinfo" table but in fact this table only stores the index of the list items, the values are stored in the "config" table, there's also reference to the values on the table "accountinfo_config" which determines the type of data (text, select, etc).So GLPI should: 1. Check if the administrative data in OCS from table "accountinfo_config" is not text 2. Check the numeric values of "accountinfo" and make a relationship between the index and "config" to get the real value 3. Return the real value to the imported inventory ------------------------------------------------------------------------- I come to a solution for this problem by editing the function "updateAdministrativeInfo" in "ocsserver.class.php".This patch: --- /home/anthonygaudino/Downloads/ocsserver.class.php +++ /home/anthonygaudino/Downloads/ocsserver.class_patch.php @@ -4992,6 +4992,29 @@ if (isset($data_ocs[$ocs_column]) && !in_array($glpi_column, $computer_updates)) { $var = $data_ocs[$ocs_column]; + + // Check type of field. + $id = ltrim($ocs_column, "fields_"); + + $queryFieldType = "SELECT TYPE + FROM `accountinfo_config` + WHERE `ID` = '$id'"; + $resultFieldType = $DBocs->query($queryFieldType); + $FieldType_values = $DBocs->fetch_array($resultFieldType); + $FieldTypeVar = $FieldType_values['TYPE']; + + //Select, Checkbox and RADIOBUTTON are processed here + if ($FieldTypeVar == "2" || $FieldTypeVar == "4" || $FieldTypeVar == "7") { + $queryRealValue = "SELECT TVALUE + FROM `config`, `accountinfo_config` + WHERE `accountinfo_config`.`ID` = '$id' AND `config`.`NAME` = CONCAT('ACCOUNT_VALUE_', `accountinfo_config`.`NAME`, '_', '$var')"; + $resultRealValue = $DBocs->query($queryRealValue); + $realValue_values = $DBocs->fetch_array($resultRealValue); + $realValueVar = $realValue_values['TVALUE']; + + $var = $realValueVar; + } + switch ($glpi_column) { case "groups_id" : $var = self::importGroup($var, $entity); @@ -5867,4 +5890,4 @@ } } -?>+?>can solve the problem if the user specified administrative data of types Select, Checkbox and RADIOBUTTON. Regards Anthony Gaudino
_______________________________________________ Glpi-dev mailing list Glpi-dev@gna.org https://mail.gna.org/listinfo/glpi-dev