From 03938396b8f77e5e08e392d54ce2f68cd8cca4ae Mon Sep 17 00:00:00 2001 From: Rolf Fluehmann Date: Tue, 7 Jan 2014 13:29:39 +0100 Subject: [PATCH] 2220,2321: Validierung eingegebener Kunden- und Lieferantennamen --- SL/Controller/CustomerVendor.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/SL/Controller/CustomerVendor.pm b/SL/Controller/CustomerVendor.pm index de7749037..e5cb556ac 100644 --- a/SL/Controller/CustomerVendor.pm +++ b/SL/Controller/CustomerVendor.pm @@ -167,6 +167,17 @@ sub _save { sub action_save { my ($self) = @_; + my $pattern = '[ \t\n\r]+'; + my $name = $self->{cv}->name; + $name =~ s/^$pattern//; + $name =~ s/$pattern$//; + $name =~ s/$pattern/ /g; + if ( $name eq '' ) { + $::form->dberror( $::locale->text('Customer missing!') ); + } else { + $self->{cv}->name($name); + } + $self->_save(); my @redirect_params = ( -- 2.20.1