You are not logged in.
Bonjour
J'ai récupéré un plugin créé en version 0.84. On me demande de le mettre à jour en 085. J'ai réussi à gérer les droits (profils), mais je rencontre une erreur que je ne comprends pas.
Il s'agit de la partie config du plugin qui appel dropdown.common.form.php:
$dropdown = new PluginBiperConfig();
$_GET['id'] = 1;
include (GLPI_ROOT . "/front/dropdown.common.form.php");
lorsque je test j'obtiens ceci:
si je test avec une version 0.84 j'obtiens:
J'ai fini par comprendre que le problème se situait au niveau de l'appel de méthode
$dropdown->display($options);
si je rajoute en plus ceci dans dropdown.common.form.php:
$options['id'] = $_GET["id"];
$dropdown->showForm($_GET["id"]);
$dropdown->display($options);
j'obtiens ceci:
voici ma class config.class.php:
<?php
/*
* @version $Id$
LICENSE
This file is part of the order plugin.
biper plugin is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
biper plugin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GLPI; along with biper. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
@package biper
@author TECLIB' : Anthony Hebert & Walid Nouh
@copyright Copyright (c) 2012 TECLIB'
@license GPLv2+
http://www.gnu.org/licenses/gpl.txt
@link http://www.teclib.com
@link http://www.glpi-project.org/
@since 2012
---------------------------------------------------------------------- */
if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access directly to this file");
}
/**
* Computer class
**/
class PluginBiperConfig extends CommonDropdown {
public $first_level_menu = "config";
public $second_level_menu = "plugins";
static function canCreate() {
//return Session::haveRight("config", "w");
//return Session::haveRight('plugin_biper_config', CREATE);
return true;
}
static function canView() {
//return Session::haveRight("config", "r");
//return Session::haveRight('plugin_biper_config', READ);
return true;
}
static function canDelete() {
return false;
}
function prepareInputForUpdate($input = array()) {
if (isset($input['password']) && $input['password'] == '') {
unset($input['password']);
}
return $input;
}
static function getTypeName($nb = 0) {
return __('Biper', 'biper');
}
static function install(Migration $migration) {
global $DB;
if (!TableExists("glpi_plugin_biper_configs")) {
$sql = "CREATE TABLE IF NOT EXISTS `glpi_plugin_biper_configs` (
`id` INT PRIMARY KEY AUTO_INCREMENT,
`name` varchar(255) collate utf8_unicode_ci default NULL,
`comment` TEXT collate utf8_unicode_ci default NULL,
`url` TEXT collate utf8_unicode_ci default NULL,
`username` varchar(255) collate utf8_unicode_ci default NULL,
`password` varchar(255) collate utf8_unicode_ci default NULL,
`authldaps_id` int(11) not null default '0',
`profiles_id` int(11) not null default '0',
`solutiontypes_id` int(11) not null default '0',
`is_active` tinyint(1) NOT NULL default '0',
`can_deactivate_users` tinyint(1) NOT NULL default '0',
`groups_id` int(11) NOT NULL default '0',
`locations_id` int(11) NOT NULL default '0',
`last_synchronization_date` DATE default NULL,
`default_phonenumber` varchar(255) collate utf8_unicode_ci default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
if($DB->query($sql)){
$webservice = new self();
$tmp['last_synchronization_date'] = "1970/01/01";
$tmp['default_phonenumber'] = "00000000";
$webservice->add($tmp);
return array('success' => true);
}else{
return array('success' => false,
'error' => __('Erreur à l\'installation de la table users_locations', 'biper')
. ' : ' . mysql_error());
}
} else {
$migration->addField("glpi_plugin_biper_configs", "default_phonenumber", "string",
array ('value' => '00000000'));
$migration->addField("glpi_plugin_biper_configs", "locations_id", "integer");
$migration->addField("glpi_plugin_biper_configs", "can_deactivate_users", "bool");
$migration->migrationOneTable("glpi_plugin_biper_configs");
return array('success' => true);
}
}
function getAdditionalFields() {
$fields = array(
array('name' => 'url',
'label' => __('URL Webservice BIPER', 'biper'),
'type' => 'text'),
array('name' => 'username',
'label' => __('Identifiant authentification BIPER', 'biper'),
'type' => 'text'),
array('name' => 'password',
'label' => __('Mot de passe authentification BIPER', 'biper'),
'type' => 'password'),
array('label' => __('Serveur LDAP d\'authenfication des utilisateurs', 'biper'),
'name' => 'authldaps_id',
'type' => 'dropdownValue'),
array('label' => __('Profil des utilisateurs', 'biper'),
'name' => 'profiles_id',
'type' => 'dropdownValue'),
array('label' => __('Groupe +Help', 'biper'),
'name' => 'groups_id',
'type' => 'dropdownValue'),
array('label' => __('Type de solution pour les tickets résolus', 'biper'),
'name' => 'solutiontypes_id',
'type' => 'dropdownValue'),
array('name' => 'default_phonenumber',
'label' => __('Numéro de téléphone par défaut', 'biper'),
'type' => 'text'),
array('label' => __('Lieu par défaut', 'biper'),
'name' => 'locations_id',
'type' => 'dropdownValue'),
array('name' => 'is_active',
'label' => __('Utilisateurs actifs par défaut', 'biper'),
'type' => 'bool'),
array('name' => 'can_deactivate_users',
'label' => __('Désactiver les utilisateurs qui n\'ont plus d\'informations dans Biper', 'biper'),
'type' => 'bool'));
return $fields;
}
function defineTabs($options=array()) {
$ong = array();
$ong['empty'] = $this->getTypeName(1);
$this->addStandardTab($this->getType(), $ong, $options);
return $ong;
}
function getTabNameForItem(CommonGLPI $item, $withtemplate=0) {
if (!$withtemplate) {
if ($item->getType() == $this->getType()) {
return PluginBiperWebserviceEntityMatching::getTypeName();
}
}
return '';
}
static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) {
if ($item->getType()==__CLASS__) {
PluginBiperWebserviceEntityMatching::showMatchings();
}
return true;
}
function displaySpecificTypeField($ID, $field=array()) {
switch ($field['type']) {
case 'echo_date' :
echo Html::convDateTime($this->fields['last_synchronization_date']);
break;
}
}
function pre_deleteItem() {
return false;
}
function displayMoreTabs($tab) {
switch ($tab) {
case -1:
case 2:
PluginBiperWebserviceEntityMatching::showMatchings();
break;
}
}
static function uninstall(Migration $migration) {
$migratin->dropTable(getTableForItemType(__CLASS__));
}
static function getPlusHelpGroup() {
$config = self::getConfiguration();
return $config->fields["groups_id"];
}
static function getSolutionType() {
$config = self::getConfiguration();
return $config->fields["solutiontypes_id"];
}
static function getURL() {
$config = self::getConfiguration();
return $config->fields["url"];
}
static function getUsername() {
$config = self::getConfiguration();
return $config->fields["username"];
}
static function getPassword() {
$config = self::getConfiguration();
return $config->fields["password"];
}
static function getIsUserActiveByDefault() {
$config = self::getConfiguration();
return $config->fields["is_active"];
}
static function getLdapServer() {
$config = self::getConfiguration();
return $config->fields["authldaps_id"];
}
static function getDefaultProfile() {
$config = self::getConfiguration();
return $config->fields["profiles_id"];
}
static function getDefaultLocation() {
$config = self::getConfiguration();
return $config->fields["locations_id"];
}
static function getDefaultPhoneNumber() {
$config = self::getConfiguration();
return $config->fields["default_phonenumber"];
}
static function getCanDeactivateUsers() {
$config = self::getConfiguration();
return $config->fields["can_deactivate_users"];
}
static function getConfiguration() {
$config = new self();
$config->getFromDB(1);
return $config;
}
}
quelqu'un a une idée pour m'aider? merci d'avance
Offline
Alors j'ai pu avancer un peu, j'ai trouvé que c'était cette instruction qui bloquait:
$_GET['id'] = 1;
du coup l'affichage principal se fait bien par contre je n'ai plus les autres onglets de la config ...?
Offline