add a case for toggle, which are booleans and default them to false
This commit is contained in:
parent
e0d99018aa
commit
464b588f08
|
@ -641,6 +641,7 @@ function getFormChanges( $values, $newValues, $types=false, $columns=false ) {
|
|||
|
||||
if ( !isset($types[$key]) )
|
||||
$types[$key] = false;
|
||||
|
||||
switch( $types[$key] ) {
|
||||
case 'set' :
|
||||
{
|
||||
|
@ -702,6 +703,16 @@ function getFormChanges( $values, $newValues, $types=false, $columns=false ) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case 'toggle' :
|
||||
if ( (!isset($values[$key])) or $values[$key] != $value ) {
|
||||
if ( empty($value) ) {
|
||||
$changes[$key] = "$key = 0";
|
||||
} else {
|
||||
$changes[$key] = "$key = 0";
|
||||
//$changes[$key] = $key . ' = '.dbEscape(trim($value));
|
||||
}
|
||||
}
|
||||
break;
|
||||
default :
|
||||
{
|
||||
if ( !isset($values[$key]) || ($values[$key] != $value) ) {
|
||||
|
|
Loading…
Reference in New Issue