You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2013-02-14 16:04:20

frague
Member
Registered: 2009-09-22
Posts: 33

Incompatibilité entre les plugins genericobjects et addressing

Bonjour,

J'ai une installation de GLPI en version 0.83.7 sur ubuntu server, couplé avec OCS. J'ai installé il y a quelsues mois le plugn "Gestion d'objets" pour gérer nos matériels bizares (videproj, APN...). J'ai un site "en production" et un site de tests, sur lequel je bidouille un peu.

J'ai souhaiter tester le plugin adressing "Adresse IP", mais je n'avais jamais de remontée des informations sur es matériels : la liste des IPs balayée était vide et impossible de voir mes matériels.

J'ai testé la requête executée par le plugin adressing, et je me suis apperçu que c'était une des sous-requête de ce plugin qui posait des problèmes  : les champs "users_id" et "networks_id" n'existe pas dans la table glpi_plugin_genericobjects_videoproj. En regardant la configuration de mon objet, je n'ai pas trouvé les champs à ajouter, et surtout le champ "networks_id".

Vous est-il possible d'ajouter ces champs au plugin "genericobject" ?

Merci d'avance !

François GUÉRIN

PS : Je souhaitais poster cet incident directement sur la forge plugins.glpi-projects.org, mais e n'ai pas les droits.

Offline

#2 2013-02-14 16:05:23

frague
Member
Registered: 2009-09-22
Posts: 33

Re: Incompatibilité entre les plugins genericobjects et addressing

pps : Les plugins sont tous 2 dans les dernières versions : genericobjects 2.1.3 et Adressage IP 2.0.1

Offline

#3 2013-02-14 18:30:02

frague
Member
Registered: 2009-09-22
Posts: 33

Re: Incompatibilité entre les plugins genericobjects et addressing

Bonsoir à tous,

J'ai modifé le plugin genericobject pour qu'il soit compatible avec addressing :

genericobject/fields/field.constant.php : Ajout de lignes

L120 :  // Field added for compatibility with adressing plugin
L121 : $GO_FIELDS['networks_id']['name']       = $LANG['setup'][88];
L122 : $GO_FIELDS['networks_id']['input_type'] = 'dropdown';

genericobject/inc/type.class.php : Mise à jour

L589 : dans public static function addTable($itemtype)
      /*
      $query = "CREATE TABLE IF NOT EXISTS `".getTableForItemType($itemtype)."` (
                  `id` INT( 11 ) NOT NULL AUTO_INCREMENT,
                  `entities_id` INT( 11 ) NOT NULL DEFAULT '0',
                  `name` VARCHAR( 255 ) collate utf8_unicode_ci NOT NULL DEFAULT '',
                  `comment` text COLLATE utf8_unicode_ci,
                  `notepad` text COLLATE utf8_unicode_ci,
                  `date_mod` DATETIME NULL  ,
                  PRIMARY KEY ( `id` )
                  ) ENGINE = MYISAM COMMENT = '$itemtype' DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
       */
       
      // Add fields `networks_id` and `users_id` for addressing plugin compatibility 
      $query = "CREATE TABLE IF NOT EXISTS `".getTableForItemType($itemtype)."` (
                  `id` INT( 11 ) NOT NULL AUTO_INCREMENT,
                  `entities_id` INT( 11 ) NOT NULL DEFAULT '0',
                  `name` VARCHAR( 255 ) collate utf8_unicode_ci NOT NULL DEFAULT '',
                  `comment` text COLLATE utf8_unicode_ci,
                  `notepad` text COLLATE utf8_unicode_ci,
                  `date_mod` DATETIME NULL  ,
                  `networks_id` INT( 11 ),
                  `users_id` INT( 11 ),
                  PRIMARY KEY ( `id` )
                  ) ENGINE = MYISAM COMMENT = '$itemtype' DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";

genericobject/setup.php : Mise à jour

L48: dans function plugin_init_genericobject() {
   /*
   $GO_BLACKLIST_FIELDS = array ("itemtype", "table", "is_deleted", "id", "entities_id",
                                 "is_recursive", "is_template", "notepad", "template_name",
                                 "is_helpdesk_visible", "comment", "name", "date_mod")
   */
    
   // Updated to compatibility with adressing plugin
   $GO_BLACKLIST_FIELDS = array ("itemtype", "table", "is_deleted", "id", "entities_id",
                                 "is_recursive", "is_template", "notepad", "template_name",
                                 "is_helpdesk_visible", "comment", "name", "date_mod",
                                 "networks_id", "users_id");

Ces modifications ajoutent les champs `users_id` et `networks_id` aux nouveaux objects créés, il faudra modifier les tables 'à la main' pour ajouter les champs en cas de mise à jour du plugin.

Toutefois, ces modifications ne doivent pas être très compliquées à ajouter, au setup.php
Bien à vous !

François GUÉRIN

Offline

Board footer

Powered by FluxBB