From 8a2ed5cce4aaefabfbe2ed25378c33d033bbe00e Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sat, 16 Nov 2002 11:24:06 +0000 Subject: [PATCH] bug 638275 --- ChangeLog | 3 +++ tbl_replace.php3 | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5fa22266b..499f0666b 100755 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,9 @@ $Source$ 2002-11-16 Marc Delisle * libraries/build_dump.lib.php3: fix for old MySQL, thanks to Flavio Poletti (flavio at polettix.it) + * tbl_replace.php3: bug 638275: ignore NULL checkbox is there is + a value for the field (possible if js is disabled, or broken browser + like Konqueror 2.2.2); implemented on insert or update 2002-11-08 Robin Johnson * lib/sqlparser.data.php3: Bug #639291 fixed diff --git a/tbl_replace.php3 b/tbl_replace.php3 index 6a2295c3a..5d66fbf79 100755 --- a/tbl_replace.php3 +++ b/tbl_replace.php3 @@ -143,7 +143,10 @@ if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) { } // end switch // Was the Null checkbox checked for this field? - if (isset($fields_null) && isset($fields_null[$encoded_key])) { + // (if there is a value, we ignore the Null checkbox: this could + // be possible if Javascript is disabled in the browser) + if (isset($fields_null) && isset($fields_null[$encoded_key]) + && $val=="''") { $val = 'NULL'; } @@ -165,7 +168,7 @@ if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) { } } // end while - // Builds the sql upate query + // Builds the sql update query $valuelist = ereg_replace(', $', '', $valuelist); if (!empty($valuelist)) { $query = 'UPDATE ' . PMA_backquote($table) . ' SET ' . $valuelist . ' WHERE' . $primary_key @@ -249,7 +252,10 @@ else { } // end switch // Was the Null checkbox checked for this field? - if (isset($fields_null) && isset($fields_null[$encoded_key])) { + // (if there is a value, we ignore the Null checkbox: this could + // be possible if Javascript is disabled in the browser) + if (isset($fields_null) && isset($fields_null[$encoded_key]) + && $val=="''") { $val = 'NULL'; }