From: Sven Schöling Date: Fri, 8 Oct 2021 15:42:42 +0000 (+0200) Subject: DeliveryOrder: fix validate on save X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~216^2~70 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=fd751746775f9da6743a3ac1de12cd48cc87bb9b;p=kivitendo-erp.git DeliveryOrder: fix validate on save --- 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 {