Fixed issue with 'set' values.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2793 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2009-03-03 17:50:31 +00:00
parent e6530eda40
commit f512cd91e7
1 changed files with 14 additions and 4 deletions

View File

@ -767,7 +767,7 @@ function getFormChanges( $values, $newValues, $types=false, $columns=false )
} }
default : default :
{ {
if ( empty($values[$key]) || ($values[$key] != $value) ) if ( !isset($values[$key]) || ($values[$key] != $value) )
{ {
$changes[$key] = "$key = '".dbEscape($value)."'"; $changes[$key] = "$key = '".dbEscape($value)."'";
} }
@ -777,13 +777,23 @@ function getFormChanges( $values, $newValues, $types=false, $columns=false )
} }
foreach( $values as $key=>$value ) foreach( $values as $key=>$value )
{ {
if ( !empty($columns[$key]) && !empty($types[$key]) && $types[$key] == 'toggle' ) if ( !empty($columns[$key]) )
{
if ( !empty($types[$key]) )
{
if ( $types[$key] == 'toggle' )
{ {
if ( !isset($newValues[$key]) && !empty($value) ) if ( !isset($newValues[$key]) && !empty($value) )
{ {
$changes[$key] = "$key = 0"; $changes[$key] = "$key = 0";
} }
} }
else if ( $types[$key] == 'set' )
{
$changes[$key] = "$key = ''";
}
}
}
} }
return( $changes ); return( $changes );
} }