From 464b588f0873041fa52d4f6a02b6fdb4284296ac Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 26 Feb 2018 07:29:49 -0800 Subject: [PATCH] add a case for toggle, which are booleans and default them to false --- web/includes/functions.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/web/includes/functions.php b/web/includes/functions.php index b85624335..4e94b2f7e 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -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) ) {