Errors in validate_numeric and validate_options get the default value returned.
This commit is contained in:
parent
f1368d4821
commit
69fd65d323
@ -256,11 +256,11 @@ sub validate_numeric {
|
|||||||
unless($value =~ /^$pattern$/);
|
unless($value =~ /^$pattern$/);
|
||||||
|
|
||||||
# Check minimum and maximum if needed
|
# Check minimum and maximum if needed
|
||||||
return ($settings -> {"default"}, $self -> {"template"} -> replace_langvar("BLOCK_VALIDATE_RANGEMIN", {"***field***" => $settings -> {"nicename"},
|
return ($settings -> {"min"}, $self -> {"template"} -> replace_langvar("BLOCK_VALIDATE_RANGEMIN", {"***field***" => $settings -> {"nicename"},
|
||||||
"***min***" => $settings -> {"min"}}))
|
"***min***" => $settings -> {"min"}}))
|
||||||
if(defined($settings -> {"min"}) && $value < $settings -> {"min"});
|
if(defined($settings -> {"min"}) && $value < $settings -> {"min"});
|
||||||
|
|
||||||
return ($settings -> {"default"}, $self -> {"template"} -> replace_langvar("BLOCK_VALIDATE_RANGEMAX", {"***field***" => $settings -> {"nicename"},
|
return ($settings -> {"max"}, $self -> {"template"} -> replace_langvar("BLOCK_VALIDATE_RANGEMAX", {"***field***" => $settings -> {"nicename"},
|
||||||
"***max***" => $settings -> {"max"}}))
|
"***max***" => $settings -> {"max"}}))
|
||||||
if(defined($settings -> {"max"}) && $value > $settings -> {"max"});
|
if(defined($settings -> {"max"}) && $value > $settings -> {"max"});
|
||||||
|
|
||||||
@ -297,7 +297,7 @@ sub validate_options {
|
|||||||
my $value = $self -> {"cgi"} -> param($param);
|
my $value = $self -> {"cgi"} -> param($param);
|
||||||
|
|
||||||
# Bomb if the value is not set and it is required.
|
# Bomb if the value is not set and it is required.
|
||||||
return ("", $self -> {"template"} -> replace_langvar("BLOCK_VALIDATE_NOTSET", {"***field***" => $settings -> {"nicename"}}))
|
return ($settings -> {"default"}, $self -> {"template"} -> replace_langvar("BLOCK_VALIDATE_NOTSET", {"***field***" => $settings -> {"nicename"}}))
|
||||||
if($settings -> {"required"} && (!defined($value) || $value eq ''));
|
if($settings -> {"required"} && (!defined($value) || $value eq ''));
|
||||||
|
|
||||||
# If the value not specified and not required, we can just return immediately
|
# If the value not specified and not required, we can just return immediately
|
||||||
@ -320,8 +320,8 @@ sub validate_options {
|
|||||||
".$settings -> {"where"});
|
".$settings -> {"where"});
|
||||||
# Check for the value in the table...
|
# Check for the value in the table...
|
||||||
$checkh -> execute($value)
|
$checkh -> execute($value)
|
||||||
or return (undef, $self -> {"template"} -> replace_langvar("BLOCK_VALIDATE_DBERR", {"***field***" => $settings -> {"nicename"},
|
or return ($settings -> {"default"}, $self -> {"template"} -> replace_langvar("BLOCK_VALIDATE_DBERR", {"***field***" => $settings -> {"nicename"},
|
||||||
"***dberr***" => $self -> {"dbh"} -> errstr}));
|
"***dberr***" => $self -> {"dbh"} -> errstr}));
|
||||||
my $checkr = $checkh -> fetchrow_arrayref();
|
my $checkr = $checkh -> fetchrow_arrayref();
|
||||||
|
|
||||||
# If we have a match, the value is valid
|
# If we have a match, the value is valid
|
||||||
@ -329,8 +329,8 @@ sub validate_options {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Get here and validation has failed. We can't rely on the value at all, so return
|
# Get here and validation has failed. We can't rely on the value at all, so return
|
||||||
# nothing for it, and an error
|
# the default, and an error
|
||||||
return (undef, $self -> {"template"} -> replace_langvar("BLOCK_VALIDATE_BADOPT", {"***field***" => $settings -> {"nicename"}}));
|
return ($settings -> {"default"}, $self -> {"template"} -> replace_langvar("BLOCK_VALIDATE_BADOPT", {"***field***" => $settings -> {"nicename"}}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -422,6 +422,7 @@ sub validate_htmlarea {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# Logging functions
|
# Logging functions
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user