add a case for toggle, which are booleans and default them to false

This commit is contained in:
Isaac Connor 2018-02-26 07:29:49 -08:00
parent e0d99018aa
commit 464b588f08
1 changed files with 11 additions and 0 deletions

View File

@ -641,6 +641,7 @@ function getFormChanges( $values, $newValues, $types=false, $columns=false ) {
if ( !isset($types[$key]) ) if ( !isset($types[$key]) )
$types[$key] = false; $types[$key] = false;
switch( $types[$key] ) { switch( $types[$key] ) {
case 'set' : case 'set' :
{ {
@ -702,6 +703,16 @@ function getFormChanges( $values, $newValues, $types=false, $columns=false ) {
} }
break; 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 : default :
{ {
if ( !isset($values[$key]) || ($values[$key] != $value) ) { if ( !isset($values[$key]) || ($values[$key] != $value) ) {