function plugin_geninventorynumber_uninstall() { $migration = new Migration("0.85+1.0"); include_once GLPI_ROOT . '/plugins/geninventorynumber/inc/config.class.php'; include_once GLPI_ROOT . '/plugins/geninventorynumber/inc/profile.class.php'; include_once GLPI_ROOT . '/plugins/geninventorynumber/inc/configfield.class.php'; PluginGeninventorynumberConfig::uninstall($migration); PluginGeninventorynumberProfile::removeRightsFromSession(); PluginGeninventorynumberProfile::uninstallProfile(); PluginGeninventorynumberConfigField::uninstall($migration); return true; }
static function preItemUpdate(CommonDBTM $item) { if (!Session::haveRight("plugin_geninventorynumber", UPDATE)) { return array('noright'); } if (PluginGeninventorynumberConfig::isGenerationActive() && PluginGeninventorynumberConfigField::isActiveForItemType(get_class($item)) && !isset($item->input['massiveaction'])) { if (isset($item->fields['otherserial']) && isset($item->input['otherserial']) && $item->fields['otherserial'] != $item->input['otherserial']) { $item->input['otherserial'] = $item->fields['otherserial']; if (!isCommandLine()) { Session::addMessageAfterRedirect(__('GenerateInventoryNumberDenied', 'geninventorynumber'), true, ERROR); return array('ko'); } } return array('ok'); } return ''; }
static function showForConfig($id) { global $CFG_GLPI, $DB; $config = new PluginGeninventorynumberConfig(); $config->getFromDB($id); $target = Toolbox::getItemTypeFormUrl(__CLASS__); echo "<form name='form_core_config' method='post' action=\"{$target}\">"; echo "<div align='center'>"; echo "<table class='tab_cadre_fixe'>"; echo "<tr><th colspan='5'>" . __('PerDeviceTypeConfiguration', 'geninventorynumber') . "</th></tr>"; echo "<input type='hidden' name='id' value='{$id}'>"; echo "<input type='hidden' name='entities_id' value='0'>"; echo "<tr><th colspan='2'>" . __('GenerationModel', 'geninventorynumber'); echo "</th><th>" . __('Active') . "</th>"; echo "<th>" . __('UseGlobalIndex', 'geninventorynumber') . "</th>"; echo "<th colspan='2'>" . __('IndexPosition', 'geninventorynumber') . "</th></tr>"; foreach (getAllDatasFromTable(getTableForItemType(__CLASS__)) as $value) { $itemtype = $value['itemtype']; echo "<td class='tab_bg_1' align='center'>" . call_user_func(array($itemtype, 'getTypeName')) . "</td>"; echo "<td class='tab_bg_1'>"; echo "<input type='hidden' name='ids[{$itemtype}][id]' value='" . $value["id"] . "'>"; echo "<input type='hidden' name='ids[{$itemtype}][itemtype]' value='{$itemtype}'>"; echo "<input type='text' name='ids[{$itemtype}][template]' value=\"" . $value["template"] . "\">"; echo "</td>"; echo "<td class='tab_bg_1' align='center'>"; Dropdown::showYesNo("ids[{$itemtype}][is_active]", $value["is_active"]); echo "</td>"; echo "<td class='tab_bg_1' align='center'>"; Dropdown::showYesNo("ids[{$itemtype}][use_index]", $value["use_index"]); echo "</td>"; echo "<td class='tab_bg_1' align='center'>"; if ($value["is_active"] && !$value["use_index"]) { echo "<input type='text' name='ids[{$itemtype}][index]' value='" . $value['index'] . "' size='12'>"; } echo "</td>"; echo "</tr>"; } echo "<tr class='tab_bg_1'><td align='center' colspan='5'>"; echo "<input type='submit' name='update_fields' value=\"" . _sx('button', 'Save') . "\" class='submit'>"; echo "</td></tr>"; echo "</table>"; Html::closeForm(); }
Copyright (C) 2003-2011 by the geninventorynumber Development Team. This file is part of the geninventorynumber plugin. geninventorynumber 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. geninventorynumber 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. This file is part of geninventorynumber plugin. You should have received a copy of the GNU General Public License along with GLPI; along with geninventorynumber. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- @package geninventorynumber @author the geninventorynumber plugin team @copyright Copyright (c) 2008-2013 geninventorynumber plugin team @license GPLv2+ http://www.gnu.org/licenses/gpl.txt @link https://forge.indepnet.net/projects/geninventorynumber @link http://www.glpi-project.org/ @since 2008 ---------------------------------------------------------------------- */ include '../../../inc/includes.php'; $config = new PluginGeninventorynumberConfig(); if (isset($_POST['update'])) { $config->update($_POST); Html::back(); }
geninventorynumber 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. This file is part of geninventorynumber plugin. You should have received a copy of the GNU General Public License along with GLPI; along with geninventorynumber. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- @package geninventorynumber @author the geninventorynumber plugin team @copyright Copyright (c) 2008-2013 geninventorynumber plugin team @license GPLv2+ http://www.gnu.org/licenses/gpl.txt @link https://forge.indepnet.net/projects/geninventorynumber @link http://www.glpi-project.org/ @since 2008 ---------------------------------------------------------------------- */ include '../../../inc/includes.php'; $config = new PluginGeninventorynumberConfig(); $plugin = new Plugin(); $config->getFromDB(1); if ($plugin->isInstalled("geninventorynumber") && $plugin->isActivated("geninventorynumber")) { Html::header(__('geninventorynumber', 'geninventorynumber'), $_SERVER['PHP_SELF'], "tools", "plugins", "geninventorynumber"); if (isset($_GET['glpi_tab'])) { $_SESSION['glpi_tabs']['plugingeninventorynumberconfig'] = $_GET['glpi_tab']; Html::redirect(Toolbox::getItemTypeFormURL($config->getType())); } $config->addDivForTabs(); Html::footer(); }