From f7bb8c5aa998707f62849e00e2e9edd0f88c2c43 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 11 Mar 2020 12:02:19 +0100 Subject: [PATCH] Mandantenkonfiguration: UStID-Nummern beim Speichern validieren --- SL/Controller/ClientConfig.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SL/Controller/ClientConfig.pm b/SL/Controller/ClientConfig.pm index 3d5b7704a..9bf0eda3e 100644 --- a/SL/Controller/ClientConfig.pm +++ b/SL/Controller/ClientConfig.pm @@ -20,6 +20,7 @@ use SL::Template; use SL::Controller::TopQuickSearch; use SL::DB::Helper::AccountingPeriod qw(get_balance_startdate_method_options); use SL::Helper::ShippedQty; +use SL::VATIDNr; __PACKAGE__->run_before('check_auth'); @@ -99,6 +100,11 @@ sub action_save { } } + my $cleaned_ustid = SL::VATIDNr->clean($defaults->{co_ustid}); + if ($cleaned_ustid && !SL::VATIDNr->validate($cleaned_ustid)) { + push @errors, t8("The VAT ID number '#1' is invalid.", $defaults->{co_ustid}); + } + # Show form again if there were any errors. Nothing's been changed # yet in the database. if (@errors) { -- 2.20.1