DeliveryOrder: fix validate on save
authorSven Schöling <s.schoeling@googlemail.com>
Fri, 8 Oct 2021 15:42:42 +0000 (17:42 +0200)
committerJan Büren <jan@kivitendo.de>
Mon, 14 Feb 2022 13:58:19 +0000 (14:58 +0100)
SL/Controller/DeliveryOrder.pm
SL/Controller/DeliveryOrder/TypeData.pm
SL/DB/Manager/DeliveryOrder.pm

index 2d93289..a43ddd8 100644 (file)
@@ -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}) {
index 52366f2..5b7cfe9 100644 (file)
@@ -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);
index 9f45ca0..3880bcf 100644 (file)
@@ -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 {