Make it possible to enter NULL values by leaving fields blank.
authorSteinar H. Gunderson <sesse@samfundet.no>
Wed, 16 Feb 2005 14:35:20 +0000 (14:35 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Wed, 16 Feb 2005 14:35:20 +0000 (14:35 +0000)
html/do-edit-scores.pl

index fe29c16..8b28303 100755 (executable)
@@ -20,9 +20,12 @@ for my $p ($cgi->param()) {
        next unless (defined($cgi->param('old-' . $p)));
        next if ($cgi->param($p) eq $cgi->param('old-' . $p));
 
+       my $val = $cgi->param($p);
+       undef $val if ($val =~ /^\s*$/);
+
        if ($p =~ /^score(\d+)-(\d+)/) {
                $dbh->do('UPDATE scores SET score=? WHERE tournament=? AND round=? AND parallel=? AND player=? AND songnumber=?', undef,
-                       $cgi->param($p), $tournament, $round, $group, $1, $2);
+                       $val, $tournament, $round, $group, $1, $2);
        }
 }