Allow case insensitive matching on source arrays

This commit is contained in:
Chris 2019-08-15 13:27:18 +01:00
parent 42be4997fd
commit f59fae3738

View File

@ -313,13 +313,17 @@ sub validate_options {
# Determine how we will check it. If the source is an array reference, we do an array check # Determine how we will check it. If the source is an array reference, we do an array check
if(ref($settings -> {"source"}) eq "ARRAY") { if(ref($settings -> {"source"}) eq "ARRAY") {
# Fix to lowercase if case sensitivity is off
$value = lc($value) if($settings -> {"nocase"});
foreach my $check (@{$settings -> {"source"}}) { foreach my $check (@{$settings -> {"source"}}) {
if(ref($check) eq "HASH") { $check = $check-> {"value"} if(ref($check) eq "HASH");
return ($value, undef) if($check -> {"value"} eq $value);
} else { # Fix to lowercase if case sensitivity is off
$check = lc($check) if($settings -> {"nocase"});
return ($value, undef) if($check eq $value); return ($value, undef) if($check eq $value);
} }
}
# If the source is not a reference, we assue it is the table name to check # If the source is not a reference, we assue it is the table name to check
} elsif(not ref($settings -> {"source"})) { } elsif(not ref($settings -> {"source"})) {