diff --git a/assetclass.php b/assetclass.php index ababa8e..b7e8ff0 100644 --- a/assetclass.php +++ b/assetclass.php @@ -60,6 +60,13 @@ switch ($submit = form_get_action()) { break; case 'delete': + $sth = $dbh->prepare("SELECT COUNT(*) FROM asset WHERE assetclass_id=?"); + $sth->execute([$id]); + if ($sth->fetchColumn() > 0) { + $g_warning->Add("Objektklasse kann nicht gelöscht werden, da noch zugeordnete Objekte vorhanden sind."); + $action = ACT_VIEW; + break; + } $sth = $dbh->prepare("DELETE FROM assetclass WHERE assetclass_id=?"); try { $sth->execute([$id]); diff --git a/assetclassgroup.php b/assetclassgroup.php index cd2602b..87e8c49 100644 --- a/assetclassgroup.php +++ b/assetclassgroup.php @@ -59,6 +59,13 @@ switch ($submit = form_get_action()) { break; case 'delete': + $sth = $dbh->prepare("SELECT COUNT(*) FROM assetclass WHERE assetclassgroup_id=?"); + $sth->execute([$id]); + if ($sth->fetchColumn() > 0) { + $g_warning->Add("Objektklassengruppe kann nicht gelöscht werden, da noch zugeordnete Objektklassen vorhanden sind."); + $action = ACT_VIEW; + break; + } $sth = $dbh->prepare("DELETE FROM assetclassgroup WHERE assetclassgroup_id=?"); try { $sth->execute([$id]); diff --git a/location.php b/location.php index 6ab2f83..87008a7 100644 --- a/location.php +++ b/location.php @@ -118,7 +118,14 @@ switch ($submit = form_get_action()) { break; case 'delete': + $sth = $dbh->prepare("DELETE FROM subnetlocation WHERE location_id=?"); + $sth->execute([$id]); + $n = $sth->rowCount(); + if ($n > 0) { + $g_message->Add("$n Subnetzzuordnungen wurden entfernt."); + } $sth = $dbh->prepare("DELETE FROM location WHERE location_id=?"); + $g_message->Add("Standort wurde gelöscht."); $sth->execute([$id]); $action = ACT_DEFAULT; break; diff --git a/tpl/style.css b/tpl/style.css index 7169cdc..1b821f7 100644 --- a/tpl/style.css +++ b/tpl/style.css @@ -210,7 +210,7 @@ div.error, div.warning, div.info, div.note { margin: 1em 0 0 0; border-radius: 12px; width: 750px; - animation: fadeout 10s 2s forwards; + animation: fadeout 2s 10s forwards; } div.error { border: 1px solid #8b0000; diff --git a/tpl/vlanview.tpl b/tpl/vlanview.tpl index cd1faf3..1f14c7f 100644 --- a/tpl/vlanview.tpl +++ b/tpl/vlanview.tpl @@ -79,7 +79,7 @@ {foreach item=subnet from=$subnets} - {$subnet.subnet_address}/{$subnet.subnet_mask} + {$subnet.subnet_address}/{$subnet.subnet_mask} {$subnet.subnet_info}
{/foreach} diff --git a/vlan.php b/vlan.php index daa5c88..4c20596 100644 --- a/vlan.php +++ b/vlan.php @@ -88,6 +88,12 @@ switch ($submit = form_get_action()) { break; case 'delete': + $sth = $dbh->prepare("DELETE FROM subnetvlan WHERE vlan_id=?"); + $sth->execute([$id]); + $n = $sth->rowCount(); + if ($n > 0) { + $g_message->Add("$n vlan to subnet references were removed."); + } $sth = $dbh->prepare("DELETE FROM vlan WHERE vlan_id=?"); $sth->execute([$id]); $g_message->Add(_("VLAN deleted.")); diff --git a/zone.php b/zone.php index 01e4503..1a597b8 100644 --- a/zone.php +++ b/zone.php @@ -83,6 +83,13 @@ switch ($submit = form_get_action()) { break; case 'delete': + $sth = $dbh->prepare("SELECT COUNT(*) FROM node WHERE zone_id=?"); + $sth->execute([$id]); + if ($sth->fetchColumn() > 0) { + $g_warning->Add("Zone can not be removed. There are node-references."); + $action = ACT_VIEW; + break; + } $sth = $dbh->prepare("DELETE FROM zone WHERE zone_id=?"); $sth->execute([$id]); $g_message->Add(_("Deleted zone"));