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 diff --git a/inc/replace.class.php b/inc/replace.class.php index d81d363..0c495e3 100644 --- a/inc/replace.class.php +++ b/inc/replace.class.php @@ -448,12 +448,11 @@ 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'], - '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); }