Merry Xmas bugfix #1: sqlform would not always obey regexes

This commit is contained in:
Martin Kamerbeek 2006-12-26 15:04:59 +00:00
parent 93288c8332
commit f008f68bfc
2 changed files with 5 additions and 4 deletions

View file

@ -14,7 +14,8 @@
- rfe: Added a "dateSpan" Event template variable that will show a properly
formatted date/time span depending on how the event's start and end are.
- fix: Disobedient Forum Rich Editor
- fix: SQLForm - fixed a bug where regexes would sometimes be ignored (Martin
Kamerbeek / Oqapi)
7.3.2
- fix: Calendar and Event now have printable templates and URL parameters.

View file

@ -863,11 +863,11 @@ sub _matchField {
my $self = shift;
my $data = shift;
my $regexId = shift;
return 1 unless ($regexId);
my ($regex) = $self->session->db->quickArray('select regex from SQLForm_regexes where regexId='.$self->session->db->quote($regexId));
return 1 unless ($regex);
if ($data =~ m/$regex/) {
@ -2741,7 +2741,7 @@ my $cmd = '$self->session->form->'.$field->{formFieldType}.'($fieldName)';
}
# Check if input matches its regex
if (_matchField($self, $fieldValue, $field->{regex})) {
if (_matchField($self, $self->session->form->process($fieldName), $field->{regex})) {
push(@update, "$fieldName = ".$self->session->db->quote($fieldValue));
} else {
push(@error, $i18n->get('ers regex mismatch').' '.$regexes{$field->{regex}}.' '.$field->{displayName});