示例#1
0
 Order 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.

 Order 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 Order. If not, see <http://www.gnu.org/licenses/>.
 --------------------------------------------------------------------------
 @package   order
 @author    the order plugin team
 @copyright Copyright (c) 2010-2011 Order plugin team
 @license   GPLv2+
            http://www.gnu.org/licenses/gpl.txt
 @link      https://forge.indepnet.net/projects/order
 @link      http://www.glpi-project.org/
 @since     2009
 ---------------------------------------------------------------------- */
include "../../../inc/includes.php";
Session::checkRight("profile", "r");
$prof = new PluginOrderProfile();
//Save profile
if (isset($_POST['update'])) {
    $prof->update($_POST);
    Html::redirect($_SERVER['HTTP_REFERER']);
}
示例#2
0
 static function install(Migration $migration)
 {
     global $DB;
     $table = getTableForItemType(__CLASS__);
     if (!TableExists($table)) {
         $migration->displayMessage("Installing {$table}");
         $query = "CREATE TABLE `glpi_plugin_order_profiles` (\n               `id` int(11) NOT NULL auto_increment,\n               `profiles_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_profiles (id)',\n               `order` char(1) collate utf8_unicode_ci default NULL,\n               `reference` char(1) collate utf8_unicode_ci default NULL,\n               `validation` char(1) collate utf8_unicode_ci default NULL,\n               `cancel` char(1) collate utf8_unicode_ci default NULL,\n               `undo_validation` char(1) collate utf8_unicode_ci default NULL,\n               `bill` char(1) collate utf8_unicode_ci default NULL,\n               `delivery` char(1) collate utf8_unicode_ci default NULL,\n               `generate_order_odt` char(1) collate utf8_unicode_ci default NULL,\n               `open_ticket` char(1) default NULL,\n               PRIMARY KEY  (`id`),\n               KEY `profiles_id` (`profiles_id`)\n            ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
         $DB->query($query) or die($DB->error());
         PluginOrderProfile::createFirstAccess($_SESSION['glpiactiveprofile']['id']);
     } else {
         $migration->displayMessage("Upgrading {$table}");
         //1.2.0
         $migration->changeField($table, "ID", "id", "int(11) NOT NULL auto_increment");
         foreach (array('order', 'reference', 'budget', 'validation', 'cancel', 'undo_validation') as $right) {
             $migration->changeField($table, $right, $right, "char(1) collate utf8_unicode_ci default NULL");
         }
         $migration->migrationOneTable($table);
         if ($migration->addField($table, "profiles_id", "int(11) NOT NULL default '0'")) {
             $migration->addKey($table, "profiles_id");
             $migration->migrationOneTable($table);
             //Migration profiles
             $DB->query("UPDATE `{$table}` SET `profiles_id`=`id`");
         }
         //1.4.0
         $migration->dropField($table, "budget");
         $migration->dropField($table, "name");
         $migration->migrationOneTable($table);
         //1.5.0
         $migration->addField($table, "bill", "char");
         $migration->migrationOneTable($table);
         self::addRightToProfile($_SESSION['glpiactiveprofile']['id'], "bill", "w");
         //1.5.3
         //Add delivery right
         if ($migration->addField($table, "delivery", "char")) {
             $migration->migrationOneTable($table);
             //Update profiles : copy order right not to change current behavior
             $update = "UPDATE `{$table}` SET `delivery`=`order`";
             $DB->query($update);
             self::addRightToProfile($_SESSION['glpiactiveprofile']['id'], "delivery", "w");
         }
         if ($migration->addField($table, "generate_order_odt", "char")) {
             $migration->migrationOneTable($table);
             //Update profiles : copy order right not to change current behavior
             $update = "UPDATE `{$table}` SET `generate_order_odt`=`order`";
             $DB->query($update);
             self::addRightToProfile($_SESSION['glpiactiveprofile']['id'], "generate_order_odt", "w");
         }
     }
     //1.7.2
     $migration->addField($table, "open_ticket", "char");
     $migration->migrationOneTable($table);
     self::addRightToProfile($_SESSION['glpiactiveprofile']['id'], "open_ticket", "w");
     self::changeProfile();
 }