function plugin_manufacturersimports_install() { global $DB; include_once GLPI_ROOT . "/plugins/manufacturersimports/inc/profile.class.php"; $update = false; if (!TableExists("glpi_plugin_suppliertag_profiles") && !TableExists("glpi_plugin_manufacturersimports_profiles")) { $DB->runFile(GLPI_ROOT . "/plugins/manufacturersimports/sql/empty-1.5.0.sql"); } else { if (TableExists("glpi_plugin_suppliertag_config") && !FieldExists("glpi_plugin_suppliertag_config", "FK_entities")) { $update = true; $DB->runFile(GLPI_ROOT . "/plugins/manufacturersimports/sql/update-1.1.sql"); $DB->runFile(GLPI_ROOT . "/plugins/manufacturersimports/sql/update-1.2.0.sql"); $DB->runFile(GLPI_ROOT . "/plugins/manufacturersimports/sql/update-1.3.0.sql"); $DB->runFile(GLPI_ROOT . "/plugins/manufacturersimports/sql/update-1.4.1.sql"); $DB->runFile(GLPI_ROOT . "/plugins/manufacturersimports/sql/update-1.5.0.sql"); } else { if (TableExists("glpi_plugin_suppliertag_profiles") && FieldExists("glpi_plugin_suppliertag_profiles", "interface")) { $update = true; $DB->runFile(GLPI_ROOT . "/plugins/manufacturersimports/sql/update-1.2.0.sql"); $DB->runFile(GLPI_ROOT . "/plugins/manufacturersimports/sql/update-1.3.0.sql"); $DB->runFile(GLPI_ROOT . "/plugins/manufacturersimports/sql/update-1.4.1.sql"); $DB->runFile(GLPI_ROOT . "/plugins/manufacturersimports/sql/update-1.5.0.sql"); } else { if (!TableExists("glpi_plugin_manufacturersimports_profiles")) { $update = true; $DB->runFile(GLPI_ROOT . "/plugins/manufacturersimports/sql/update-1.3.0.sql"); $DB->runFile(GLPI_ROOT . "/plugins/manufacturersimports/sql/update-1.4.1.sql"); $DB->runFile(GLPI_ROOT . "/plugins/manufacturersimports/sql/update-1.5.0.sql"); } } } } $query = "UPDATE `glpi_plugin_manufacturersimports_configs` \n SET `Supplier_url` = 'http://www.dell.com/support/troubleshooting/us/en/04/Index?c=us&l=en&s=bsd&cs=04&t=system&ServiceTag=' \n WHERE `name` ='Dell'"; $DB->query($query); if ($update) { $query_ = "SELECT *\n FROM `glpi_plugin_manufacturersimports_profiles` "; $result_ = $DB->query($query_); if ($DB->numrows($result_) > 0) { while ($data = $DB->fetch_array($result_)) { $query = "UPDATE `glpi_plugin_manufacturersimports_profiles`\n SET `profiles_id` = '" . $data["id"] . "'\n WHERE `id` = '" . $data["id"] . "';"; $result = $DB->query($query); } } $query = "ALTER TABLE `glpi_plugin_manufacturersimports_profiles`\n DROP `name` ;"; $result = $DB->query($query); Plugin::migrateItemType(array(2150 => 'PluginManufacturersimportsModel', 2151 => 'PluginManufacturersimportsConfig'), array("glpi_bookmarks", "glpi_bookmarks_users", "glpi_displaypreferences", "glpi_documents_items", "glpi_infocoms", "glpi_logs", "glpi_tickets"), array("glpi_plugin_manufacturersimports_models", "glpi_plugin_manufacturersimports_logs")); } PluginManufacturersimportsProfile::createFirstAccess($_SESSION['glpiactiveprofile']['id']); return true; }
function plugin_manufacturersimports_uninstall() { global $DB; include_once GLPI_ROOT . "/plugins/manufacturersimports/inc/profile.class.php"; include_once GLPI_ROOT . "/plugins/manufacturersimports/inc/menu.class.php"; $migration = new Migration("1.7.0"); $tables = array("glpi_plugin_manufacturersimports_configs", "glpi_plugin_manufacturersimports_models", "glpi_plugin_manufacturersimports_logs"); foreach ($tables as $table) { $migration->dropTable($table); } //old versions $tables = array("glpi_plugin_suppliertag_config", "glpi_plugin_suppliertag_profiles", "glpi_plugin_suppliertag_models", "glpi_plugin_suppliertag_imported"); foreach ($tables as $table) { $migration->dropTable($table); } $profileRight = new ProfileRight(); foreach (PluginManufacturersimportsProfile::getAllRights() as $right) { $profileRight->deleteByCriteria(array('name' => $right['field'])); } //Remove rigth from $_SESSION['glpiactiveprofile'] if exists PluginManufacturersimportsProfile::removeRightsFromSession(); //Remove entries in GLPI's menu and breadcrumb PluginManufacturersimportsMenu::removeRightsFromSession(); return true; }
Copyright (C) 2003-2011 by the Manufacturersimports Development Team. https://forge.indepnet.net/projects/manufacturersimports ------------------------------------------------------------------------- LICENSE This file is part of Manufacturersimports. Manufacturersimports 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. Manufacturersimports 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 Manufacturersimports. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ include '../../../inc/includes.php'; Session::checkRight("profile", "r"); $prof = new PluginManufacturersimportsProfile(); //Save profile if (isset($_POST['update'])) { $prof->update($_POST); Html::back(); }