Only save Group changes if there were changes

pull/2725/head
Isaac Connor 2019-09-25 10:14:12 -04:00
parent 475432449f
commit 5c80e098c5
1 changed files with 7 additions and 7 deletions

View File

@ -214,6 +214,13 @@ if ( $action == 'monitor' ) {
} }
} }
if ( isset($changes['GroupIds']) ) {
dbQuery('DELETE FROM Groups_Monitors WHERE MonitorId=?', array($mid));
foreach ( $changes['GroupIds'] as $group_id ) {
dbQuery('INSERT INTO Groups_Monitors (GroupId, MonitorId) VALUES (?,?)', array($group_id, $mid));
}
} // end if there has been a change of groups
$restart = true; $restart = true;
} else { } else {
ZM\Logger::Debug('No action due to no changes to Monitor'); ZM\Logger::Debug('No action due to no changes to Monitor');
@ -224,13 +231,6 @@ if ( $action == 'monitor' ) {
return; return;
} }
if ( isset($changes['GroupIds']) ) {
dbQuery('DELETE FROM Groups_Monitors WHERE MonitorId=?', array($mid));
foreach ( $changes['GroupIds'] as $group_id ) {
dbQuery('INSERT INTO Groups_Monitors (GroupId, MonitorId) VALUES (?,?)', array($group_id, $mid));
}
} // end if there has been a change of groups
if ( ZM_OPT_X10 ) { if ( ZM_OPT_X10 ) {
$x10Changes = getFormChanges($x10Monitor, $_REQUEST['newX10Monitor']); $x10Changes = getFormChanges($x10Monitor, $_REQUEST['newX10Monitor']);