Exemple #1
0
function plugin_immobilizationsheets_install()
{
    global $DB;
    include_once GLPI_ROOT . "/plugins/immobilizationsheets/inc/profile.class.php";
    $update = false;
    if (!TableExists("glpi_plugin_immo_profiles") && !TableExists("glpi_plugin_immobilizationsheets_profiles")) {
        $DB->runFile(GLPI_ROOT . "/plugins/immobilizationsheets/sql/empty-1.3.0.sql");
    } else {
        if (TableExists("glpi_plugin_immo_profiles") && FieldExists("glpi_plugin_immo_profiles", "interface")) {
            $update = true;
            $DB->runFile(GLPI_ROOT . "/plugins/immobilizationsheets/sql/update-1.2.0.sql");
            $DB->runFile(GLPI_ROOT . "/plugins/immobilizationsheets/sql/update-1.3.0.sql");
        } else {
            if (!TableExists("glpi_plugin_immobilizationsheets_profiles")) {
                $update = true;
                $DB->runFile(GLPI_ROOT . "/plugins/immobilizationsheets/sql/update-1.3.0.sql");
            }
        }
    }
    if ($update) {
        //Do One time on 0.78
        $query_ = "SELECT *\n            FROM `glpi_plugin_immobilizationsheets_profiles` ";
        $result_ = $DB->query($query_);
        if ($DB->numrows($result_) > 0) {
            while ($data = $DB->fetch_array($result_)) {
                $query = "UPDATE `glpi_plugin_immobilizationsheets_profiles`\n                  SET `profiles_id` = '" . $data["id"] . "'\n                  WHERE `id` = '" . $data["id"] . "';";
                $result = $DB->query($query);
            }
        }
        $query = "ALTER TABLE `glpi_plugin_immobilizationsheets_profiles`\n               DROP `name` ;";
        $result = $DB->query($query);
    }
    PluginImmobilizationsheetsProfile::createFirstAccess($_SESSION['glpiactiveprofile']['id']);
    return true;
}
Exemple #2
0
Copyright (C) 2003-2011 by the Immobilizationsheets Development Team.

https://forge.indepnet.net/projects/immobilizationsheets
-------------------------------------------------------------------------

LICENSE
		
This file is part of Immobilizationsheets.

Immobilizationsheets 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.

Immobilizationsheets 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 Immobilizationsheets. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
Session::checkRight("profile", "r");
$prof = new PluginImmobilizationsheetsProfile();
//Save profile
if (isset($_POST['update'])) {
    $prof->update($_POST);
    Html::back();
}