From f5dfa0d7403aa10bbfbb5f3feaa2df056d16c060 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 20 Mar 2019 15:03:20 -0400 Subject: [PATCH] Spacing and fix clone monitor by setting the Id to 0 instead of nextId, so that when we go to save it, we use an insert instead of an update --- web/skins/classic/views/monitor.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/web/skins/classic/views/monitor.php b/web/skins/classic/views/monitor.php index 9adeb0283..c0bb8a8d1 100644 --- a/web/skins/classic/views/monitor.php +++ b/web/skins/classic/views/monitor.php @@ -21,36 +21,36 @@ require_once('includes/Server.php'); require_once('includes/Storage.php'); -if ( !canView( 'Monitors' ) ) { +if ( !canView('Monitors') ) { $view = 'error'; return; } $Server = null; -if ( defined( 'ZM_SERVER_ID' ) ) { - $Server = dbFetchOne( 'SELECT * FROM Servers WHERE Id=?', NULL, array( ZM_SERVER_ID ) ); +if ( defined('ZM_SERVER_ID') ) { + $Server = dbFetchOne('SELECT * FROM Servers WHERE Id=?', NULL, array(ZM_SERVER_ID)); } -if ( ! $Server ) { - $Server = array( 'Id' => '' ); +if ( !$Server ) { + $Server = array('Id' => ''); } $monitor = null; if ( ! empty($_REQUEST['mid']) ) { $monitor = new ZM\Monitor( $_REQUEST['mid'] ); if ( $monitor and ZM_OPT_X10 ) - $x10Monitor = dbFetchOne( 'SELECT * FROM TriggersX10 WHERE MonitorId = ?', NULL, array($_REQUEST['mid']) ); + $x10Monitor = dbFetchOne('SELECT * FROM TriggersX10 WHERE MonitorId = ?', NULL, array($_REQUEST['mid'])); } if ( ! $monitor ) { - $nextId = getTableAutoInc( 'Monitors' ); - if ( isset( $_REQUEST['dupId'] ) ) { - $monitor = new ZM\Monitor( $_REQUEST['dupId'] ); + $nextId = getTableAutoInc('Monitors'); + if ( isset($_REQUEST['dupId']) ) { + $monitor = new ZM\Monitor($_REQUEST['dupId']); $monitor->GroupIds(); // have to load before we change the Id if ( ZM_OPT_X10 ) - $x10Monitor = dbFetchOne( 'SELECT * FROM TriggersX10 WHERE MonitorId = ?', NULL, array($_REQUEST['dupId']) ); + $x10Monitor = dbFetchOne('SELECT * FROM TriggersX10 WHERE MonitorId = ?', NULL, array($_REQUEST['dupId'])); $clonedName = $monitor->Name(); - $monitor->Name( translate('Monitor').'-'.$nextId ); - $monitor->Id( $nextId ); + $monitor->Name(translate('Monitor').'-'.$nextId); + $monitor->Id(0); } else { $monitor = new ZM\Monitor(); $monitor->set( array(