From f008f68bfc6e1957e3fdafcf2650675cbb577178 Mon Sep 17 00:00:00 2001 From: Martin Kamerbeek Date: Tue, 26 Dec 2006 15:04:59 +0000 Subject: [PATCH] Merry Xmas bugfix #1: sqlform would not always obey regexes --- docs/changelog/7.x.x.txt | 3 ++- lib/WebGUI/Asset/Wobject/SQLForm.pm | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 512f2271b..47c6226a7 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -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. diff --git a/lib/WebGUI/Asset/Wobject/SQLForm.pm b/lib/WebGUI/Asset/Wobject/SQLForm.pm index ffe712bfc..dca0bdadb 100644 --- a/lib/WebGUI/Asset/Wobject/SQLForm.pm +++ b/lib/WebGUI/Asset/Wobject/SQLForm.pm @@ -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});