Update GroupIds regardless of changes returned from getFormChanges on Monitor save

This commit is contained in:
Isaac Connor 2018-04-25 09:32:15 -04:00
parent 2a81877664
commit 5f415873d4
1 changed files with 6 additions and 6 deletions

View File

@ -458,7 +458,7 @@ if ( canEdit( 'Monitors' ) ) {
$x10Monitor = array(); $x10Monitor = array();
} }
} }
$Monitor = new Monitor( $monitor ); $Monitor = new Monitor($monitor);
// Define a field type for anything that's not simple text equivalent // Define a field type for anything that's not simple text equivalent
$types = array( $types = array(
@ -475,7 +475,7 @@ if ( canEdit( 'Monitors' ) ) {
if ( $_REQUEST['newMonitor']['ServerId'] == 'auto' ) { if ( $_REQUEST['newMonitor']['ServerId'] == 'auto' ) {
Logger::Debug("Auto selecting server"); Logger::Debug("Auto selecting server");
$_REQUEST['newMonitor']['ServerId'] = dbFetchOne( 'SELECT Id FROM Servers WHERE Status=\'Running\' ORDER BY FreeMem DESC, CpuLoad ASC LIMIT 1', 'Id' ); $_REQUEST['newMonitor']['ServerId'] = dbFetchOne('SELECT Id FROM Servers WHERE Status=\'Running\' ORDER BY FreeMem DESC, CpuLoad ASC LIMIT 1', 'Id');
Logger::Debug("Auto selecting server: Got " . $_REQUEST['newMonitor']['ServerId'] ); Logger::Debug("Auto selecting server: Got " . $_REQUEST['newMonitor']['ServerId'] );
if ( ( ! $_REQUEST['newMonitor'] ) and defined('ZM_SERVER_ID') ) { if ( ( ! $_REQUEST['newMonitor'] ) and defined('ZM_SERVER_ID') ) {
$_REQUEST['newMonitor']['ServerId'] = ZM_SERVER_ID; $_REQUEST['newMonitor']['ServerId'] = ZM_SERVER_ID;
@ -485,8 +485,8 @@ if ( canEdit( 'Monitors' ) ) {
Logger::Debug("NOT Auto selecting server" . $_REQUEST['newMonitor']['ServerId']); Logger::Debug("NOT Auto selecting server" . $_REQUEST['newMonitor']['ServerId']);
} }
$columns = getTableColumns( 'Monitors' ); $columns = getTableColumns('Monitors');
$changes = getFormChanges( $monitor, $_REQUEST['newMonitor'], $types, $columns ); $changes = getFormChanges($monitor, $_REQUEST['newMonitor'], $types, $columns);
if ( count( $changes ) ) { if ( count( $changes ) ) {
if ( $mid ) { if ( $mid ) {
@ -565,6 +565,8 @@ if ( canEdit( 'Monitors' ) ) {
return; return;
} }
$restart = true;
} # end if count(changes)
if ( if (
( !isset($_POST['newMonitor']['GroupIds']) ) ( !isset($_POST['newMonitor']['GroupIds']) )
or or
@ -581,8 +583,6 @@ if ( canEdit( 'Monitors' ) ) {
} }
} }
} // end if there has been a change of groups } // end if there has been a change of groups
$restart = true;
} # end if count(changes)
if ( ZM_OPT_X10 ) { if ( ZM_OPT_X10 ) {
$x10Changes = getFormChanges( $x10Monitor, $_REQUEST['newX10Monitor'] ); $x10Changes = getFormChanges( $x10Monitor, $_REQUEST['newX10Monitor'] );