From 3858a6f605a2e5e51892100075d8143e2fb1f89e Mon Sep 17 00:00:00 2001 From: RomainLvr Date: Wed, 8 Apr 2026 10:09:38 +0200 Subject: [PATCH 1/3] Fix - Asset_PeripheralAsset column names for GLPI 11 --- inc/replace.class.php | 5 ++--- inc/uninstall.class.php | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/inc/replace.class.php b/inc/replace.class.php index d81d363..6637123 100644 --- a/inc/replace.class.php +++ b/inc/replace.class.php @@ -451,9 +451,8 @@ public static function replace($type, $model_id, $tab_ids, $location) foreach (self::getAssociatedItems($olditem) as $itemtype => $connections) { foreach ($connections as $connection) { $comp_item->update( - ['id' => $connection['id'], - 'computers_id' => $newitem_id, - 'itemtype' => $itemtype, + ['id' => $connection['id'], + 'items_id_asset' => $newitem_id, ], false, ); diff --git a/inc/uninstall.class.php b/inc/uninstall.class.php index cac884c..6ff8ee9 100644 --- a/inc/uninstall.class.php +++ b/inc/uninstall.class.php @@ -164,8 +164,8 @@ private static function doOneUninstall(PluginUninstallModel $model, Transfer $tr //------------------// if (in_array($type, $UNINSTALL_DIRECT_CONNECTIONS_TYPE)) { $conn = new Asset_PeripheralAsset(); - $conn->deleteByCriteria(['itemtype' => $type, - 'items_id' => $id, + $conn->deleteByCriteria(['itemtype_peripheral' => $type, + 'items_id_peripheral' => $id, ], true); } From bd702e0e18fef86ea3a772fc772b5d3bd3ea66e7 Mon Sep 17 00:00:00 2001 From: RomainLvr Date: Wed, 8 Apr 2026 10:13:30 +0200 Subject: [PATCH 2/3] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab27e6d..9722a6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed +- Fix SQL errors when uninstalling or replacing peripheral assets - Fix locales encoding ## [2.10.3] - 2025-11-25 From 425bd6bf4006fa651240305ae31b8013c0fa3fda Mon Sep 17 00:00:00 2001 From: RomainLvr Date: Wed, 8 Apr 2026 11:19:02 +0200 Subject: [PATCH 3/3] Fix Rector --- inc/replace.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/replace.class.php b/inc/replace.class.php index 6637123..0c495e3 100644 --- a/inc/replace.class.php +++ b/inc/replace.class.php @@ -448,7 +448,7 @@ public static function replace($type, $model_id, $tab_ids, $location) ) { #do not update computer_item if no computer $comp_item = new Asset_PeripheralAsset(); if ($olditem instanceof Computer) { - foreach (self::getAssociatedItems($olditem) as $itemtype => $connections) { + foreach (self::getAssociatedItems($olditem) as $connections) { foreach ($connections as $connection) { $comp_item->update( ['id' => $connection['id'],