fix logic when disabling a monitor
This commit is contained in:
parent
2b37999cd5
commit
0c956d6728
|
@ -289,14 +289,15 @@ if ( !empty($action) ) {
|
|||
if ( !empty($_REQUEST['mid']) && canEdit( 'Monitors', $_REQUEST['mid'] ) ) {
|
||||
$mid = validInt($_REQUEST['mid']);
|
||||
if ( $action == 'function' ) {
|
||||
$monitor = dbFetchOne( "SELECT * FROM Monitors WHERE Id=?", NULL, array($mid) );
|
||||
$monitor = dbFetchOne( 'SELECT * FROM Monitors WHERE Id=?', NULL, array($mid) );
|
||||
|
||||
$newFunction = validStr($_REQUEST['newFunction']);
|
||||
$newEnabled = isset( $_REQUEST['newEnabled'] ) and $_REQUEST['newEnabled'] != '1' ? '0' : '1';
|
||||
# Because we use a checkbox, it won't get passed in the request. So not being in _REQUEST means 0
|
||||
$newEnabled = ( !isset( $_REQUEST['newEnabled'] ) or $_REQUEST['newEnabled'] != '1' ) ? '0' : '1';
|
||||
$oldFunction = $monitor['Function'];
|
||||
$oldEnabled = $monitor['Enabled'];
|
||||
if ( $newFunction != $oldFunction || $newEnabled != $oldEnabled ) {
|
||||
dbQuery( "update Monitors set Function=?, Enabled=? where Id=?", array( $newFunction, $newEnabled, $mid ) );
|
||||
dbQuery( 'UPDATE Monitors SET Function=?, Enabled=? WHERE Id=?', array( $newFunction, $newEnabled, $mid ) );
|
||||
|
||||
$monitor['Function'] = $newFunction;
|
||||
$monitor['Enabled'] = $newEnabled;
|
||||
|
|
Loading…
Reference in New Issue