improve zone saving testing for value before doing math
This commit is contained in:
parent
f2300f2e8c
commit
eb2269ea52
|
@ -21,7 +21,7 @@
|
||||||
// Monitor edit actions, require a monitor id and edit permissions for that monitor
|
// Monitor edit actions, require a monitor id and edit permissions for that monitor
|
||||||
if ( !empty($_REQUEST['mid']) && canEdit('Monitors', $_REQUEST['mid']) ) {
|
if ( !empty($_REQUEST['mid']) && canEdit('Monitors', $_REQUEST['mid']) ) {
|
||||||
$mid = validInt($_REQUEST['mid']);
|
$mid = validInt($_REQUEST['mid']);
|
||||||
if ( $action == 'zone' && isset($_REQUEST['zid']) ) {
|
if ( ($action == 'zone') && isset($_REQUEST['zid']) ) {
|
||||||
$zid = validInt($_REQUEST['zid']);
|
$zid = validInt($_REQUEST['zid']);
|
||||||
$monitor = new ZM\Monitor($mid);
|
$monitor = new ZM\Monitor($mid);
|
||||||
|
|
||||||
|
@ -32,17 +32,15 @@ if ( !empty($_REQUEST['mid']) && canEdit('Monitors', $_REQUEST['mid']) ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $_REQUEST['newZone']['Units'] == 'Percent' ) {
|
if ( $_REQUEST['newZone']['Units'] == 'Percent' ) {
|
||||||
$_REQUEST['newZone']['MinAlarmPixels'] = intval(($_REQUEST['newZone']['MinAlarmPixels']*$_REQUEST['newZone']['Area'])/100);
|
foreach (array(
|
||||||
$_REQUEST['newZone']['MaxAlarmPixels'] = intval(($_REQUEST['newZone']['MaxAlarmPixels']*$_REQUEST['newZone']['Area'])/100);
|
'MinAlarmPixels','MaxAlarmPixels',
|
||||||
if ( isset($_REQUEST['newZone']['MinFilterPixels']) )
|
'MinFilterPixels','MaxFilterPixels',
|
||||||
$_REQUEST['newZone']['MinFilterPixels'] = intval(($_REQUEST['newZone']['MinFilterPixels']*$_REQUEST['newZone']['Area'])/100);
|
'MinBlobPixels','MaxBlobPixels'
|
||||||
if ( isset($_REQUEST['newZone']['MaxFilterPixels']) )
|
) as $field ) {
|
||||||
$_REQUEST['newZone']['MaxFilterPixels'] = intval(($_REQUEST['newZone']['MaxFilterPixels']*$_REQUEST['newZone']['Area'])/100);
|
if ( isset($_REQUEST['newZone'][$field]) and $_REQUEST['newZone'][$field] )
|
||||||
if ( isset($_REQUEST['newZone']['MinBlobPixels']) )
|
$_REQUEST['newZone'][$field] = intval(($_REQUEST['newZone'][$field]*$_REQUEST['newZone']['Area'])/100);
|
||||||
$_REQUEST['newZone']['MinBlobPixels'] = intval(($_REQUEST['newZone']['MinBlobPixels']*$_REQUEST['newZone']['Area'])/100);
|
}
|
||||||
if ( isset($_REQUEST['newZone']['MaxBlobPixels']) )
|
}
|
||||||
$_REQUEST['newZone']['MaxBlobPixels'] = intval(($_REQUEST['newZone']['MaxBlobPixels']*$_REQUEST['newZone']['Area'])/100);
|
|
||||||
}
|
|
||||||
|
|
||||||
unset($_REQUEST['newZone']['Points']);
|
unset($_REQUEST['newZone']['Points']);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue