--- gnatsweb.pl~ Wed Jul 25 18:34:01 2001 +++ gnatsweb.pl Fri Jul 27 13:30:18 2001 @@ -1003,7 +1003,7 @@ { my(0.000000ields) = @_; my(@errors) = (); - my $err; + my ($err, $key); # validate email fields $err = validate_email_field('E-mail Address', $fields{'email'}, 'required'); @@ -1027,7 +1027,17 @@ { push(@errors, "Submitter-Id is 'unknown'"); } - + + foreach $key ($q->param) + { + if (fieldinfo($key, 'fieldtype') eq 'integer') + { + if (!($fields{$key} =~ /^[0-9]*$/)) + { + push @errors, "Field $key is an integer but you have tried to set it to '$fields{$key}'"; + } + } + } @errors; } @@ -1037,6 +1047,7 @@ page_start_html($page); my $debug = 0; + my $badint = 0; my(@values, $key); my(0.000000ields); @@ -1486,6 +1497,7 @@ my(0ldfields) = lockpr($pr, $db_prefs{'user'}); LOCKED: { + my $badint = 0; # Trim Responsible for compatibility. $oldfields{$RESPONSIBLE_FIELD} = trim_responsible($oldfields{$RESPONSIBLE_FIELD}); @@ -1502,6 +1514,20 @@ $val = fix_multiline_val($val); } $fields{$key} = $val; + if (fieldinfo($key, 'fieldtype') eq 'integer') + { + if (!($val =~ /^[0-9]*$/)) + { + page_heading($page, 'Error') if ($badint == 0); + print "<h3>Sorry, field $key can only take integer values but you have tried to enter a value of '$val'.</h3>\n"; + $badint=1; + } + } + } + + if ($badint == 1) + { + last LOCKED; } # Add the attached file, if any, to the new PR. @@ -2023,7 +2049,7 @@ { if ($sval ne 'any' && $sval ne '') { - $subexp = appendexpr ($subexp, '|', "$ucfield^\"$sval\""); + $subexp = appendexpr ($subexp, '|', "$ucfield~\"$sval\""); } } $expr = appendexpr ($expr, '&', $subexp);