From fd751746775f9da6743a3ac1de12cd48cc87bb9b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Fri, 8 Oct 2021 17:42:42 +0200 Subject: [PATCH] DeliveryOrder: fix validate on save --- SL/Controller/DeliveryOrder.pm | 2 +- SL/Controller/DeliveryOrder/TypeData.pm | 5 +++++ SL/DB/Manager/DeliveryOrder.pm | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/SL/Controller/DeliveryOrder.pm b/SL/Controller/DeliveryOrder.pm index 2d9328940..a43ddd88d 100644 --- a/SL/Controller/DeliveryOrder.pm +++ b/SL/Controller/DeliveryOrder.pm @@ -1161,7 +1161,7 @@ sub make_order { # order here solves this problem. my $order; $order = SL::DB::DeliveryOrder->new(id => $::form->{id})->load(with => [ 'orderitems', 'orderitems.part' ]) if $::form->{id}; - $order ||= SL::DB::DeliveryOrder->new(orderitems => [], currency_id => $::instance_conf->get_currency_id(), order_type => $self->type_data->validate_type($::form->{type})); + $order ||= SL::DB::DeliveryOrder->new(orderitems => [], currency_id => $::instance_conf->get_currency_id(), order_type => $self->type_data->validate($::form->{type})); my $cv_id_method = $self->cv . '_id'; if (!$::form->{id} && $::form->{$cv_id_method}) { diff --git a/SL/Controller/DeliveryOrder/TypeData.pm b/SL/Controller/DeliveryOrder/TypeData.pm index 52366f224..5b7cfe949 100644 --- a/SL/Controller/DeliveryOrder/TypeData.pm +++ b/SL/Controller/DeliveryOrder/TypeData.pm @@ -20,6 +20,11 @@ sub new { return $o; } +sub validate { + my ($self, $string) = @_; + validate_type($string); +} + sub text { my ($self, $string) = @_; get3($self->c->type, "text", $string); diff --git a/SL/DB/Manager/DeliveryOrder.pm b/SL/DB/Manager/DeliveryOrder.pm index 9f45ca0c9..3880bcf3a 100644 --- a/SL/DB/Manager/DeliveryOrder.pm +++ b/SL/DB/Manager/DeliveryOrder.pm @@ -29,7 +29,7 @@ sub type_filter { my $class = shift; my $type = lc(shift || ''); - return type => validate_type($type); + return order_type => validate_type($type); } sub _sort_spec { -- 2.20.1