-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathother.class.php
More file actions
84 lines (70 loc) · 3.06 KB
/
other.class.php
File metadata and controls
84 lines (70 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/**
* -------------------------------------------------------------------------
* Order plugin for GLPI
* -------------------------------------------------------------------------
*
* LICENSE
*
* This file is part of Order.
*
* Order 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 3 of the License, or
* (at your option) any later version.
*
* Order 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 Order. If not, see <http://www.gnu.org/licenses/>.
* -------------------------------------------------------------------------
* @copyright Copyright (C) 2009-2023 by Order plugin team.
* @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
* @link https://github.com/pluginsGLPI/order
* -------------------------------------------------------------------------
*/
class PluginOrderOther extends CommonDBTM
{
public static $rightname = 'plugin_order_order';
public static function getTypeName($nb = 0)
{
return __("Other kind of items", 'order');
}
public static function install(Migration $migration)
{
/** @var DBmysql $DB */
global $DB;
$default_charset = DBConnection::getDefaultCharset();
$default_collation = DBConnection::getDefaultCollation();
$default_key_sign = DBConnection::getDefaultPrimaryKeySignOption();
//Only avaiable since 1.2.0
$table = self::getTable();
if (!$DB->tableExists($table)) {
$migration->displayMessage('Installing ' . $table);
$query = "CREATE TABLE IF NOT EXISTS `glpi_plugin_order_others` (
`id` int {$default_key_sign} NOT NULL auto_increment,
`entities_id` int {$default_key_sign} NOT NULL default '0',
`name` varchar(255) default NULL,
`plugin_order_othertypes_id` int {$default_key_sign} NOT NULL default '0',
PRIMARY KEY (`ID`),
KEY `name` (`name`),
KEY `entities_id` (`entities_id`),
KEY `plugin_order_othertypes_id` (`plugin_order_othertypes_id`)
) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;";
$DB->doQuery($query);
} else {
$migration->displayMessage("Rename 'othertypes_id' to 'plugin_order_othertypes_id'");
$migration->changeField($table, "othertypes_id", "plugin_order_othertypes_id", sprintf("int %s NOT NULL default '0'", $default_key_sign));
}
}
public static function uninstall()
{
/** @var DBmysql $DB */
global $DB;
//Current table name
$DB->doQuery("DROP TABLE IF EXISTS `" . self::getTable() . "`");
}
}