Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

- Add type renaming

## [3.0.2 End-of-Life Updater] - 2025-11-20

- Secured, fixed, and enhanced the uninstall process
Expand Down
18 changes: 14 additions & 4 deletions front/migration_status.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,23 @@
// Check if user has admin rights
Session::checkRight('config', UPDATE);

/** @var array $CFG_GLPI */
/** @var DBmysql $DB */
global $DB;
global $CFG_GLPI, $DB;

// Handle rename POST action
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['type_id'], $_POST['new_name'])) {
$type_id = (int) $_POST['type_id'];
$new_name = (string) $_POST['new_name'];
PluginGenericobjectType::renameType($type_id, $new_name);
Html::redirect($CFG_GLPI['root_doc'] . '/plugins/genericobject/front/migration_status.php');
}

// Get all GenericObject types
$genericobject_types = [];
if ($DB->tableExists(PluginGenericobjectType::getTable())) {
$query = [
'SELECT' => ['itemtype', 'name'],
'SELECT' => ['id', 'name'],
'FROM' => PluginGenericobjectType::getTable(),
];
$request = $DB->request($query);
Expand Down Expand Up @@ -70,8 +79,9 @@

// Render the template content
TemplateRenderer::getInstance()->display('@genericobject/migration_status.html.twig', [
'genericobject_types' => $genericobject_types,
'customassets' => $customassets,
'genericobject_types' => $genericobject_types,
'customassets' => $customassets,
'reserved_names' => array_map('strtolower', PluginGenericobjectType::getReservedNames()),
]);

// Display GLPI footer
Expand Down
Loading