Checks before removing objects

This commit is contained in:
2023-03-10 20:03:21 +01:00
parent 8c61638485
commit 02980bbad5
7 changed files with 36 additions and 2 deletions

View File

@@ -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."));