Commit a270720d authored by Keith Jolley's avatar Keith Jolley

Check for boolean values in batch upload.

Fixes #286.
parent b6b3cf21
......@@ -824,7 +824,7 @@ sub _is_field_bad_other {
}
}
$thisfield->{'type'} ||= 'text';
my @checks_by_attribute = qw(required integer float regex optlist length);
my @checks_by_attribute = qw(required integer boolean float regex optlist length);
foreach my $check (@checks_by_attribute) {
my $method = "_check_other_$check";
my $message = $self->$method( $thisfield, $value );
......@@ -913,6 +913,16 @@ sub _check_other_float { ## no critic (ProhibitUnusedPrivateSubroutines) #C
return;
}
#Make sure boolean fields really are boolean
sub _check_other_boolean {
my ( $self, $thisfield, $value ) = @_;
return if !defined $value || $value eq q();
if ( $thisfield->{'type'} eq 'bool' && !BIGSdb::Utils::is_bool($value) ) {
return 'must be a boolean value (true/false or 1/0)';
}
return;
}
#Make sure sender is in database
sub _check_other_sender { ## no critic (ProhibitUnusedPrivateSubroutines) #Called by dispatch table
my ( $self, $field, $value ) = @_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment