spacing and report save errors

This commit is contained in:
Isaac Connor 2021-11-17 17:45:38 -05:00
parent 96b4af6255
commit c37d8eeded
1 changed files with 11 additions and 8 deletions

View File

@ -28,14 +28,17 @@ if ( $action == 'save' ) {
foreach ($_REQUEST['mids'] as $mid) { foreach ($_REQUEST['mids'] as $mid) {
$mid = ValidInt($mid); $mid = ValidInt($mid);
if (!canEdit('Monitors', $mid)) { if (!canEdit('Monitors', $mid)) {
ZM\Warning("Cannot edit monitor $mid"); ZM\Warning('Cannot edit monitor '.$mid);
continue; continue;
} }
$Monitor = new ZM\Monitor($mid); $Monitor = new ZM\Monitor($mid);
if ($Monitor->Type() != 'WebSite') { if ($Monitor->Type() != 'WebSite') {
$Monitor->zmcControl('stop'); $Monitor->zmcControl('stop');
} }
$Monitor->save($_REQUEST['newMonitor']); if (!$Monitor->save($_REQUEST['newMonitor'])) {
global $error_message;
$error_message .= 'Error saving monitor: ' . $Monitor->get_last_error().'<br/>';
}
if ($Monitor->Function() != 'None' && $Monitor->Type() != 'WebSite') { if ($Monitor->Function() != 'None' && $Monitor->Type() != 'WebSite') {
$Monitor->zmcControl('start'); $Monitor->zmcControl('start');
} }