diff --git a/src/AssetTab.php b/src/AssetTab.php
index c6bf0b7..5446b11 100644
--- a/src/AssetTab.php
+++ b/src/AssetTab.php
@@ -147,6 +147,24 @@ class AssetTab extends CommonDBTM
echo "
";
echo " ";
echo htmlspecialchars(__('No UrBackup server available for the root location of this asset.', 'urbackup'));
+ if (Session::isDebugActive()) {
+ $loc_id = LocationHelper::getAssetLocationId($item);
+ $root_id = LocationHelper::getRootLocationIdForAsset($item);
+ echo " ";
+ echo "Asset locations_id: " . htmlspecialchars((string) $loc_id);
+ echo " | Root location ID: " . htmlspecialchars((string) $root_id);
+ echo " | glpi_plugin_urbackup_servers with this root ID + is_active=1: ";
+ global $DB;
+ $count = $DB->request([
+ 'FROM' => Server::getTable(),
+ 'WHERE' => [
+ 'locations_id' => $root_id,
+ 'is_active' => 1,
+ ],
+ ]);
+ echo htmlspecialchars((string) count($count));
+ echo "";
+ }
echo " ";
echo " | ";
echo "";
diff --git a/src/Server.php b/src/Server.php
index f57fafc..ebd3375 100644
--- a/src/Server.php
+++ b/src/Server.php
@@ -350,7 +350,10 @@ class Server extends CommonDBTM
echo "" . htmlspecialchars(__('Active')) . " | ";
echo "";
- Dropdown::showYesNo('is_active', (int) ($this->fields['is_active'] ?? 1));
+ Dropdown::showYesNo(
+ 'is_active',
+ ($ID !== null && $ID > 0) ? (int) ($this->fields['is_active'] ?? 1) : 1
+ );
echo " | ";
echo "";