Skip to content

Commit

Permalink
Remove useless entities_id field; fixes #32
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-anne committed Feb 2, 2022
1 parent 960b8ad commit d939289
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 3 additions & 3 deletions inc/config.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ static function install(Migration $migration) {
$sql = "CREATE TABLE IF NOT EXISTS `$table` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) COLLATE utf8_unicode_ci DEFAULT '',
`entities_id` int(11) NOT NULL default '-1',
`is_active` tinyint(1) NOT NULL default 0,
`index` int(11) NOT NULL default 0,
`comment` text COLLATE utf8_unicode_ci,
Expand All @@ -205,22 +204,23 @@ static function install(Migration $migration) {
$tmp['id'] = 1;
$tmp['name'] = 'otherserial';
$tmp['is_active'] = 1;
$tmp['entities_id'] = 0;
$tmp['index'] = 0;
$config = new self();
$config->add($tmp);
} else {
$migration->addField($table, 'name', 'string', ['value' => 'otherserial']);
$migration->addField($table, 'field', 'string', ['value' => 'otherserial']);
$migration->changeField($table, 'ID', 'id', 'autoincrement');
$migration->changeField($table, 'FK_entities', 'entities_id', 'integer', ['value' => -1]);
$migration->changeField($table, 'active', 'is_active', 'bool');
if (!$migration->addField($table, 'comment', 'text')) {
$migration->changeField($table, 'comments', 'comment', 'text');
}
$migration->changeField($table, 'is_active', 'is_active', 'bool');
$migration->changeField($table, 'next_number', 'index', 'integer');
$migration->dropField($table, 'field');

$migration->dropField($table, 'FK_entities');
$migration->dropField($table, 'entities_id');
}

//Remove unused table
Expand Down
1 change: 0 additions & 1 deletion inc/configfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ static function showForConfig($id) {
echo "<tr><th colspan='5'>" . __('GLPI\'s inventory items configuration', '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'>" . __('Generation templates', 'geninventorynumber');
echo "</th><th>" . __('Active') . "</th>";
Expand Down

0 comments on commit d939289

Please sign in to comment.