Checks before removing objects
This commit is contained in:
7
zone.php
7
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"));
|
||||
|
||||
Reference in New Issue
Block a user